mz_persist_types::columnar

Trait Schema

Source
pub trait Schema<T>:
    Debug
    + Send
    + Sync {
    type ArrowColumn: Array + Debug + Clone + 'static;
    type Statistics: DynStats + 'static;
    type Decoder: ColumnDecoder<T> + Debug + Send + Sync;
    type Encoder: ColumnEncoder<T, FinishedColumn = Self::ArrowColumn> + Debug + Send + Sync;

    // Required methods
    fn decoder(&self, col: Self::ArrowColumn) -> Result<Self::Decoder, Error>;
    fn encoder(&self) -> Result<Self::Encoder, Error>;

    // Provided method
    fn decoder_any(&self, col: &dyn Array) -> Result<Self::Decoder, Error> { ... }
}
Expand description

Description of a type that we encode into Persist.

Required Associated Types§

Source

type ArrowColumn: Array + Debug + Clone + 'static

The type of column we decode from, and encoder will finish into.

Source

type Statistics: DynStats + 'static

Statistics we collect for a schema of this type.

Source

type Decoder: ColumnDecoder<T> + Debug + Send + Sync

Type that is able to decode values of T from Self::ArrowColumn.

Source

type Encoder: ColumnEncoder<T, FinishedColumn = Self::ArrowColumn> + Debug + Send + Sync

Type that is able to encoder values of T.

Required Methods§

Source

fn decoder(&self, col: Self::ArrowColumn) -> Result<Self::Decoder, Error>

Returns a type that is able to decode instances of T from the provider column.

Source

fn encoder(&self) -> Result<Self::Encoder, Error>

Returns a type that can encode values of T.

Provided Methods§

Source

fn decoder_any(&self, col: &dyn Array) -> Result<Self::Decoder, Error>

Returns a type that is able to decode instances of T from a type erased arrow::array::Array, erroring if the provided array is not Self::ArrowColumn.

Implementors§

Source§

impl Schema<()> for UnitSchema

Source§

impl Schema<Bytes> for VecU8Schema

Source§

impl Schema<ShardId> for ShardIdSchema

Source§

impl Schema<String> for StringSchema

Source§

impl Schema<Vec<u8>> for VecU8Schema

Source§

impl<T: Debug + Send + Sync> Schema<T> for TodoSchema<T>