Scheme

Trait Scheme 

Source
pub trait Scheme: Debug {
    type StatsType: CompressorStats;
    type CodeType: Copy + Eq + Hash;

    // Required methods
    fn code(&self) -> Self::CodeType;
    fn compress(
        &self,
        stats: &Self::StatsType,
        is_sample: bool,
        allowed_cascading: usize,
        excludes: &[Self::CodeType],
    ) -> VortexResult<ArrayRef>;

    // Provided methods
    fn is_constant(&self) -> bool { ... }
    fn expected_compression_ratio(
        &self,
        stats: &Self::StatsType,
        is_sample: bool,
        allowed_cascading: usize,
        excludes: &[Self::CodeType],
    ) -> VortexResult<f64> { ... }
}
Expand description

Top-level compression scheme trait.

Variants are specialized for each data type, e.g. see IntegerScheme, FloatScheme, etc.

Required Associated Types§

Source

type StatsType: CompressorStats

Type of the stats generated by the compression scheme.

Source

type CodeType: Copy + Eq + Hash

Type of the code used to uniquely identify the compression scheme.

Required Methods§

Source

fn code(&self) -> Self::CodeType

Scheme unique identifier.

Source

fn compress( &self, stats: &Self::StatsType, is_sample: bool, allowed_cascading: usize, excludes: &[Self::CodeType], ) -> VortexResult<ArrayRef>

Compress the input with this scheme, yielding a new array.

Provided Methods§

Source

fn is_constant(&self) -> bool

True if this is the singular Constant scheme for this data type.

Source

fn expected_compression_ratio( &self, stats: &Self::StatsType, is_sample: bool, allowed_cascading: usize, excludes: &[Self::CodeType], ) -> VortexResult<f64>

Estimate the compression ratio for running this scheme (and its children) for the given input.

Depth is the depth in the encoding tree we’ve already reached before considering this scheme.

Returns the estimated compression ratio as well as the tree of compressors to use.

Implementors§