pub trait TakeExecute: VTable {
// Required method
fn take(
array: &Self::Array,
indices: &dyn Array,
ctx: &mut ExecutionCtx,
) -> VortexResult<Option<ArrayRef>>;
}Required Methods§
Sourcefn take(
array: &Self::Array,
indices: &dyn Array,
ctx: &mut ExecutionCtx,
) -> VortexResult<Option<ArrayRef>>
fn take( array: &Self::Array, indices: &dyn Array, ctx: &mut ExecutionCtx, ) -> VortexResult<Option<ArrayRef>>
Take elements from an array at the given indices, potentially reading buffers.
Unlike TakeReduce, this trait is for take implementations that may need to read
and execute on the underlying buffers to produce the result.
§Preconditions
The indices are guaranteed to be non-empty.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.
Implementors§
impl TakeExecute for BoolVTable
impl TakeExecute for ChunkedVTable
impl TakeExecute for DecimalVTable
impl TakeExecute for DictVTable
impl TakeExecute for ExtensionVTable
impl TakeExecute for FixedSizeListVTable
Take implementation for FixedSizeListArray.
Unlike ListView, FixedSizeListArray must rebuild the elements array because it requires
that elements start at offset 0 and be perfectly packed without gaps. We expand list indices
into element indices and push them down to the child elements array.
impl TakeExecute for ListVTable
impl TakeExecute for ListViewVTable
ListViewArray take implementation.
This implementation is deliberately simple and read-optimized. We just take the offsets and
sizes at the requested indices and reuse the original elements array. This works because
ListView (unlike List) allows non-contiguous and out-of-order lists.
We don’t slice the elements array because it would require computing min/max offsets and
adjusting all offsets accordingly, which is not really worth the small potential memory we would
be able to get back.
The trade-off is that we may keep unreferenced elements in memory, but this is acceptable since we’re optimizing for read performance and the data isn’t being copied.