Expand description
Lightweight columnar encodings.
Every encoding has a format-stable id (docs/04-storage-zu1-format.md §3)
and must decode at 1 GB/s/core or better with at most 64 KiB of scratch.
Encoder and decoder implementations land in M0; this crate starts with the
stable id table so downstream crates can reference it.
Modules§
- alp
- ALP for doubles (encoding id 6), the Afroozeh and Boncz adaptive
lossless floating-point scheme: a double that is really a decimal,
like a price or a coordinate, becomes
round(d * 10^e / 10^f), an integer that frame-of-reference packs to a fraction of eight bytes. Values the transform cannot reproduce bit-exactly ride as patched exceptions, so NaN, infinities, negative zero and genuine full-mantissa doubles all survive. - alp_rd
- ALP_RD for doubles (encoding id 7), the fallback for “real doubles” whose mantissas actually use their bits, where the decimal transform of plain ALP fails on everything. The observation from the paper is that such columns still share their front: sign, exponent and the top mantissa bits cluster on a handful of patterns. Each 64-bit pattern splits at a trained cut into a left part that dictionary encodes (at most 8 entries, 3-bit codes) and a right part stored packed as-is, so a coordinate column in radians drops its shared bits while staying bit-exact. Left parts beyond the dictionary ride as patched exceptions.
- bitpack
- Fixed-width bit packing over 1024-value chunks.
- bool_
bitpack - Boolean bitpacking (encoding id 9).
- delta
- Delta plus bit packing (encoding id 5).
- delta_
patch - Delta plus patched bit packing (encoding id 12).
- dict
- Dictionary encoding (encoding id 3).
- for_
bitpack - Frame-of-reference plus bit packing (encoding id 4).
- frequency
- Frequency encoding (encoding id 10), the BtrBlocks shape for columns where one value dominates but the rest are wide and scattered, so neither RLE (short runs) nor Dict (high exception cardinality) wins.
- fsst
- FSST string compression (encoding id 8), the Boncz, Neumann and Leis static symbol table: up to 255 symbols of 1 to 8 bytes replace common substrings with one-byte codes, and code 255 escapes a literal byte. Decompression is a table lookup per code with no entropy coding, which is what lets it hit the 1 GB/s decode floor while still halving typical text; random access into a compressed segment only needs the 2 KiB table, not the whole block, which is why FullZip string segments will ride it.
- patch
- Patched bit packing, the exception container behind encoding id 12.
- rle
- Run-length encoding (encoding id 2).
- segment
- Segment-level encoding selection, the BtrBlocks-style cascade.
- validity
- Validity bitmaps, one bit per row, stored separately from values.
- zstd_
leaf - Zstd leaf (encoding id 11), the optional general-purpose stage for cold string segments where ratio matters more than decode speed. Everything else in the cascade is a lightweight encoding; this is the one deliberate exception, and it is a leaf: nothing cascades below it.
Enums§
- Encoding
Id - Format-stable encoding identifiers. Never renumber.
Functions§
- bits_
needed - Bits required to represent
maxwith frame-of-reference packing.