Integer DICT
Integer DICT stores each distinct value once and then refers to it by index. It is codec id 4 in IntCol only. The byte version is Bytes DICT.
Layout
Section titled “Layout”| Field | Encoding | Meaning |
|---|---|---|
| count | varint | n, the number of values |
| codec | u8 | 4 |
| dictionary | Flat | the distinct values, sorted |
| indexes | Flat | n indexes into the dictionary |
Each Flat here has its own count, codec byte and body, see Column container types.
How to decode
Section titled “How to decode”- Read
count, the codec byte (4), the dictionary Flat and the indexes Flat. - Value
iisdictionary[indexes[i]].
Illustration
Section titled “Illustration”Derived by hand, not from a real file. The values 20, 20, 5, 20, 5 have the sorted distinct values 5, 20 and the indexes 1, 1, 0, 1, 0.
05 04 count 5, codec DICT02 01 0A 04 F0 dictionary: Flat FOR, min 5, width 4, offsets 0 1505 01 00 01 0B indexes: Flat FOR, min 0, width 1, bits 1 1 0 1 0Decoded: 20, 20, 5, 20, 5.
Checks
Section titled “Checks”- The indexes Flat has
nvalues. - Every index is below the dictionary length.
When writers pick it
Section titled “When writers pick it”See How writers choose a codec.