Skip to content

Columnar block (format 1)

A columnar block stores the same entries as a row block, but column by column instead of entry by entry. It is block format 1 inside a SEAM data file and is addressed by the block index like any other block. Each column is one stream encoded with a column codec, so similar values sit next to each other and compress well.

The first byte of the block is its revision. The five revisions share one base layout and add features on top of it.

Revision What it adds SEAM 1 writers produce it
1 The base layout, see revision 1 No, read-only
2 Cross-column integer deltas: a value column may reference an earlier column, see revision 2 No, read-only
3 The FSST bytes codec (bytes codec id 3), see revision 3 Yes
4 Key references: an integer value column derived from a key field (SPEC V714), see revision 4 Yes
5 Typed keys: a fixed-width key section (SPEC V730), see revision 5 Yes

A writer emits the lowest revision a block needs: 3, 4 or 5. A SEAM 1 file therefore contains a mix of revisions. Revisions 1 and 2 are read-only: SEAM 1 readers accept them so old stores can be opened and migrated, and SEAM 1 writers never produce them.

  • A revision greater than 5 is NewerFormat("columnar block").
  • A revision of 0 is Corrupt.

The error classes are described in Errors.

Readers expand revision 4 key references and revision 5 typed keys into the revision 3 layout in memory before use. A corrupt reference is Corrupt. A revision 5 block may also carry key references (expand_typed_refs, mod.rs:2383).

After the expansion every reader works on the same shape: the base layout with value modes and column slots. The block must be consumed exactly, see Columnar limits.