lance_encoding::encoder

Trait CompressionStrategy

Source
pub trait CompressionStrategy:
    Send
    + Sync
    + Debug {
    // Required methods
    fn create_block_compressor(
        &self,
        field: &Field,
        data: &DataBlock,
    ) -> Result<(Box<dyn BlockCompressor>, ArrayEncoding)>;
    fn create_per_value(
        &self,
        field: &Field,
        data: &DataBlock,
    ) -> Result<Box<dyn PerValueCompressor>>;
    fn create_miniblock_compressor(
        &self,
        field: &Field,
        data: &DataBlock,
    ) -> Result<Box<dyn MiniBlockCompressor>>;
}
Expand description

A trait to pick which compression to use for given data

There are several different kinds of compression.

  • Block compression is the most generic, but most difficult to use efficiently
  • Per-value compression results in either a fixed width data block or a variable width data block. In other words, there is some number of bits per value. In addition, each value should be independently decompressible.
  • Mini-block compression results in a small block of opaque data for chunks of rows. Each block is somewhere between 0 and 16KiB in size. This is used for narrow data types (both fixed and variable length) where we can fit many values into an 16KiB block.

Required Methods§

Source

fn create_block_compressor( &self, field: &Field, data: &DataBlock, ) -> Result<(Box<dyn BlockCompressor>, ArrayEncoding)>

Create a block compressor for the given data

Source

fn create_per_value( &self, field: &Field, data: &DataBlock, ) -> Result<Box<dyn PerValueCompressor>>

Create a per-value compressor for the given data

Source

fn create_miniblock_compressor( &self, field: &Field, data: &DataBlock, ) -> Result<Box<dyn MiniBlockCompressor>>

Create a mini-block compressor for the given data

Implementors§