Trait mz_persist_types::columnar::ColumnDecoder

source ·
pub trait ColumnDecoder<T> {
    // Required methods
    fn decode(&self, idx: usize, val: &mut T);
    fn is_null(&self, idx: usize) -> bool;
    fn stats(&self) -> StructStats;
}
Expand description

A decoder for values of a fixed schema.

This allows us to amortize the cost of downcasting columns into concrete types.

Required Methods§

source

fn decode(&self, idx: usize, val: &mut T)

Decode the value at idx into the buffer val.

Behavior for when the value at idx is null is implementation-defined. Panics if decoding an idx that is out-of-bounds.

source

fn is_null(&self, idx: usize) -> bool

Returns if the value at idx is null.

source

fn stats(&self) -> StructStats

Returns statistics for the column. This structure is defined by Persist, but the contents are determined by the client; Persist will preserve them in the part metadata and make them available to readers.

TODO: For now, we require that the stats be structured as a non-nullable struct. For a single column, map them to a struct with a single column named the empty string. Fix this restriction if we end up with non-test code that isn’t naturally a struct.

Implementors§