Skip to main content

ZipKernel

Trait ZipKernel 

Source
pub trait ZipKernel: VTable {
    // Required method
    fn zip(
        array: ArrayView<'_, Self>,
        if_false: &ArrayRef,
        mask: &ArrayRef,
        ctx: &mut ExecutionCtx,
    ) -> VortexResult<Option<ArrayRef>>;
}
Expand description

Zip two arrays using a mask, potentially reading buffers.

Unlike ZipReduce, this trait is for zip implementations that may need to read and execute on the underlying buffers to produce the result.

Dispatch is on child 0 (if_true). The if_false and mask are extracted from the parent ScalarFnArray.

Required Methods§

Source

fn zip( array: ArrayView<'_, Self>, if_false: &ArrayRef, mask: &ArrayRef, ctx: &mut ExecutionCtx, ) -> VortexResult<Option<ArrayRef>>

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl ZipKernel for Bool

A branchless boolean zip kernel that blends the two value bitmaps with the mask in one pass.

Booleans are bit-packed, so selecting if_true where the mask is set and if_false where it is not is a single bitwise blend over the packed words — (true & mask) | (false & !mask) — instead of the generic per-run builder. Validity is combined with the shared zip_validity, which itself reuses this kernel (terminating immediately, since validity bitmaps are non-nullable).

Source§

impl ZipKernel for Chunked

Source§

impl ZipKernel for ListView

Zip two ListViewArrays by selecting whole list views per row.

A ListViewArray addresses each list by an (offset, size) pair into a shared elements array, and unlike ListArray it does not require lists to be stored contiguously or in order. Zipping two list views is therefore a metadata-only operation over the offsets, sizes and validity child arrays: we concatenate the two elements arrays (without rewriting them) and, for each row, select the (offset, size) pair from if_true or if_false per the mask. if_false views are shifted past the end of if_true’s elements so they continue to address the correct half of the concatenated elements array.

Source§

impl ZipKernel for Primitive

A dedicated primitive zip kernel that selects values branchlessly per row.

The generic zip path copies runs of if_true/if_false between mask boundaries, which is fast for clustered masks but degrades to per-element work on fragmented masks. This kernel instead walks the mask as 64-bit chunks and blends both sides per row without a data-dependent branch, so the inner loop stays branch-free and auto-vectorizable regardless of mask shape.

Source§

impl ZipKernel for Struct

Source§

impl ZipKernel for VarBinView