Skip to content

FSST replaces common substrings of up to 8 bytes with one-byte codes taken from a small symbol table. It is codec id 3 in BytesCol.

Writers produce it only from columnar block revision 3 on, see columnar revision 3. A revision 1 or 2 block never contains it.

Field Encoding Meaning
codec u8 3
n u8 number of symbols, at most 255
len n x u8 length of each symbol, 1 to 8
symbols n x 8 bytes one little-endian 64-bit word per symbol
encoded Plain the encoded values, laid out as in Bytes PLAIN without its codec byte

Each byte of an encoded value is a code.

Code Meaning
c < n emit len[c] bytes of symbol c, the low bytes of its little-endian word first
255 escape: the next byte is one literal byte, emitted as is
any other Corrupt

Because n is at most 255, code 255 is never a symbol.

  1. Read the codec byte (3), then n, the n lengths and the n 8-byte words.
  2. Read the encoded values as a Plain.
  3. For each encoded value, walk its bytes. Replace a code below n by its symbol and an escape pair by its literal byte. Any other code is Corrupt.

Derived by hand, not from a real file. Two symbols: 0 is ab and 1 is c. The values abcab and z.

03 codec FSST
02 n = 2
02 01 symbol lengths 2, 1
61 62 00 00 00 00 00 00 symbol 0, word holds "ab"
63 00 00 00 00 00 00 00 symbol 1, word holds "c"
02 01 04 01 01 encoded lens: IntCol, count 2, FOR, min 2, width 1, lengths 3 2
01 00 00 offset samples: Flat, count 1, CONST 0
05 total 5
00 01 00 FF 7A codes 0 1 0 = "ab" "c" "ab"; escape FF then literal 7A = "z"

Decoded: abcab, z.

  • n is at most 255 and every symbol length is 1 to 8.
  • A code that is neither below n nor 255 is Corrupt.
  • The encoded Plain passes the checks of Bytes PLAIN.

See How writers choose a codec.