lance_encoding::encoder

Trait FieldEncodingStrategy

Source
pub trait FieldEncodingStrategy:
    Send
    + Sync
    + Debug {
    // Required method
    fn create_field_encoder(
        &self,
        encoding_strategy_root: &dyn FieldEncodingStrategy,
        field: &Field,
        column_index: &mut ColumnIndexSequence,
        options: &EncodingOptions,
    ) -> Result<Box<dyn FieldEncoder>>;
}
Expand description

A trait to pick which kind of field encoding to use for a field

Unlike the ArrayEncodingStrategy, the field encoding strategy is chosen before any data is generated and the same field encoder is used for all data in the field.

Required Methods§

Source

fn create_field_encoder( &self, encoding_strategy_root: &dyn FieldEncodingStrategy, field: &Field, column_index: &mut ColumnIndexSequence, options: &EncodingOptions, ) -> Result<Box<dyn FieldEncoder>>

Choose and create an appropriate field encoder for the given field.

The field encoder can be chosen on the data type as well as any metadata that is attached to the field.

The encoding_strategy_root is the encoder that should be used to encode any inner data in struct / list / etc. fields.

Initially it is the same as self and generally should be forwarded to any inner encoding strategy.

Implementors§