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§
Sourcetype StatsType: CompressorStats
type StatsType: CompressorStats
Type of the stats generated by the compression scheme.
Required Methods§
Provided Methods§
Sourcefn is_constant(&self) -> bool
fn is_constant(&self) -> bool
True if this is the singular Constant scheme for this data type.
Sourcefn expected_compression_ratio(
&self,
stats: &Self::StatsType,
is_sample: bool,
allowed_cascading: usize,
excludes: &[Self::CodeType],
) -> VortexResult<f64>
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.