Skip to main content

OutputElement

Trait OutputElement 

Source
pub trait OutputElement:
    'static
    + Sized
    + Default {
    // Required methods
    fn element_dtype() -> DType;
    fn build(values: Vec<Self>) -> ArrayRef;

    // Provided method
    fn build_from<S, F>(source: S, apply: F) -> 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.

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 build(values: Vec<Self>) -> ArrayRef

Build an all-valid column from one value per row.

The returned column must contain values.len() rows and match element_dtype except for outer nullability. The default build_from implementation and valid-row execution call this method.

Provided Methods§

Source

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

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

The default collects one value per row into a Vec before calling build. 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.

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§

fn element_dtype() -> DType

Source§

fn build(values: Vec<Self>) -> ArrayRef

Source§

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

Implementors§