Skip to main content

OutputElement

Trait OutputElement 

Source
pub trait OutputElement:
    'static
    + Sized
    + Default {
    type Buffer: OutputBuffer<Self> + 'static;

    // Required methods
    fn element_dtype() -> DType;
    fn with_capacity(
        rows: usize,
        allocator: &BufferAllocatorRef,
    ) -> Self::Buffer;

    // Provided method
    fn build_from<S, F>(
        source: S,
        apply: F,
        allocator: &BufferAllocatorRef,
    ) -> ArrayRef
       where S: IndexedSource,
             F: Fn(S::Item) -> Self { ... }
}
Expand description

An owned row value that can be built into an all-valid column.

Skip-invalid execution uses Default only as a placeholder for invalid rows. Batch execution masks those rows before returning the output. Each implementation owns allocation and array construction. Execution only writes through its OutputBuffer slots.

Required Associated Types§

Source

type Buffer: OutputBuffer<Self> + 'static

Storage used to collect this element type before constructing its column.

Required Methods§

Source

fn element_dtype() -> DType

The dtype of columns built from this element type. Must be non-nullable: nullability is derived from the inputs by batch execution.

Because this method takes no arguments, the dtype must be a property of the Rust type. Use an OutputSink when the output dtype depends on function options.

Source

fn with_capacity(rows: usize, allocator: &BufferAllocatorRef) -> Self::Buffer

Allocate storage with at least rows writable slots using the execution allocator.

Finishing the buffer must produce an all-valid column whose dtype matches element_dtype except for outer nullability.

Provided Methods§

Source

fn build_from<S, F>( source: S, apply: F, allocator: &BufferAllocatorRef, ) -> ArrayRef
where S: IndexedSource, F: Fn(S::Item) -> Self,

Map a contiguous row source directly into an all-valid column.

The default writes into the storage returned by with_capacity, then finishes it. An output type can override this method when its physical representation supports a more efficient bulk mapping. The implementation must call apply exactly once for every source row in increasing order and return the same values as the default implementation. Any new payload buffers must use allocator.

An override must not introduce value-dependent errors or panics. Fallible operations must use a fallible visitor path so that RowFn::INFALLIBLE continues to protect optimizer transformations.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementations on Foreign Types§

Source§

impl OutputElement for bool

Source§

type Buffer = BufferMut<bool>

Source§

fn element_dtype() -> DType

Source§

fn with_capacity(rows: usize, allocator: &BufferAllocatorRef) -> Self::Buffer

Source§

fn build_from<S, F>( source: S, apply: F, allocator: &BufferAllocatorRef, ) -> ArrayRef
where S: IndexedSource, F: Fn(S::Item) -> Self,

Implementors§