Skip to main content

OperationsVTable

Trait OperationsVTable 

Source
pub trait OperationsVTable<V: VTable> {
    type ProbeState: Default + 'static;

    // Required method
    fn scalar_at(
        array: ArrayView<'_, V>,
        index: usize,
        ctx: &mut ExecutionCtx,
    ) -> VortexResult<Scalar>;

    // Provided method
    fn probe_scalar(
        state: &mut ProbeState<'_, V>,
        index: usize,
        ctx: &mut ExecutionCtx,
    ) -> VortexResult<Scalar> { ... }
}
Expand description

Element-level operations for an array encoding.

This trait is separated from VTable so encodings can organize scalar access independently from traversal, serialization, and execution. The erased ArrayRef methods perform common checks before dispatching here.

Required Associated Types§

Source

type ProbeState: Default + 'static

Encoding-specific state retained by repeated scalar access.

Built once per repeated probe and never for a one-off read. Preparation belongs in Self::probe_scalar. State owns its preparation and may hold shared buffer or array handles. Use () when no state is needed.

Required Methods§

Source

fn scalar_at( array: ArrayView<'_, V>, index: usize, ctx: &mut ExecutionCtx, ) -> VortexResult<Scalar>

Fetch the scalar at the given index.

§Preconditions

Bounds-checking has already been performed by the time this function is called, and the index is guaranteed to be non-null. Implementations may assume index < len.

§Postconditions

The returned Scalar must have the same logical dtype as the array’s element dtype.

Provided Methods§

Source

fn probe_scalar( state: &mut ProbeState<'_, V>, index: usize, ctx: &mut ExecutionCtx, ) -> VortexResult<Scalar>

Read the scalar at index of the array in state, including its nullness.

Caller must guarantee index < len. The row may be null, and a null row must come back as Scalar::null of the array’s dtype. Check the array’s own validity with ProbeState::is_valid.

state carries the typed view of the array and, for a read through a RepeatedArrayProbe, the state that probe keeps. Read children through ProbeState::slot, which follows the read’s policy without the encoding having to know it. Take encoding state from ProbeState::retained. The scalar must retain the source’s logical dtype, including nullability.

The default checks validity and then reads through Self::scalar_at.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§

Source§

impl OperationsVTable<Bool> for Bool

Source§

impl OperationsVTable<Chunked> for Chunked

Source§

impl OperationsVTable<Constant> for Constant

Source§

impl OperationsVTable<Decimal> for Decimal

Source§

impl OperationsVTable<Dict> for Dict

Source§

impl OperationsVTable<Extension> for Extension

Source§

impl OperationsVTable<Filter> for Filter

Source§

impl OperationsVTable<FixedSizeList> for FixedSizeList

Source§

impl OperationsVTable<Interleave> for Interleave

Source§

impl OperationsVTable<List> for List

Source§

impl OperationsVTable<ListView> for ListView

Source§

impl OperationsVTable<Map> for Map

Source§

impl OperationsVTable<Masked> for Masked

Source§

impl OperationsVTable<Null> for Null

Source§

impl OperationsVTable<Patched> for Patched

Source§

impl OperationsVTable<PiecewiseSequence> for PiecewiseSequence

Source§

impl OperationsVTable<Primitive> for Primitive

Source§

impl OperationsVTable<ScalarFn> for ScalarFn

Source§

impl OperationsVTable<Shared> for Shared

Source§

impl OperationsVTable<Slice> for Slice

Source§

impl OperationsVTable<Struct> for Struct

Source§

impl OperationsVTable<Union> for Union

Source§

impl OperationsVTable<VarBin> for VarBin

Source§

impl OperationsVTable<VarBinView> for VarBinView

Source§

impl OperationsVTable<Variant> for Variant

Source§

impl<V: VTable> OperationsVTable<V> for NotSupported