/** * Dictionary encoding — store each distinct value once, then reference it. * * A column of city names repeats "Moscow" ten thousand times; PLAIN writes the * bytes ten thousand times, a dictionary writes them once and spends two BITS * per row pointing at them. This is the largest size win available to us short * of compression, and it costs no dependency. * * Whether to use it has to be decided from the DATA, and the decision must be * reproducible: a heuristic that consulted anything else — a clock, a memory * figure, a sampling rate — would put different bytes in the file on different * runs and break the cross-language contract the whole writer is built around. * So the rule below reads only the values. * Spec: docs/specs/2026-07-19-parquet-statistics-and-encodings.md §3 */ import type { ColumnType } from '../column-type.js'; import type { TypedValue } from './convert.js'; export interface Dictionary { /** The distinct values, in first-seen order — the dictionary page's contents. */ readonly values: TypedValue[]; /** One index per present value, pointing into `values`. */ readonly indices: number[]; } /** * Build a dictionary for these values, or undefined when it would not pay. * * Returning undefined is the signal to keep PLAIN encoding — the caller must * not treat it as an error. */ export declare function buildDictionary(type: ColumnType, present: readonly TypedValue[]): Dictionary | undefined; //# sourceMappingURL=dictionary.d.ts.map