Trait mz_persist_types::columnar::Data
source · pub trait Data:
Debug
+ Send
+ Sync
+ Sized
+ 'static {
type Cfg: ColumnCfg<Self>;
type Ref<'a>: Default
where Self: 'a;
type Col: ColumnGet<Self>;
type Mut: ColumnPush<Self>;
type Stats: ColumnStats + StatsFrom<Self::Col>;
}
Expand description
A type understood by persist.
The equality and sorting of the encoded column matches those of this rust type.
This trait is implemented for owned types. However, for efficiency the
columns themselves don’t store the owned types, so instead we read and write
in terms of the associated Self::Ref. This is not simply &Self
because
e.g. it’s sometimes not possible for us to present the column as something
like &Option<T>
but we can always produce a Option<&T>
. Tuples have a
similar restriction.
This trait is intentionally “sealed” via the unexported Column trait.
There is a 1:1 mapping between implementors of Data and variants of the DataType enum. The parallel hierarchy exists so that Data can be ergonomic while DataType is object-safe and has exhaustiveness checking. A Data impl can be mapped to its corresponding DataType via ColumnCfg::as_type and back via DataType::data_fn.
TODO(parkmycar): Remove once Schema2
is fully flushed out.
Required Associated Types§
sourcetype Cfg: ColumnCfg<Self>
type Cfg: ColumnCfg<Self>
If necessary, whatever information beyond the type of Self
needed to
produce a columnar schema for this type.
Conceptually: type of Self
+ this config => columnar schema.
For most Data impls, this is not necessary and set to ()
.
sourcetype Ref<'a>: Default
where
Self: 'a
type Ref<'a>: Default where Self: 'a
The associated reference type of Self used for reads and writes on columns of this type.
sourcetype Mut: ColumnPush<Self>
type Mut: ColumnPush<Self>
The exclusive builder of columns of this type of data.
sourcetype Stats: ColumnStats + StatsFrom<Self::Col>
type Stats: ColumnStats + StatsFrom<Self::Col>
The statistics type of columns of this type of data.