TakeKernel

Trait TakeKernel 

Source
pub trait TakeKernel: VTable {
    // Required method
    fn take(
        &self,
        array: &Self::Array,
        indices: &dyn Array,
    ) -> VortexResult<ArrayRef>;
}

Required Methods§

Source

fn take( &self, array: &Self::Array, indices: &dyn Array, ) -> VortexResult<ArrayRef>

Create a new array by taking the values from the array at the given indices.

§Panics

Using indices that are invalid for the given array will cause a panic.

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§

Source§

impl TakeKernel for BoolVTable

Source§

impl TakeKernel for ChunkedVTable

Source§

impl TakeKernel for ConstantVTable

Source§

impl TakeKernel for DecimalVTable

Source§

impl TakeKernel for ExtensionVTable

Source§

impl TakeKernel 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.

Source§

impl TakeKernel for ListVTable

Take implementation for ListArray.

This implementation converts the ListArray to a ListViewArray and then delegates to its take implementation. This approach avoids the need to rebuild the elements array.

The resulting ListViewArray can represent non-contiguous and out-of-order lists, which would violate ListArray’s invariants (but not ListViewArray’s).

Source§

impl TakeKernel 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.

Source§

impl TakeKernel for MaskedVTable

Source§

impl TakeKernel for NullVTable

Source§

impl TakeKernel for PrimitiveVTable

Source§

impl TakeKernel for StructVTable

Source§

impl TakeKernel for VarBinVTable

Source§

impl TakeKernel for VarBinViewVTable

Take involves creating a new array that references the old array, just with the given set of views.