import type { SchemaElement } from 'hyparquet'; import type { PageIndexes, Writer } from '../src/types.js'; /** * Insert a hash into a Split Block Bloom Filter. * * @param {Uint32Array} blocks bloom filter words (8 * numBlocks long) * @param {bigint} hash 64-bit xxhash of the parquet-plain-encoded value */ export declare function sbbfInsert(blocks: Uint32Array, hash: bigint): void; /** * Test whether a hash might be present in a Split Block Bloom Filter. * False positives are possible; false negatives are not. * * @param {Uint32Array} blocks bloom filter words (8 * numBlocks long) * @param {bigint} hash 64-bit xxhash of the parquet-plain-encoded value * @returns {boolean} */ export declare function sbbfContains(blocks: Uint32Array, hash: bigint): boolean; /** * Optimal SBBF size in bytes for a given number of distinct values and * target false-positive probability. Matches parquet-java's BlockSplitBloomFilter: * derives bits from m = -8 * ndv / ln(1 - p^(1/8)) and rounds up to a power of two * between one block and MAX_BYTES. Arrow C++ rejects a bitset that is not a power of two. * * @param {number} ndv expected number of distinct values * @param {number} fpp target false positive probability, in (0, 1) * @returns {number} bloom filter size in bytes (power of two, at least 32) */ export declare function optimalNumBytes(ndv: number, fpp: number): number; /** * Allocate a zeroed Split Block Bloom Filter sized for the given NDV and FPP. * * @param {number} ndv expected number of distinct values * @param {number} [fpp] target false positive probability, default 0.01 * @returns {Uint32Array} blocks (numBytes / 4 uint32 words) */ export declare function createBloomFilter(ndv: number, fpp?: number): Uint32Array; /** * Collects distinct hashes of column values and finalizes them into an SBBF * sized for the actual distinct count. `finalize` returns `undefined` if any * non-null value was unhashable (the filter would have false negatives), if * no values were seen, or if `maxBytes` is below one block. Above `maxBytes` * the filter is capped at the largest power of two that fits, like parquet-java. */ export declare class BloomBuilder { /** @type {SchemaElement} */ element: SchemaElement; fpp: number; maxBytes: number; /** @type {Set} */ hashes: Set; skipped: number; /** * @param {SchemaElement} element * @param {{ fpp?: number, maxBytes?: number }} [options] */ constructor(element: SchemaElement, { fpp, maxBytes }?: { fpp?: number; maxBytes?: number; }); /** @param {any} value */ insert(value: any): void; /** @returns {Uint32Array | undefined} */ finalize(): Uint32Array | undefined; } /** * Write a parquet bloom filter: BloomFilterHeader thrift struct followed by * the raw little-endian bytes of the SBBF blocks. Always uses BLOCK / XXHASH / * UNCOMPRESSED, the only variants parquet currently defines. * * @param {Writer} writer * @param {Uint32Array} blocks bloom filter words (8 * numBlocks long) */ export declare function writeBloomFilter(writer: Writer, blocks: Uint32Array): void; /** * Write all pending bloom filters in a contiguous block and patch each chunk's * meta_data.bloom_filter_offset / bloom_filter_length so readers can find them. * Clustering matches parquet-mr's tail placement: a reader fetching the footer * region can pull every bloom in one range request. * * @param {Writer} writer * @param {PageIndexes[]} pageIndexes */ export declare function writeBlooms(writer: Writer, pageIndexes: PageIndexes[]): void; //# sourceMappingURL=bloom.d.ts.map