import type { DecodedArray, Encoding, ParquetType } from 'hyparquet'; import type { ColumnEncoder, Writer } from './types.js'; /** * @import {DecodedArray, Encoding, ParquetType} from 'hyparquet' * @import {ColumnEncoder, Writer} from './types.js' */ /** * Estimate the byte size of a value for page size calculation. * * @param {any} value * @param {ParquetType} type * @param {number} [type_length] * @returns {number} */ export declare function estimateValueSize(value: any, type: ParquetType, type_length?: number): number; /** * Decide whether to dictionary-encode a column, and if so build the dictionary * and per-row indexes. Returns {} to fall back to plain encoding. * * Sampling is spread across the complete column chunk and weighted by value * bytes. It only rejects columns whose sampled distinct bytes exceed 90% of * sampled value bytes. Other columns are built and kept when distinct-value * bytes are at most half the total value bytes, so dictionary encoding offers * a material win. There is no fixed size cap by default; a low-cardinality * column of large values is exactly where a big dictionary pays for itself, * and capping it at page size caused 20-100x file bloat (#35). Callers can * still impose a hard cap via `dictionarySize`. * * When `encoding` explicitly requests RLE_DICTIONARY, the dictionary is built * unconditionally (no sampling, no size or win checks), so the written pages * always match the requested encoding. * * @param {DecodedArray} values * @param {ParquetType} type * @param {number | undefined} type_length * @param {Encoding | undefined} encoding * @param {number} [dictionarySize] - optional hard cap on distinct-value bytes * @param {boolean} [required] - reject null or undefined values * @returns {{ dictionary?: any[], indexes?: number[] }} */ export declare function useDictionary(values: DecodedArray, type: ParquetType, type_length: number | undefined, encoding: Encoding | undefined, dictionarySize?: number, required?: boolean): { dictionary?: any[]; indexes?: number[]; }; /** * @param {Writer} writer * @param {ColumnEncoder} column * @param {DecodedArray} dictionary * @returns {number} uncompressed page size including the header */ export declare function writeDictionaryPage(writer: Writer, column: ColumnEncoder, dictionary: DecodedArray): number; //# sourceMappingURL=dictionary.d.ts.map