Skip to main content

Module dict

Module dict 

Source
Expand description

Dictionary encoding (encoding id 3).

Distinct values are sorted into a dictionary and rows become codes, both stored in the frame-of-reference container. Sorted dictionaries keep range predicates cheap and delta-compress well. Layout: dict_len: u32 LE, dictionary container, codes container.

Constants§

MAX_ENTRIES
Format rule: a dictionary holds at most this many entries, which is exactly the 64 KiB scratch ceiling from the docs/04 decoding contract once materialized as u64. The selector never offers Dict past this cardinality, and the decoder rejects a container claiming more, so readers can size the dictionary buffer before parsing.

Functions§

decode
Decodes an encoded buffer, appending at most max_values values to out. The caller ceiling bounds the code stream and the format cap bounds the dictionary, so the one materialized intermediate never grows past 64 KiB whatever the container claims.
encode
Encodes values into out, returning the encoded byte length.