/** * @file Pull-based parquet reading, the same split `@mailwoman/core/fs` draws between `/readers` and `/streams`. * * A stream returns immediately and the work happens as the consumer pulls, so a caller can walk a file larger than * memory. A caller that wants the rows, or only their count, uses `./readers` instead and awaits a value. */ import type { PathBuilderLike } from "path-ts"; import { type DuckDBLimits } from "#parquet/duckdb"; /** * DuckDB hands a list column back as `{ items: [...] }`. * * Unwrap it so a row reads the way the schema declares it, recursively, * because a nested list arrives nested the same way. */ export declare function normalizeDuckDBValue(value: unknown): unknown; /** * A row limit has to be a non-negative safe integer before it reaches a `limit` clause, * because it is interpolated rather than bound. */ export declare function validateRowLimit(value: number): number; export interface ParquetRowStreamOptions { /** * Columns to project. * * Every column when omitted. * * A column absent from the file raises rather than coming back absent: a projection that * silently drops a field hands the consumer a well-formed row with the field missing. * The consumer reads that as "this row has no value there" instead of "this file has no such column". */ columns?: readonly string[]; /** * Stop after this number of rows. */ limit?: number; /** * A DuckDB boolean expression rows must satisfy, interpolated as the `WHERE` clause. * * The caller builds it, escaping every literal with `escapeSQLString`. */ where?: string; /** * Read DuckDB's `file_row_number`, each row's position in its file, * and yield it as a `file_row_number` field. * * `where` may then select a range of positions. * DuckDB skips the row groups outside such a range, so reading the last million rows * of a 99-million-row file costs what reading the first million does. */ fileRowNumber?: boolean; /** * A DuckDB `ORDER BY` expression, interpolated as written. * * Without one, rows arrive in file order. */ orderBy?: string; /** * The memory and thread limits of the connection the stream opens. * * @defaultValue {@linkcode openDuckDB}'s defaults */ limits?: DuckDBLimits; } /** * The `read_parquet` call over one local parquet file or several, read as one table. */ export declare function readParquetSQL(path: PathBuilderLike | readonly PathBuilderLike[]): string; /** * Open a row stream over one local parquet file or several, yielding rows in DuckDB-managed chunks. * * DuckDB opens the paths itself and exposes its DataChunks through `fetchChunk()`. * Rows are converted and yielded one chunk at a time, so neither the complete Parquet file * nor the complete result set is copied into JavaScript memory. */ export declare function openParquetRowStream(path: PathBuilderLike | readonly PathBuilderLike[], options?: ParquetRowStreamOptions): AsyncGenerator; //# sourceMappingURL=streams.d.ts.map