Skip to content

FOR stores n integers as a Packed array: a minimum and the offset of each value from it. It is codec id 1 in Flat and in IntCol, with the same layout in both.

Field Encoding Meaning
count varint n, the number of values
codec u8 1
body Packed(n) zvarint min, width u8, then the bit stream
  1. Read count and check it against its limit.
  2. Read the codec byte. It is 1.
  3. Decode Packed(n): min, width (at most 64), then n offsets of width bits each.
  4. Value i is min + offset[i].

Derived by hand, not from a real file. The values 10, 13, 15, 17 have min = 10 and offsets 0, 3, 5, 7, so width 3 (the worked bit packing is on Packed integers).

04 01 14 03 58 0F count 4, codec FOR, min 10, width 3, offsets 0 3 5 7
  • Everything that Packed checks: width at most 64 and enough input bytes.
  • count is within its limit.

See How writers choose a codec.