You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Frequency-sort dictionary values in FloatDictScheme before assigning codes #11887
FloatDictScheme assigns dictionary codes in hash-set order, so common values can land on wide codes. Sort the distinct values by descending count, with ties broken on their total-order bits, before assigning codes. This makes Taxi.congestion_surcharge 38.6% smaller and does not change the wire format. Part of #11890.
The codes come from vortex-compressor/src/builtins/dict/float.rs, typed_encode!, line 162:
let values:Buffer<$typ> = distinct.distinct_values().iter().map(|x| x.0).collect();
The codes are then bit-packed with patches. Taxi.congestion_surcharge (f64, 19.1M rows) is almost entirely two values. In f64 hash order, both landed past code 1, so the codes needed 2 bits and the column took 4.79 MB. Narrowed to f32, the same values happened to get codes 0 and 1 and packed into 1 bit with patches. That took 2.94 MB.
DictArray accepts values in any order, and set_all_values_referenced(true) still holds, so readers do not change. The output also stops depending on the hash layout. #12044 extends the same frequency-sorted code assignment to integer, string, binary, and decimal dictionaries.
Activity
Order float dictionary codes by descending value frequency (vortex-da…