Column codecs
SEAM uses two layers of encoding for data. The outer layer is the frame codec: every frame in a SEAM data file is stored raw, zstd-compressed or LZ4-compressed, see zstd and LZ4 framing. The inner layer is the column codecs, which a columnar block uses for each of its streams (tags, integers, floats, booleans, bytes and typed-key fields).
Every column codec is self-describing and byte-aligned: a stream starts with a codec id byte, and the codec’s body says everything else a reader needs. A reader never has to know in advance which codec a writer picked.
The four containers
Section titled “The four containers”A stream is wrapped in one of four containers. The container fixes which codec ids exist, see Column container types.
| Container | Codecs |
|---|---|
| Flat | CONST (0), FOR (1), PATCHED (5) |
| IntCol | the Flat codecs, plus DELTA (2), RLE (3), Integer DICT (4) |
| FloatCol | Float RAW (0), ALP (1), XOR (2) |
| BytesCol | Bytes PLAIN (0), Bytes DICT (1), FRONT (2), FSST (3) |
Packed integers is not a codec id. It is the bit-packed integer array that FOR, PATCHED and the other codecs build on.
Rules that apply to all codecs
Section titled “Rules that apply to all codecs”- Integers are little-endian unless stated, and
varintandzvarintare the conventions of the format, see zvarint. - Every count is read with a limit and a count above it is
Corrupt, see Count limit. - All length arithmetic is checked. Overflow is
Corrupt, never a panic. - A reader rejects unknown codec ids, out-of-range widths, reference indices at or above the column count, and expansion mismatches (SPEC section 5.11, invariant 7).
- A decoder must consume its input exactly. See the columnar limits.
Which codec a writer picks
Section titled “Which codec a writer picks”The format does not say. Any codec of the right container is legal in any stream. The heuristics current writers use are on How writers choose a codec and are not part of the format.
Related
Section titled “Related”- Column container types and Packed integers
- Columnar block and column slot
- Scaled key fields for the one scaling in the format
- How writers choose a codec