lakeql 0.1.0 → 0.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +96 -17
- package/dist/bin.js +8946 -0
- package/dist/chunk-BFLGC6Y5.js +1694 -0
- package/dist/chunk-RZL45ZSN.js +11034 -0
- package/dist/chunk-TFD5RFKB.js +1152 -0
- package/dist/cloudflare.d.ts +2 -3
- package/dist/cloudflare.js +5 -3
- package/dist/geo-backend-TSQJWAAB.js +18 -0
- package/dist/index.d.ts +793 -226
- package/dist/index.js +3 -1
- package/dist/node.d.ts +2 -3
- package/dist/node.js +22 -17
- package/package.json +22 -18
- package/dist/chunk-VRJ72DGA.js +0 -6824
package/dist/index.d.ts
CHANGED
|
@@ -1,18 +1,23 @@
|
|
|
1
|
-
import * as hyparquet_src_types_js from 'hyparquet/src/types.js';
|
|
2
|
-
import { parquetMetadataAsync, RowGroup } from 'hyparquet';
|
|
3
1
|
import { ParquetWriteOptions, ColumnSource, BasicType } from 'hyparquet-writer';
|
|
2
|
+
import { parquetMetadataAsync, RowGroup } from 'hyparquet';
|
|
4
3
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
readonly
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
4
|
+
type TimestampUnit = "millis" | "micros" | "nanos";
|
|
5
|
+
declare class TimestampValue {
|
|
6
|
+
readonly epochNanoseconds: bigint;
|
|
7
|
+
readonly unit: TimestampUnit;
|
|
8
|
+
readonly isAdjustedToUTC: boolean;
|
|
9
|
+
constructor(epochNanoseconds: bigint, unit: TimestampUnit, isAdjustedToUTC?: boolean);
|
|
10
|
+
toJSON(): string;
|
|
11
|
+
toString(): string;
|
|
12
|
+
}
|
|
13
|
+
declare function timestampFromEpoch(value: bigint, unit: TimestampUnit, isAdjustedToUTC?: boolean): TimestampValue;
|
|
14
|
+
declare function timestampValueFromIso(value: string): TimestampValue | undefined;
|
|
15
|
+
declare function isTimestampValue(value: unknown): value is TimestampValue;
|
|
16
|
+
declare function timestampToIsoString(value: TimestampValue): string;
|
|
17
|
+
declare function timestampEpochForUnit(value: TimestampValue, unit: TimestampUnit): bigint;
|
|
18
|
+
declare function compareTimestampValues(left: TimestampValue, right: TimestampValue): number;
|
|
14
19
|
|
|
15
|
-
type Scalar = string | number | boolean | bigint | null;
|
|
20
|
+
type Scalar = string | number | boolean | bigint | TimestampValue | null;
|
|
16
21
|
type CompareOp = "eq" | "ne" | "lt" | "lte" | "gt" | "gte";
|
|
17
22
|
interface LiteralExpr {
|
|
18
23
|
kind: "literal";
|
|
@@ -65,7 +70,22 @@ interface CallExpr {
|
|
|
65
70
|
fn: string;
|
|
66
71
|
args: Expr[];
|
|
67
72
|
}
|
|
68
|
-
|
|
73
|
+
interface ArithmeticExpr {
|
|
74
|
+
kind: "arithmetic";
|
|
75
|
+
op: "add" | "sub" | "mul" | "div" | "mod";
|
|
76
|
+
left: Expr;
|
|
77
|
+
right: Expr;
|
|
78
|
+
}
|
|
79
|
+
interface CaseWhenExpr {
|
|
80
|
+
when: Expr;
|
|
81
|
+
value: Expr;
|
|
82
|
+
}
|
|
83
|
+
interface CaseExpr {
|
|
84
|
+
kind: "case";
|
|
85
|
+
whens: CaseWhenExpr[];
|
|
86
|
+
else?: Expr;
|
|
87
|
+
}
|
|
88
|
+
type Expr = LiteralExpr | ColumnExpr | CompareExpr | InExpr | BetweenExpr | NullCheckExpr | LogicalExpr | NotExpr | LikeExpr | CallExpr | ArithmeticExpr | CaseExpr;
|
|
69
89
|
/** A value accepted where a column is expected: a column name or any expression. */
|
|
70
90
|
type ColumnInput = string | Expr;
|
|
71
91
|
/** A value accepted where a literal is expected: a scalar or any expression. */
|
|
@@ -90,12 +110,19 @@ declare function like(column: ColumnInput, pattern: string): LikeExpr;
|
|
|
90
110
|
declare function ilike(column: ColumnInput, pattern: string): LikeExpr;
|
|
91
111
|
/** Generic function-call expression; named functions (h3_*, st_*) build on this. */
|
|
92
112
|
declare function fn(name: string, ...args: ValueInput[]): CallExpr;
|
|
113
|
+
declare function add(left: ValueInput, right: ValueInput): ArithmeticExpr;
|
|
114
|
+
declare function sub(left: ValueInput, right: ValueInput): ArithmeticExpr;
|
|
115
|
+
declare function mul(left: ValueInput, right: ValueInput): ArithmeticExpr;
|
|
116
|
+
declare function div(left: ValueInput, right: ValueInput): ArithmeticExpr;
|
|
117
|
+
declare function mod(left: ValueInput, right: ValueInput): ArithmeticExpr;
|
|
93
118
|
|
|
94
119
|
type Row = Record<string, unknown>;
|
|
95
120
|
interface BookmarkQuery {
|
|
96
121
|
source: string;
|
|
97
122
|
select?: string[];
|
|
123
|
+
projections?: Record<string, Expr>;
|
|
98
124
|
where?: Expr;
|
|
125
|
+
distinct?: boolean;
|
|
99
126
|
orderBy?: {
|
|
100
127
|
column: string;
|
|
101
128
|
direction?: "asc" | "desc";
|
|
@@ -175,31 +202,302 @@ interface QueryStats {
|
|
|
175
202
|
cacheMisses: number;
|
|
176
203
|
}
|
|
177
204
|
|
|
205
|
+
type Vector = {
|
|
206
|
+
type: "null";
|
|
207
|
+
length: number;
|
|
208
|
+
} | {
|
|
209
|
+
type: "f64";
|
|
210
|
+
values: Float64Array;
|
|
211
|
+
valid?: Uint8Array;
|
|
212
|
+
} | {
|
|
213
|
+
type: "i64";
|
|
214
|
+
values: BigInt64Array;
|
|
215
|
+
valid?: Uint8Array;
|
|
216
|
+
} | {
|
|
217
|
+
type: "timestamp";
|
|
218
|
+
values: BigInt64Array;
|
|
219
|
+
unit: TimestampUnit;
|
|
220
|
+
isAdjustedToUTC: boolean;
|
|
221
|
+
valid?: Uint8Array;
|
|
222
|
+
} | {
|
|
223
|
+
type: "bool";
|
|
224
|
+
values: Uint8Array;
|
|
225
|
+
valid?: Uint8Array;
|
|
226
|
+
} | {
|
|
227
|
+
type: "utf8";
|
|
228
|
+
values: string[];
|
|
229
|
+
valid?: Uint8Array;
|
|
230
|
+
} | {
|
|
231
|
+
type: "dict";
|
|
232
|
+
indices: Uint32Array;
|
|
233
|
+
dictionary: Vector;
|
|
234
|
+
valid?: Uint8Array;
|
|
235
|
+
} | {
|
|
236
|
+
type: "list";
|
|
237
|
+
offsets: Int32Array;
|
|
238
|
+
child: Vector;
|
|
239
|
+
valid?: Uint8Array;
|
|
240
|
+
} | {
|
|
241
|
+
type: "struct";
|
|
242
|
+
fields: Record<string, Vector>;
|
|
243
|
+
length: number;
|
|
244
|
+
valid?: Uint8Array;
|
|
245
|
+
} | {
|
|
246
|
+
type: "map";
|
|
247
|
+
offsets: Int32Array;
|
|
248
|
+
keys: Vector;
|
|
249
|
+
values: Vector;
|
|
250
|
+
valid?: Uint8Array;
|
|
251
|
+
};
|
|
252
|
+
interface Batch {
|
|
253
|
+
rowCount: number;
|
|
254
|
+
columns: Record<string, Vector>;
|
|
255
|
+
}
|
|
256
|
+
type Selection = Uint8Array;
|
|
257
|
+
type VectorValue = unknown;
|
|
258
|
+
declare function batchFromColumns(columns: Record<string, ArrayLike<VectorValue>>): Batch;
|
|
259
|
+
declare function batchFromVectors(columns: Record<string, Vector>): Batch;
|
|
260
|
+
declare function vectorFromValues(values: ArrayLike<VectorValue>): Vector;
|
|
261
|
+
declare function materializeBatchRows(batch: Batch): Row[];
|
|
262
|
+
declare function materializeSelectedBatchRows(batch: Batch, selection?: Selection): Row[];
|
|
263
|
+
declare function selectedRowCount(rowCount: number, selection?: Selection): number;
|
|
264
|
+
declare function selectedRowIndices(rowCount: number, selection?: Selection): Iterable<number>;
|
|
265
|
+
declare function predicateSelection(batch: Batch, expr: Expr | undefined): Selection;
|
|
266
|
+
declare function tryPredicateSelection(batch: Batch, expr: Expr | undefined): Selection | undefined;
|
|
267
|
+
declare function vectorValue(vector: Vector, index: number): string | number | bigint | boolean | TimestampValue | unknown[] | Record<string, unknown> | null;
|
|
268
|
+
declare function vectorLength(vector: Vector): number;
|
|
269
|
+
interface BatchExprValues {
|
|
270
|
+
rowCount: number;
|
|
271
|
+
vector?: Vector;
|
|
272
|
+
literal?: Scalar;
|
|
273
|
+
valueAt(index: number): Scalar;
|
|
274
|
+
}
|
|
275
|
+
declare function batchExprValues(batch: Batch, expr: Expr): BatchExprValues;
|
|
276
|
+
declare function scalarVectorValue(vector: Vector, index: number): Scalar;
|
|
277
|
+
|
|
278
|
+
declare const ERROR_CODES: readonly ["LAKEQL_PARSE_ERROR", "LAKEQL_SQL_UNSUPPORTED", "LAKEQL_TYPE_ERROR", "LAKEQL_UNKNOWN_TABLE", "LAKEQL_UNKNOWN_COLUMN", "LAKEQL_UNSUPPORTED_PUSHDOWN", "LAKEQL_BUDGET_EXCEEDED", "LAKEQL_GROUP_LIMIT_EXCEEDED", "LAKEQL_OBJECT_NOT_FOUND", "LAKEQL_CATALOG_ERROR", "LAKEQL_UNSUPPORTED_ICEBERG_FEATURE", "LAKEQL_UNSUPPORTED_PARQUET_FEATURE", "LAKEQL_ICEBERG_COMMIT_CONFLICT", "LAKEQL_UNSUPPORTED_DELETE_FILES", "LAKEQL_PARQUET_READ_ERROR", "LAKEQL_PARQUET_WRITE_ERROR", "LAKEQL_VALIDATION_ERROR", "LAKEQL_BOOKMARK_STALE", "LAKEQL_BOOKMARK_INVALID", "LAKEQL_ABORTED", "LAKEQL_GEO_BACKEND_MISSING"];
|
|
279
|
+
type LakeqlErrorCode = (typeof ERROR_CODES)[number];
|
|
280
|
+
type ErrorDetails = Record<string, unknown>;
|
|
281
|
+
declare class LakeqlError extends Error {
|
|
282
|
+
readonly code: LakeqlErrorCode;
|
|
283
|
+
readonly details: ErrorDetails;
|
|
284
|
+
constructor(code: LakeqlErrorCode, message: string, details?: ErrorDetails);
|
|
285
|
+
}
|
|
286
|
+
declare function isLakeqlError(value: unknown): value is LakeqlError;
|
|
287
|
+
|
|
178
288
|
type SqlBoolean = boolean | null;
|
|
289
|
+
/** External geometry/H3 primitives the evaluator can't compute from bbox math alone. */
|
|
290
|
+
interface GeoBackend {
|
|
291
|
+
booleanContains(a: GeoJsonGeometry, b: GeoJsonGeometry): boolean;
|
|
292
|
+
booleanIntersects(a: GeoJsonGeometry, b: GeoJsonGeometry): boolean;
|
|
293
|
+
cellToParent(cell: string, res: number): string;
|
|
294
|
+
gridDisk(origin: string, k: number): string[];
|
|
295
|
+
isValidCell(cell: string): boolean;
|
|
296
|
+
latLngToCell(lat: number, lon: number, res: number): string;
|
|
297
|
+
}
|
|
298
|
+
/** Install the backend. Called by `./geo-backend.ts` once its libraries load. */
|
|
299
|
+
declare function setGeoBackend(backend: GeoBackend): void;
|
|
300
|
+
declare function requireGeoBackend(): GeoBackend;
|
|
301
|
+
/** Force-load the geo backend (idempotent). Exposed for direct evaluate() callers. */
|
|
302
|
+
declare function loadGeoBackend(): Promise<void>;
|
|
303
|
+
/**
|
|
304
|
+
* Load the geo backend iff any of `exprs` uses a backend-requiring spatial
|
|
305
|
+
* function. Cheap no-op once the backend is installed or when no geo is present,
|
|
306
|
+
* so query execution can call it unconditionally.
|
|
307
|
+
*/
|
|
308
|
+
declare function ensureGeoBackendForExprs(exprs: Iterable<Expr | undefined>): Promise<void>;
|
|
179
309
|
type EvalValue = Scalar;
|
|
310
|
+
interface BBox {
|
|
311
|
+
minx: number;
|
|
312
|
+
miny: number;
|
|
313
|
+
maxx: number;
|
|
314
|
+
maxy: number;
|
|
315
|
+
}
|
|
180
316
|
declare function evaluate(expr: Expr, row: Row): EvalValue;
|
|
181
317
|
declare function matches(expr: Expr | undefined, row: Row): boolean;
|
|
182
318
|
declare function jsonSafeValue(value: unknown): unknown;
|
|
183
319
|
declare function encodeJsonLine(row: Row): Uint8Array;
|
|
320
|
+
declare function envelopeOf(geometry: GeoJsonGeometry): BBox;
|
|
321
|
+
type GeoJsonGeometry = {
|
|
322
|
+
type: "Point";
|
|
323
|
+
coordinates: [number, number];
|
|
324
|
+
} | {
|
|
325
|
+
type: "LineString";
|
|
326
|
+
coordinates: [number, number][];
|
|
327
|
+
} | {
|
|
328
|
+
type: "Polygon";
|
|
329
|
+
coordinates: [number, number][][];
|
|
330
|
+
};
|
|
331
|
+
declare function toGeometry(parsed: Record<string, unknown>, name: string): GeoJsonGeometry;
|
|
332
|
+
declare function parseGeometry(value: EvalValue, name: string): Record<string, unknown>;
|
|
333
|
+
declare function envelopeFromGeometry(parsed: Record<string, unknown>, name: string): BBox;
|
|
334
|
+
declare function bboxIntersects(left: BBox, right: BBox): boolean;
|
|
184
335
|
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
rightKey: string;
|
|
189
|
-
maxRightRows: number;
|
|
190
|
-
type?: JoinType;
|
|
191
|
-
rightPrefix?: string;
|
|
336
|
+
interface PutOptions {
|
|
337
|
+
contentType?: string;
|
|
338
|
+
metadata?: Record<string, string>;
|
|
192
339
|
}
|
|
193
|
-
interface
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
340
|
+
interface ConditionalPutOptions extends PutOptions {
|
|
341
|
+
/**
|
|
342
|
+
* ETag that must still identify the existing object. Use null to require
|
|
343
|
+
* the object to be absent.
|
|
344
|
+
*/
|
|
345
|
+
expectedEtag: string | null;
|
|
199
346
|
}
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
347
|
+
interface ListOptions {
|
|
348
|
+
/** Stop listing after this many objects. */
|
|
349
|
+
limit?: number;
|
|
350
|
+
/** List "directories" by stopping at this delimiter. */
|
|
351
|
+
delimiter?: string;
|
|
352
|
+
}
|
|
353
|
+
interface ObjectInfo {
|
|
354
|
+
path: string;
|
|
355
|
+
size: number;
|
|
356
|
+
etag?: string;
|
|
357
|
+
lastModified?: Date;
|
|
358
|
+
}
|
|
359
|
+
interface ObjectHead {
|
|
360
|
+
size: number;
|
|
361
|
+
etag?: string;
|
|
362
|
+
lastModified?: Date;
|
|
363
|
+
contentType?: string;
|
|
364
|
+
}
|
|
365
|
+
/**
|
|
366
|
+
* The single environmental contract for storage. Every runtime driver
|
|
367
|
+
* (R2, S3, HTTP, filesystem) supplies one of these; core never touches
|
|
368
|
+
* a runtime API directly.
|
|
369
|
+
*/
|
|
370
|
+
interface ObjectStore {
|
|
371
|
+
get(path: string): Promise<Uint8Array | null>;
|
|
372
|
+
getRange(path: string, range: {
|
|
373
|
+
offset: number;
|
|
374
|
+
length: number;
|
|
375
|
+
}): Promise<Uint8Array>;
|
|
376
|
+
put(path: string, body: Uint8Array | ReadableStream<Uint8Array>, options?: PutOptions): Promise<void>;
|
|
377
|
+
delete(path: string): Promise<void>;
|
|
378
|
+
list(prefix: string, options?: ListOptions): AsyncIterable<ObjectInfo>;
|
|
379
|
+
head(path: string): Promise<ObjectHead | null>;
|
|
380
|
+
}
|
|
381
|
+
interface ConditionalObjectStore extends ObjectStore {
|
|
382
|
+
conditionalPut(path: string, body: Uint8Array | ReadableStream<Uint8Array>, options: ConditionalPutOptions): Promise<boolean>;
|
|
383
|
+
}
|
|
384
|
+
interface ObjectStoreReadControls {
|
|
385
|
+
maxConcurrentReads?: number;
|
|
386
|
+
signal?: AbortSignal;
|
|
387
|
+
maxElapsedMs?: number;
|
|
388
|
+
}
|
|
389
|
+
declare function withObjectStoreReadControls(store: ObjectStore, controls: ObjectStoreReadControls): ObjectStore;
|
|
390
|
+
declare function readControlSignal(controls: ObjectStoreReadControls): AbortSignal | undefined;
|
|
391
|
+
declare function throwIfAborted(signal: AbortSignal | undefined): void;
|
|
392
|
+
|
|
393
|
+
interface TaskManifestTask {
|
|
394
|
+
id: string;
|
|
395
|
+
input: TaskInput;
|
|
396
|
+
outputRole: "rows" | "data-file" | "manifest";
|
|
397
|
+
}
|
|
398
|
+
interface TaskManifest {
|
|
399
|
+
version: 1;
|
|
400
|
+
jobId: string;
|
|
401
|
+
planFingerprint: string;
|
|
402
|
+
snapshot: string;
|
|
403
|
+
tasks: TaskManifestTask[];
|
|
404
|
+
}
|
|
405
|
+
interface OutputManifestEntry {
|
|
406
|
+
taskId: string;
|
|
407
|
+
outputPath: string;
|
|
408
|
+
partitionValues: Record<string, string>;
|
|
409
|
+
rowCount: number;
|
|
410
|
+
byteSize: number;
|
|
411
|
+
contentHash?: string;
|
|
412
|
+
etag?: string;
|
|
413
|
+
iceberg?: {
|
|
414
|
+
recordCount: number;
|
|
415
|
+
fileSizeInBytes: number;
|
|
416
|
+
partitionValues: Record<string, string>;
|
|
417
|
+
};
|
|
418
|
+
}
|
|
419
|
+
interface OutputManifest {
|
|
420
|
+
version: 1;
|
|
421
|
+
jobId: string;
|
|
422
|
+
planFingerprint: string;
|
|
423
|
+
entries: OutputManifestEntry[];
|
|
424
|
+
}
|
|
425
|
+
type TaskState = "planned" | "running" | "output-written" | "manifest-recorded" | "complete";
|
|
426
|
+
interface TaskCheckpoint {
|
|
427
|
+
taskId: string;
|
|
428
|
+
state: TaskState;
|
|
429
|
+
idempotencyKey: string;
|
|
430
|
+
updatedAtMs: number;
|
|
431
|
+
output?: OutputManifestEntry;
|
|
432
|
+
outputs?: OutputManifestEntry[];
|
|
433
|
+
}
|
|
434
|
+
interface CheckpointAdapter {
|
|
435
|
+
get(taskId: string): Promise<TaskCheckpoint | undefined>;
|
|
436
|
+
put(checkpoint: TaskCheckpoint): Promise<void>;
|
|
437
|
+
list(jobId?: string): AsyncIterable<TaskCheckpoint>;
|
|
438
|
+
}
|
|
439
|
+
interface TaskTransitionInput {
|
|
440
|
+
taskId: string;
|
|
441
|
+
nextState: TaskState;
|
|
442
|
+
idempotencyKey: string;
|
|
443
|
+
nowMs: number;
|
|
444
|
+
staleTimeoutMs?: number;
|
|
445
|
+
output?: OutputManifestEntry;
|
|
446
|
+
outputs?: OutputManifestEntry[];
|
|
447
|
+
}
|
|
448
|
+
interface BookmarkPosition {
|
|
449
|
+
fileIndex: number;
|
|
450
|
+
rowGroup: number;
|
|
451
|
+
rowOffset: number;
|
|
452
|
+
taskId?: string;
|
|
453
|
+
outputManifestCursor?: number;
|
|
454
|
+
}
|
|
455
|
+
interface BookmarkInit {
|
|
456
|
+
planFingerprint: string;
|
|
457
|
+
snapshot: string;
|
|
458
|
+
query?: BookmarkQuery;
|
|
459
|
+
position: BookmarkPosition;
|
|
460
|
+
writeState?: Bookmark["writeState"];
|
|
461
|
+
operatorState?: Bookmark["operatorState"];
|
|
462
|
+
}
|
|
463
|
+
declare function createTaskManifest(input: {
|
|
464
|
+
jobId: string;
|
|
465
|
+
snapshot?: string;
|
|
466
|
+
tasks: TaskInput[];
|
|
467
|
+
outputRole?: TaskManifestTask["outputRole"];
|
|
468
|
+
}): TaskManifest;
|
|
469
|
+
declare function createOutputManifest(input: {
|
|
470
|
+
jobId: string;
|
|
471
|
+
planFingerprint: string;
|
|
472
|
+
entries: OutputManifestEntry[];
|
|
473
|
+
}): OutputManifest;
|
|
474
|
+
declare function createOutputManifestFromCheckpoints(input: {
|
|
475
|
+
jobId: string;
|
|
476
|
+
planFingerprint: string;
|
|
477
|
+
checkpoints: CheckpointAdapter;
|
|
478
|
+
}): Promise<OutputManifest>;
|
|
479
|
+
declare function writeOutputManifest(store: ObjectStore, path: string, manifest: OutputManifest): Promise<{
|
|
480
|
+
path: string;
|
|
481
|
+
byteSize: number;
|
|
482
|
+
etag?: string;
|
|
483
|
+
}>;
|
|
484
|
+
declare function readOutputManifest(store: ObjectStore, path: string): Promise<OutputManifest>;
|
|
485
|
+
declare function createBookmark(init: BookmarkInit): Bookmark;
|
|
486
|
+
declare function assertBookmarkMatches(bookmark: Bookmark, planFingerprint: string): void;
|
|
487
|
+
declare function signPaginationToken(bookmark: Bookmark, secret: string | Uint8Array): Promise<string>;
|
|
488
|
+
declare function verifyPaginationToken(token: string, secret: string | Uint8Array): Promise<Bookmark>;
|
|
489
|
+
declare class MemoryCheckpointAdapter implements CheckpointAdapter {
|
|
490
|
+
private readonly checkpoints;
|
|
491
|
+
private readonly taskJobs;
|
|
492
|
+
get(taskId: string): Promise<TaskCheckpoint | undefined>;
|
|
493
|
+
put(checkpoint: TaskCheckpoint): Promise<void>;
|
|
494
|
+
list(jobId?: string): AsyncIterable<TaskCheckpoint>;
|
|
495
|
+
}
|
|
496
|
+
declare function memoryCheckpointAdapter(): MemoryCheckpointAdapter;
|
|
497
|
+
declare function advanceTaskCheckpoint(checkpoints: CheckpointAdapter, input: TaskTransitionInput): Promise<TaskCheckpoint>;
|
|
498
|
+
declare function transitionTaskCheckpoint(existing: TaskCheckpoint | undefined, input: TaskTransitionInput): TaskCheckpoint;
|
|
499
|
+
declare function stableStringify(value: unknown): string;
|
|
500
|
+
declare function fingerprint(value: unknown): string;
|
|
203
501
|
|
|
204
502
|
interface PredicatePlan {
|
|
205
503
|
partition: Expr[];
|
|
@@ -345,63 +643,6 @@ declare function buildBBoxIndex<T extends Record<string, unknown>>(rows: T[], co
|
|
|
345
643
|
maxy: string;
|
|
346
644
|
}): BBoxIndex;
|
|
347
645
|
|
|
348
|
-
interface PutOptions {
|
|
349
|
-
contentType?: string;
|
|
350
|
-
metadata?: Record<string, string>;
|
|
351
|
-
}
|
|
352
|
-
interface ConditionalPutOptions extends PutOptions {
|
|
353
|
-
/**
|
|
354
|
-
* ETag that must still identify the existing object. Use null to require
|
|
355
|
-
* the object to be absent.
|
|
356
|
-
*/
|
|
357
|
-
expectedEtag: string | null;
|
|
358
|
-
}
|
|
359
|
-
interface ListOptions {
|
|
360
|
-
/** Stop listing after this many objects. */
|
|
361
|
-
limit?: number;
|
|
362
|
-
/** List "directories" by stopping at this delimiter. */
|
|
363
|
-
delimiter?: string;
|
|
364
|
-
}
|
|
365
|
-
interface ObjectInfo {
|
|
366
|
-
path: string;
|
|
367
|
-
size: number;
|
|
368
|
-
etag?: string;
|
|
369
|
-
lastModified?: Date;
|
|
370
|
-
}
|
|
371
|
-
interface ObjectHead {
|
|
372
|
-
size: number;
|
|
373
|
-
etag?: string;
|
|
374
|
-
lastModified?: Date;
|
|
375
|
-
contentType?: string;
|
|
376
|
-
}
|
|
377
|
-
/**
|
|
378
|
-
* The single environmental contract for storage. Every runtime driver
|
|
379
|
-
* (R2, S3, HTTP, filesystem) supplies one of these; core never touches
|
|
380
|
-
* a runtime API directly.
|
|
381
|
-
*/
|
|
382
|
-
interface ObjectStore {
|
|
383
|
-
get(path: string): Promise<Uint8Array | null>;
|
|
384
|
-
getRange(path: string, range: {
|
|
385
|
-
offset: number;
|
|
386
|
-
length: number;
|
|
387
|
-
}): Promise<Uint8Array>;
|
|
388
|
-
put(path: string, body: Uint8Array | ReadableStream<Uint8Array>, options?: PutOptions): Promise<void>;
|
|
389
|
-
delete(path: string): Promise<void>;
|
|
390
|
-
list(prefix: string, options?: ListOptions): AsyncIterable<ObjectInfo>;
|
|
391
|
-
head(path: string): Promise<ObjectHead | null>;
|
|
392
|
-
}
|
|
393
|
-
interface ConditionalObjectStore extends ObjectStore {
|
|
394
|
-
conditionalPut(path: string, body: Uint8Array | ReadableStream<Uint8Array>, options: ConditionalPutOptions): Promise<boolean>;
|
|
395
|
-
}
|
|
396
|
-
interface ObjectStoreReadControls {
|
|
397
|
-
maxConcurrentReads?: number;
|
|
398
|
-
signal?: AbortSignal;
|
|
399
|
-
maxElapsedMs?: number;
|
|
400
|
-
}
|
|
401
|
-
declare function withObjectStoreReadControls(store: ObjectStore, controls: ObjectStoreReadControls): ObjectStore;
|
|
402
|
-
declare function readControlSignal(controls: ObjectStoreReadControls): AbortSignal | undefined;
|
|
403
|
-
declare function throwIfAborted(signal: AbortSignal | undefined): void;
|
|
404
|
-
|
|
405
646
|
interface QueryBudget {
|
|
406
647
|
maxFiles?: number;
|
|
407
648
|
maxBytes?: number;
|
|
@@ -432,6 +673,7 @@ interface LakeConfig {
|
|
|
432
673
|
store: ObjectStore;
|
|
433
674
|
scanner: ScanAdapter;
|
|
434
675
|
sidecarIndex?: SidecarFileIndex[];
|
|
676
|
+
planningCache?: CacheAdapter<ObjectInfo[]>;
|
|
435
677
|
budget?: QueryBudget;
|
|
436
678
|
policy?: QueryPolicy;
|
|
437
679
|
substrate?: RuntimeSubstrate;
|
|
@@ -441,6 +683,8 @@ interface LakeConfig {
|
|
|
441
683
|
interface ScanOptions {
|
|
442
684
|
columns?: string[];
|
|
443
685
|
where?: Expr;
|
|
686
|
+
rowStart?: number;
|
|
687
|
+
rowEnd?: number;
|
|
444
688
|
batchSize: number;
|
|
445
689
|
stats: QueryStats;
|
|
446
690
|
budget: QueryBudget;
|
|
@@ -449,23 +693,38 @@ interface ScanOptions {
|
|
|
449
693
|
}
|
|
450
694
|
interface ScanAdapter {
|
|
451
695
|
scan(path: string, options: ScanOptions): AsyncIterable<Row[]>;
|
|
696
|
+
scanColumns?(path: string, options: ScanOptions): AsyncIterable<Batch>;
|
|
697
|
+
scanVectorBatches?(path: string, options: ScanOptions): AsyncIterable<ScanVectorBatch>;
|
|
698
|
+
scanColumnBatches?(path: string, options: ScanOptions): AsyncIterable<ScanColumnBatch>;
|
|
452
699
|
planTask?(path: string, options: ScanTaskPlanOptions): Promise<ScanTaskPlan>;
|
|
453
700
|
}
|
|
701
|
+
interface ScanVectorBatch {
|
|
702
|
+
rowOffset: number;
|
|
703
|
+
batch: Batch;
|
|
704
|
+
}
|
|
705
|
+
interface ScanColumnBatch {
|
|
706
|
+
rowOffset: number;
|
|
707
|
+
batch: Batch;
|
|
708
|
+
}
|
|
454
709
|
interface ScanTaskPlanOptions {
|
|
455
710
|
columns?: string[];
|
|
456
711
|
where?: Expr;
|
|
457
712
|
partitionValues: Record<string, string>;
|
|
713
|
+
object?: ObjectInfo;
|
|
458
714
|
}
|
|
459
715
|
interface ScanTaskPlan {
|
|
460
716
|
rowGroupRanges: {
|
|
461
717
|
start: number;
|
|
462
718
|
end: number;
|
|
463
719
|
}[];
|
|
720
|
+
rowGroupCount?: number;
|
|
464
721
|
}
|
|
465
722
|
interface PathQueryInit {
|
|
466
723
|
source: string;
|
|
467
724
|
select?: string[];
|
|
725
|
+
projections?: Record<string, Expr>;
|
|
468
726
|
where?: Expr;
|
|
727
|
+
distinct?: boolean;
|
|
469
728
|
orderBy?: OrderByTerm[];
|
|
470
729
|
limit?: number;
|
|
471
730
|
offset?: number;
|
|
@@ -494,14 +753,20 @@ interface CsvStreamOptions {
|
|
|
494
753
|
/** Column order for CSV output. Defaults to select columns or first-row keys. */
|
|
495
754
|
columns?: string[];
|
|
496
755
|
}
|
|
497
|
-
type AggregateOp = "count" | "sum" | "avg" | "min" | "max" | "count_distinct" | "approx_count_distinct" | "first" | "last" | "any";
|
|
756
|
+
type AggregateOp = "count" | "sum" | "avg" | "var_samp" | "var_pop" | "stddev_samp" | "stddev_pop" | "median" | "quantile" | "min" | "max" | "count_distinct" | "approx_count_distinct" | "mode" | "first" | "last" | "any";
|
|
498
757
|
interface AggregateExpr {
|
|
499
758
|
op: AggregateOp;
|
|
500
759
|
column?: string;
|
|
760
|
+
expr?: Expr;
|
|
761
|
+
quantile?: number;
|
|
501
762
|
}
|
|
502
763
|
type AggregateSpec = Record<string, AggregateExpr>;
|
|
503
764
|
interface AggregateOptions {
|
|
504
765
|
maxGroups?: number;
|
|
766
|
+
having?: Expr;
|
|
767
|
+
orderBy?: OrderByTerm[];
|
|
768
|
+
limit?: number;
|
|
769
|
+
offset?: number;
|
|
505
770
|
operatorState?: Uint8Array | AggregateOperatorState | {
|
|
506
771
|
spillRef: string;
|
|
507
772
|
};
|
|
@@ -579,12 +844,31 @@ type AggregateStateSnapshot = {
|
|
|
579
844
|
op: "avg";
|
|
580
845
|
sum: number;
|
|
581
846
|
count: number;
|
|
847
|
+
} | {
|
|
848
|
+
op: "var_samp" | "var_pop" | "stddev_samp" | "stddev_pop";
|
|
849
|
+
count: number;
|
|
850
|
+
mean: number;
|
|
851
|
+
m2: number;
|
|
852
|
+
} | {
|
|
853
|
+
op: "median";
|
|
854
|
+
values: (number | string)[];
|
|
855
|
+
} | {
|
|
856
|
+
op: "quantile";
|
|
857
|
+
quantile: number;
|
|
858
|
+
values: number[];
|
|
582
859
|
} | {
|
|
583
860
|
op: "min" | "max";
|
|
584
861
|
value: AggregateSnapshotValue;
|
|
585
862
|
} | {
|
|
586
863
|
op: "count_distinct" | "approx_count_distinct";
|
|
587
864
|
values: string[];
|
|
865
|
+
} | {
|
|
866
|
+
op: "mode";
|
|
867
|
+
values: {
|
|
868
|
+
key: string;
|
|
869
|
+
value: AggregateSnapshotValue;
|
|
870
|
+
count: number;
|
|
871
|
+
}[];
|
|
588
872
|
} | {
|
|
589
873
|
op: "first" | "last" | "any";
|
|
590
874
|
seen: boolean;
|
|
@@ -594,6 +878,7 @@ interface TaskInput {
|
|
|
594
878
|
path: string;
|
|
595
879
|
etag?: string;
|
|
596
880
|
size?: number;
|
|
881
|
+
rowGroupCount?: number;
|
|
597
882
|
rowGroupRanges: {
|
|
598
883
|
start: number;
|
|
599
884
|
end: number;
|
|
@@ -619,6 +904,7 @@ interface JsonQueryV1 {
|
|
|
619
904
|
from: string;
|
|
620
905
|
select?: string[];
|
|
621
906
|
where?: JsonExpr;
|
|
907
|
+
distinct?: boolean;
|
|
622
908
|
orderBy?: JsonOrderByTerm[];
|
|
623
909
|
limit?: number;
|
|
624
910
|
offset?: number;
|
|
@@ -670,6 +956,7 @@ declare class Lake {
|
|
|
670
956
|
private readonly queryId;
|
|
671
957
|
private readonly substrate;
|
|
672
958
|
private readonly sidecarIndex;
|
|
959
|
+
private readonly planningCache;
|
|
673
960
|
constructor(config: LakeConfig);
|
|
674
961
|
path(source: string): QueryBuilder;
|
|
675
962
|
hive(source: string): QueryBuilder;
|
|
@@ -688,7 +975,9 @@ declare class QueryBuilder {
|
|
|
688
975
|
private readonly init;
|
|
689
976
|
constructor(lake: Lake, init: PathQueryInit);
|
|
690
977
|
select(columns: string[]): QueryBuilder;
|
|
978
|
+
project(projections: Record<string, Expr>): QueryBuilder;
|
|
691
979
|
where(expr: Expr): QueryBuilder;
|
|
980
|
+
distinct(enabled?: boolean): QueryBuilder;
|
|
692
981
|
orderBy(terms: OrderByTerm[]): QueryBuilder;
|
|
693
982
|
limit(limit: number): QueryBuilder;
|
|
694
983
|
offset(offset: number): QueryBuilder;
|
|
@@ -727,6 +1016,7 @@ interface QueryResultConfig extends PathQueryInit {
|
|
|
727
1016
|
queryId: string;
|
|
728
1017
|
metrics?: MetricsHook;
|
|
729
1018
|
sidecarIndex?: SidecarFileIndex[];
|
|
1019
|
+
planningCache?: CacheAdapter<ObjectInfo[]>;
|
|
730
1020
|
}
|
|
731
1021
|
declare class QueryResult {
|
|
732
1022
|
readonly stats: QueryStats;
|
|
@@ -735,6 +1025,8 @@ declare class QueryResult {
|
|
|
735
1025
|
rows(): AsyncIterable<Row>;
|
|
736
1026
|
private matchedRows;
|
|
737
1027
|
batches(): AsyncIterable<Row[]>;
|
|
1028
|
+
private tryColumnarProjectedBatches;
|
|
1029
|
+
private columnarProjectedBatches;
|
|
738
1030
|
toArray(): Promise<Row[]>;
|
|
739
1031
|
topKWithState(options?: TopKOptions): Promise<TopKResult>;
|
|
740
1032
|
sortWithState(options?: SortOptions): Promise<SortResult>;
|
|
@@ -745,8 +1037,15 @@ declare class QueryResult {
|
|
|
745
1037
|
slice(options: SliceOptions): Promise<SliceResult>;
|
|
746
1038
|
resumableBatches(options: ResumableBatchOptions): AsyncIterable<SliceResult>;
|
|
747
1039
|
aggregate(groupColumns: string[], spec: AggregateSpec, options?: AggregateOptions): Promise<Row[]>;
|
|
1040
|
+
private tryColumnarAggregateRows;
|
|
1041
|
+
private tryLateMaterializedAggregateRows;
|
|
1042
|
+
private aggregateMaterializedRows;
|
|
748
1043
|
aggregateWithState(groupColumns: string[], spec: AggregateSpec, options?: AggregateOptions): Promise<AggregateResult>;
|
|
749
1044
|
private orderedBatches;
|
|
1045
|
+
private tryColumnarTopKRows;
|
|
1046
|
+
private tryLateMaterializedTopKRows;
|
|
1047
|
+
private materializeRowRefs;
|
|
1048
|
+
private columnBatches;
|
|
750
1049
|
private collectOrderedMatches;
|
|
751
1050
|
private collectSortRuns;
|
|
752
1051
|
explain(): Promise<ExplainResult>;
|
|
@@ -764,115 +1063,59 @@ declare function deserializeTopKOperatorState(bytes: Uint8Array | TopKOperatorSt
|
|
|
764
1063
|
declare function deserializeSortOperatorState(bytes: Uint8Array | SortOperatorState): SortOperatorState;
|
|
765
1064
|
declare function parseJsonQuery(input: unknown): PathQueryInit;
|
|
766
1065
|
declare function parseHivePartitions(path: string): Record<string, string>;
|
|
767
|
-
|
|
768
|
-
interface
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
outputRole: "rows" | "data-file" | "manifest";
|
|
772
|
-
}
|
|
773
|
-
interface TaskManifest {
|
|
774
|
-
version: 1;
|
|
775
|
-
jobId: string;
|
|
776
|
-
planFingerprint: string;
|
|
777
|
-
snapshot: string;
|
|
778
|
-
tasks: TaskManifestTask[];
|
|
779
|
-
}
|
|
780
|
-
interface OutputManifestEntry {
|
|
781
|
-
taskId: string;
|
|
782
|
-
outputPath: string;
|
|
783
|
-
partitionValues: Record<string, string>;
|
|
784
|
-
rowCount: number;
|
|
785
|
-
byteSize: number;
|
|
786
|
-
contentHash?: string;
|
|
787
|
-
etag?: string;
|
|
788
|
-
iceberg?: {
|
|
789
|
-
recordCount: number;
|
|
790
|
-
fileSizeInBytes: number;
|
|
791
|
-
partitionValues: Record<string, string>;
|
|
792
|
-
};
|
|
793
|
-
}
|
|
794
|
-
interface OutputManifest {
|
|
795
|
-
version: 1;
|
|
796
|
-
jobId: string;
|
|
797
|
-
planFingerprint: string;
|
|
798
|
-
entries: OutputManifestEntry[];
|
|
799
|
-
}
|
|
800
|
-
type TaskState = "planned" | "running" | "output-written" | "manifest-recorded" | "complete";
|
|
801
|
-
interface TaskCheckpoint {
|
|
802
|
-
taskId: string;
|
|
803
|
-
state: TaskState;
|
|
804
|
-
idempotencyKey: string;
|
|
805
|
-
updatedAtMs: number;
|
|
806
|
-
output?: OutputManifestEntry;
|
|
807
|
-
outputs?: OutputManifestEntry[];
|
|
1066
|
+
|
|
1067
|
+
interface InMemoryTableOptions {
|
|
1068
|
+
maxRows?: number;
|
|
1069
|
+
maxBytes?: number;
|
|
808
1070
|
}
|
|
809
|
-
interface
|
|
810
|
-
get(taskId: string): Promise<TaskCheckpoint | undefined>;
|
|
811
|
-
put(checkpoint: TaskCheckpoint): Promise<void>;
|
|
812
|
-
list(jobId?: string): AsyncIterable<TaskCheckpoint>;
|
|
1071
|
+
interface InMemoryLakeOptions extends Omit<LakeConfig, "store" | "scanner" | "sidecarIndex">, InMemoryTableOptions {
|
|
813
1072
|
}
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
1073
|
+
declare class InMemoryRowsScanner implements ScanAdapter {
|
|
1074
|
+
private readonly tables;
|
|
1075
|
+
constructor(tables: Record<string, readonly Row[]>, options?: InMemoryTableOptions);
|
|
1076
|
+
scan(path: string, options: ScanOptions): AsyncIterable<Row[]>;
|
|
1077
|
+
planTask(path: string): Promise<{
|
|
1078
|
+
rowGroupRanges: {
|
|
1079
|
+
start: number;
|
|
1080
|
+
end: number;
|
|
1081
|
+
}[];
|
|
1082
|
+
}>;
|
|
1083
|
+
tableInfo(path: string): ObjectInfo;
|
|
1084
|
+
listTables(prefix: string, options?: ListOptions): ObjectInfo[];
|
|
1085
|
+
private table;
|
|
822
1086
|
}
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
1087
|
+
declare class InMemoryRowsStore implements ObjectStore {
|
|
1088
|
+
private readonly scanner;
|
|
1089
|
+
constructor(scanner: InMemoryRowsScanner);
|
|
1090
|
+
get(path: string): Promise<Uint8Array | null>;
|
|
1091
|
+
getRange(path: string): Promise<Uint8Array>;
|
|
1092
|
+
put(): Promise<void>;
|
|
1093
|
+
delete(): Promise<void>;
|
|
1094
|
+
list(prefix: string, options?: ListOptions): AsyncIterable<ObjectInfo>;
|
|
1095
|
+
head(path: string): Promise<ObjectHead | null>;
|
|
829
1096
|
}
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
1097
|
+
declare function inMemoryRowsScanner(tables: Record<string, readonly Row[]>, options?: InMemoryTableOptions): InMemoryRowsScanner;
|
|
1098
|
+
declare function createInMemoryLake(tables: Record<string, readonly Row[]>, options?: InMemoryLakeOptions): Lake;
|
|
1099
|
+
|
|
1100
|
+
type JoinType = "inner" | "left" | "semi" | "anti";
|
|
1101
|
+
type JoinKey = string | string[];
|
|
1102
|
+
interface BroadcastJoinOptions {
|
|
1103
|
+
leftKey: JoinKey;
|
|
1104
|
+
rightKey: JoinKey;
|
|
1105
|
+
maxRightRows: number;
|
|
1106
|
+
type?: JoinType;
|
|
1107
|
+
rightPrefix?: string;
|
|
837
1108
|
}
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
declare function createOutputManifest(input: {
|
|
845
|
-
jobId: string;
|
|
846
|
-
planFingerprint: string;
|
|
847
|
-
entries: OutputManifestEntry[];
|
|
848
|
-
}): OutputManifest;
|
|
849
|
-
declare function createOutputManifestFromCheckpoints(input: {
|
|
850
|
-
jobId: string;
|
|
851
|
-
planFingerprint: string;
|
|
852
|
-
checkpoints: CheckpointAdapter;
|
|
853
|
-
}): Promise<OutputManifest>;
|
|
854
|
-
declare function writeOutputManifest(store: ObjectStore, path: string, manifest: OutputManifest): Promise<{
|
|
855
|
-
path: string;
|
|
856
|
-
byteSize: number;
|
|
857
|
-
etag?: string;
|
|
858
|
-
}>;
|
|
859
|
-
declare function readOutputManifest(store: ObjectStore, path: string): Promise<OutputManifest>;
|
|
860
|
-
declare function createBookmark(init: BookmarkInit): Bookmark;
|
|
861
|
-
declare function assertBookmarkMatches(bookmark: Bookmark, planFingerprint: string): void;
|
|
862
|
-
declare function signPaginationToken(bookmark: Bookmark, secret: string | Uint8Array): Promise<string>;
|
|
863
|
-
declare function verifyPaginationToken(token: string, secret: string | Uint8Array): Promise<Bookmark>;
|
|
864
|
-
declare class MemoryCheckpointAdapter implements CheckpointAdapter {
|
|
865
|
-
private readonly checkpoints;
|
|
866
|
-
private readonly taskJobs;
|
|
867
|
-
get(taskId: string): Promise<TaskCheckpoint | undefined>;
|
|
868
|
-
put(checkpoint: TaskCheckpoint): Promise<void>;
|
|
869
|
-
list(jobId?: string): AsyncIterable<TaskCheckpoint>;
|
|
1109
|
+
interface LookupJoinOptions {
|
|
1110
|
+
leftKey: JoinKey;
|
|
1111
|
+
rightKey: JoinKey;
|
|
1112
|
+
maxRightRows: number;
|
|
1113
|
+
type?: JoinType;
|
|
1114
|
+
rightPrefix?: string;
|
|
870
1115
|
}
|
|
871
|
-
|
|
872
|
-
declare function
|
|
873
|
-
declare function
|
|
874
|
-
declare function stableStringify(value: unknown): string;
|
|
875
|
-
declare function fingerprint(value: unknown): string;
|
|
1116
|
+
type LookupJoinFunction = (key: string | number | boolean | bigint | null | (string | number | boolean | bigint | null)[], leftRow: Row) => AsyncIterable<Row> | Iterable<Row> | Promise<AsyncIterable<Row> | Iterable<Row>>;
|
|
1117
|
+
declare function broadcastJoin(left: AsyncIterable<Row> | Iterable<Row>, right: AsyncIterable<Row> | Iterable<Row>, options: BroadcastJoinOptions): Promise<Row[]>;
|
|
1118
|
+
declare function lookupJoin(left: AsyncIterable<Row> | Iterable<Row>, lookup: LookupJoinFunction, options: LookupJoinOptions): Promise<Row[]>;
|
|
876
1119
|
|
|
877
1120
|
/**
|
|
878
1121
|
* In-memory ObjectStore. The reference implementation of the store
|
|
@@ -895,7 +1138,244 @@ declare class MemoryObjectStore implements ObjectStore {
|
|
|
895
1138
|
}
|
|
896
1139
|
declare function memoryStore(): MemoryObjectStore;
|
|
897
1140
|
|
|
898
|
-
|
|
1141
|
+
interface ObjectStoreCacheOptions {
|
|
1142
|
+
/** Maximum cached object/range bytes retained in memory. Defaults to 64 MiB. */
|
|
1143
|
+
maxBytes?: number;
|
|
1144
|
+
/** Optional time-to-live for cache entries. Entries do not expire by default. */
|
|
1145
|
+
ttlMs?: number;
|
|
1146
|
+
/** How LakeQL should spend the cache budget. Defaults to balanced. */
|
|
1147
|
+
policy?: CachePolicy;
|
|
1148
|
+
}
|
|
1149
|
+
type CachePolicy = "balanced" | "io" | "latency";
|
|
1150
|
+
interface SharedCacheEntry<T> {
|
|
1151
|
+
value: T;
|
|
1152
|
+
bytes: number;
|
|
1153
|
+
}
|
|
1154
|
+
interface SharedCacheSetOptions {
|
|
1155
|
+
priority?: number;
|
|
1156
|
+
}
|
|
1157
|
+
declare class SharedMemoryCache {
|
|
1158
|
+
private readonly maxBytes;
|
|
1159
|
+
private readonly ttlMs;
|
|
1160
|
+
private readonly entries;
|
|
1161
|
+
private cachedBytes;
|
|
1162
|
+
constructor(options?: ObjectStoreCacheOptions);
|
|
1163
|
+
get<T>(key: string): SharedCacheEntry<T> | undefined;
|
|
1164
|
+
set<T>(key: string, value: T, bytes: number, options?: SharedCacheSetOptions): void;
|
|
1165
|
+
delete(key: string): void;
|
|
1166
|
+
deleteWhere(predicate: (value: unknown) => boolean): void;
|
|
1167
|
+
private expiresAt;
|
|
1168
|
+
private evict;
|
|
1169
|
+
private evictKey;
|
|
1170
|
+
}
|
|
1171
|
+
declare function cachedObjectStore(inner: ObjectStore, options?: ObjectStoreCacheOptions, sharedCache?: SharedMemoryCache): ObjectStore;
|
|
1172
|
+
|
|
1173
|
+
type VectorDistinctAggregateState = {
|
|
1174
|
+
op: "count_distinct" | "approx_count_distinct";
|
|
1175
|
+
values: Set<string>;
|
|
1176
|
+
sortedValues?: string[];
|
|
1177
|
+
sortedRuns?: string[][];
|
|
1178
|
+
memoryBytes: number;
|
|
1179
|
+
};
|
|
1180
|
+
|
|
1181
|
+
type VectorAggregateValue = string | number | boolean | bigint | TimestampValue | null;
|
|
1182
|
+
type VectorAggregateState = {
|
|
1183
|
+
op: "count";
|
|
1184
|
+
count: number;
|
|
1185
|
+
} | {
|
|
1186
|
+
op: "sum";
|
|
1187
|
+
sum: number;
|
|
1188
|
+
} | {
|
|
1189
|
+
op: "avg";
|
|
1190
|
+
sum: number;
|
|
1191
|
+
count: number;
|
|
1192
|
+
} | {
|
|
1193
|
+
op: "var_samp" | "var_pop" | "stddev_samp" | "stddev_pop";
|
|
1194
|
+
count: number;
|
|
1195
|
+
mean: number;
|
|
1196
|
+
m2: number;
|
|
1197
|
+
} | {
|
|
1198
|
+
op: "median";
|
|
1199
|
+
values: (number | string)[];
|
|
1200
|
+
memoryBytes: number;
|
|
1201
|
+
} | {
|
|
1202
|
+
op: "quantile";
|
|
1203
|
+
quantile: number;
|
|
1204
|
+
values: number[];
|
|
1205
|
+
memoryBytes: number;
|
|
1206
|
+
} | {
|
|
1207
|
+
op: "min" | "max";
|
|
1208
|
+
value: VectorAggregateValue;
|
|
1209
|
+
} | VectorDistinctAggregateState | {
|
|
1210
|
+
op: "mode";
|
|
1211
|
+
values: Map<string, {
|
|
1212
|
+
value: Exclude<VectorAggregateValue, null>;
|
|
1213
|
+
count: number;
|
|
1214
|
+
}>;
|
|
1215
|
+
memoryBytes: number;
|
|
1216
|
+
} | {
|
|
1217
|
+
op: "first";
|
|
1218
|
+
seen: boolean;
|
|
1219
|
+
value: VectorAggregateValue;
|
|
1220
|
+
} | {
|
|
1221
|
+
op: "last";
|
|
1222
|
+
seen: boolean;
|
|
1223
|
+
value: VectorAggregateValue;
|
|
1224
|
+
} | {
|
|
1225
|
+
op: "any";
|
|
1226
|
+
seen: boolean;
|
|
1227
|
+
value: VectorAggregateValue;
|
|
1228
|
+
};
|
|
1229
|
+
type VectorAggregateStates = Record<string, VectorAggregateState>;
|
|
1230
|
+
type VectorAggregateSnapshotValue = string | number | boolean | null | {
|
|
1231
|
+
type: "bigint";
|
|
1232
|
+
value: string;
|
|
1233
|
+
} | {
|
|
1234
|
+
type: "timestamp";
|
|
1235
|
+
epochNanoseconds: string;
|
|
1236
|
+
unit: TimestampValue["unit"];
|
|
1237
|
+
isAdjustedToUTC: boolean;
|
|
1238
|
+
};
|
|
1239
|
+
type VectorAggregateStateSnapshot = {
|
|
1240
|
+
op: "count";
|
|
1241
|
+
count: number;
|
|
1242
|
+
} | {
|
|
1243
|
+
op: "sum";
|
|
1244
|
+
sum: number;
|
|
1245
|
+
} | {
|
|
1246
|
+
op: "avg";
|
|
1247
|
+
sum: number;
|
|
1248
|
+
count: number;
|
|
1249
|
+
} | {
|
|
1250
|
+
op: "var_samp" | "var_pop" | "stddev_samp" | "stddev_pop";
|
|
1251
|
+
count: number;
|
|
1252
|
+
mean: number;
|
|
1253
|
+
m2: number;
|
|
1254
|
+
} | {
|
|
1255
|
+
op: "median";
|
|
1256
|
+
values: (number | string)[];
|
|
1257
|
+
} | {
|
|
1258
|
+
op: "quantile";
|
|
1259
|
+
quantile: number;
|
|
1260
|
+
values: number[];
|
|
1261
|
+
} | {
|
|
1262
|
+
op: "min" | "max";
|
|
1263
|
+
value: VectorAggregateSnapshotValue;
|
|
1264
|
+
} | {
|
|
1265
|
+
op: "count_distinct" | "approx_count_distinct";
|
|
1266
|
+
values: string[];
|
|
1267
|
+
} | {
|
|
1268
|
+
op: "mode";
|
|
1269
|
+
values: {
|
|
1270
|
+
key: string;
|
|
1271
|
+
value: VectorAggregateSnapshotValue;
|
|
1272
|
+
count: number;
|
|
1273
|
+
}[];
|
|
1274
|
+
} | {
|
|
1275
|
+
op: "first";
|
|
1276
|
+
seen: boolean;
|
|
1277
|
+
value: VectorAggregateSnapshotValue;
|
|
1278
|
+
} | {
|
|
1279
|
+
op: "last";
|
|
1280
|
+
seen: boolean;
|
|
1281
|
+
value: VectorAggregateSnapshotValue;
|
|
1282
|
+
} | {
|
|
1283
|
+
op: "any";
|
|
1284
|
+
seen: boolean;
|
|
1285
|
+
value: VectorAggregateSnapshotValue;
|
|
1286
|
+
};
|
|
1287
|
+
type VectorAggregateStateSnapshots = Record<string, VectorAggregateStateSnapshot>;
|
|
1288
|
+
interface VectorAggregateOptions {
|
|
1289
|
+
budget?: QueryBudget;
|
|
1290
|
+
}
|
|
1291
|
+
declare function createVectorAggregateStates(spec: AggregateSpec, options?: VectorAggregateOptions): VectorAggregateStates;
|
|
1292
|
+
declare function updateVectorAggregateStates(states: VectorAggregateStates, spec: AggregateSpec, batch: Batch, selection?: Selection, options?: VectorAggregateOptions): void;
|
|
1293
|
+
declare function mergeVectorAggregateStates(target: VectorAggregateStates, source: VectorAggregateStates, options?: VectorAggregateOptions): void;
|
|
1294
|
+
declare function mergeVectorAggregateStateSnapshots(target: VectorAggregateStates, snapshots: VectorAggregateStateSnapshots, options?: VectorAggregateOptions): void;
|
|
1295
|
+
declare function finalizeVectorAggregateStates(states: VectorAggregateStates): Record<string, unknown>;
|
|
1296
|
+
declare function snapshotVectorAggregateStates(states: VectorAggregateStates): VectorAggregateStateSnapshots;
|
|
1297
|
+
declare function restoreVectorAggregateStates(snapshots: VectorAggregateStateSnapshots, options?: VectorAggregateOptions): VectorAggregateStates;
|
|
1298
|
+
declare function vectorAggregateBatch(spec: AggregateSpec, batch: Batch, selection?: Selection, options?: VectorAggregateOptions): Record<string, unknown>;
|
|
1299
|
+
declare function updateVectorAggregateStateValue(state: VectorAggregateState, value: VectorAggregateValue, options?: VectorAggregateOptions): void;
|
|
1300
|
+
|
|
1301
|
+
interface VectorGroupByOptions extends VectorAggregateOptions {
|
|
1302
|
+
maxGroups?: number;
|
|
1303
|
+
}
|
|
1304
|
+
interface VectorGroupByState {
|
|
1305
|
+
readonly keys: readonly string[];
|
|
1306
|
+
readonly spec: AggregateSpec;
|
|
1307
|
+
readonly groups: Map<string, VectorGroup>;
|
|
1308
|
+
}
|
|
1309
|
+
interface VectorGroup {
|
|
1310
|
+
keyValues: Scalar[];
|
|
1311
|
+
states: VectorAggregateStates;
|
|
1312
|
+
}
|
|
1313
|
+
type VectorGroupBySnapshotValue = string | number | boolean | null | {
|
|
1314
|
+
type: "bigint";
|
|
1315
|
+
value: string;
|
|
1316
|
+
} | {
|
|
1317
|
+
type: "timestamp";
|
|
1318
|
+
epochNanoseconds: string;
|
|
1319
|
+
unit: TimestampValue["unit"];
|
|
1320
|
+
isAdjustedToUTC: boolean;
|
|
1321
|
+
};
|
|
1322
|
+
interface VectorGroupByGroupSnapshot {
|
|
1323
|
+
keyValues: VectorGroupBySnapshotValue[];
|
|
1324
|
+
states: VectorAggregateStateSnapshots;
|
|
1325
|
+
}
|
|
1326
|
+
interface VectorGroupByStateSnapshot {
|
|
1327
|
+
groups: VectorGroupByGroupSnapshot[];
|
|
1328
|
+
}
|
|
1329
|
+
declare function createVectorGroupByState(keys: readonly string[], spec: AggregateSpec): VectorGroupByState;
|
|
1330
|
+
declare function updateVectorGroupByState(state: VectorGroupByState, batch: Batch, selection?: Selection, options?: VectorGroupByOptions): number;
|
|
1331
|
+
declare function getOrCreateVectorGroup(state: VectorGroupByState, batch: Batch, index: number, options?: VectorGroupByOptions): VectorGroup;
|
|
1332
|
+
declare function updateVectorGroupAggregateValue(group: VectorGroup, alias: string, value: VectorAggregateValue, options?: VectorAggregateOptions): void;
|
|
1333
|
+
declare function enforceVectorGroupByBudget(state: VectorGroupByState, budget?: QueryBudget): void;
|
|
1334
|
+
declare function finalizeVectorGroupByRows(state: VectorGroupByState): Row[];
|
|
1335
|
+
declare function finalizeVectorGroupByBatch(state: VectorGroupByState): Batch;
|
|
1336
|
+
declare function snapshotVectorGroupByState(state: VectorGroupByState): VectorGroupByStateSnapshot;
|
|
1337
|
+
declare function restoreVectorGroupByState(keys: readonly string[], spec: AggregateSpec, snapshot: VectorGroupByStateSnapshot, options?: VectorGroupByOptions): VectorGroupByState;
|
|
1338
|
+
declare function mergeVectorGroupByStates(target: VectorGroupByState, source: VectorGroupByState, options?: VectorGroupByOptions): void;
|
|
1339
|
+
declare function vectorGroupByBatch(keys: readonly string[], spec: AggregateSpec, batch: Batch, selection?: Selection, options?: VectorGroupByOptions): Batch;
|
|
1340
|
+
|
|
1341
|
+
interface VectorHashJoinOptions {
|
|
1342
|
+
leftKey: JoinKey;
|
|
1343
|
+
rightKey: JoinKey;
|
|
1344
|
+
maxRightRows: number;
|
|
1345
|
+
type?: JoinType;
|
|
1346
|
+
rightPrefix?: string;
|
|
1347
|
+
leftSelection?: Selection;
|
|
1348
|
+
rightSelection?: Selection;
|
|
1349
|
+
}
|
|
1350
|
+
declare function vectorHashJoin(left: Batch, right: Batch, options: VectorHashJoinOptions): Batch;
|
|
1351
|
+
|
|
1352
|
+
type VectorProjectionSpec = Record<string, Expr>;
|
|
1353
|
+
declare function vectorProjectBatch(batch: Batch, select?: readonly string[], projections?: VectorProjectionSpec): Batch;
|
|
1354
|
+
|
|
1355
|
+
interface VectorTopKOptions {
|
|
1356
|
+
offset?: number;
|
|
1357
|
+
limit: number;
|
|
1358
|
+
}
|
|
1359
|
+
declare function vectorOrderByBatch(batch: Batch, orderBy: readonly OrderByTerm[], selection?: Selection): Batch;
|
|
1360
|
+
declare function vectorTopKBatch(batch: Batch, orderBy: readonly OrderByTerm[], options: VectorTopKOptions, selection?: Selection): Batch;
|
|
1361
|
+
declare function vectorSortIndices(batch: Batch, orderBy: readonly OrderByTerm[], selection?: Selection): number[];
|
|
1362
|
+
declare function vectorTopKIndices(batch: Batch, orderBy: readonly OrderByTerm[], topK: number, selection?: Selection): number[];
|
|
1363
|
+
declare function gatherBatch(batch: Batch, indices: readonly number[]): Batch;
|
|
1364
|
+
declare function concatBatches(batches: readonly Batch[]): Batch;
|
|
1365
|
+
|
|
1366
|
+
interface WorkUnitFanInOptions<Input, Partial, Accumulator> {
|
|
1367
|
+
inputs: readonly Input[];
|
|
1368
|
+
initial: Accumulator;
|
|
1369
|
+
maxConcurrentTasks?: number;
|
|
1370
|
+
maxBufferedPartials?: number;
|
|
1371
|
+
run(input: Input, index: number): Promise<Partial>;
|
|
1372
|
+
reduce(accumulator: Accumulator, partial: Partial, input: Input, index: number): void | Promise<void>;
|
|
1373
|
+
boundary?(partial: Partial, input: Input, index: number): Partial | Promise<Partial>;
|
|
1374
|
+
}
|
|
1375
|
+
declare function fanInWorkUnits<Input, Partial, Accumulator>(options: WorkUnitFanInOptions<Input, Partial, Accumulator>): Promise<Accumulator>;
|
|
1376
|
+
declare function jsonWorkUnitBoundary<T>(value: T): T;
|
|
1377
|
+
|
|
1378
|
+
declare const PACKAGE: "lakeql-iceberg";
|
|
899
1379
|
type IcebergReadMode = "strict" | "ignore-deletes" | "ignore-unsupported-deletes";
|
|
900
1380
|
interface LoadIcebergTableOptions extends ObjectStoreReadControls {
|
|
901
1381
|
store: ObjectStore;
|
|
@@ -1166,6 +1646,20 @@ declare function loadIcebergTableFromRest(options: LoadIcebergTableFromRestOptio
|
|
|
1166
1646
|
declare function applyIcebergDeletes(options: ApplyIcebergDeletesOptions): Row[];
|
|
1167
1647
|
declare function scanPlannedIcebergRows(options: ScanPlannedIcebergRowsOptions): AsyncIterable<Row[]>;
|
|
1168
1648
|
|
|
1649
|
+
declare class DecodedColumnCache {
|
|
1650
|
+
private readonly cache;
|
|
1651
|
+
private readonly options;
|
|
1652
|
+
constructor(cache: SharedMemoryCache, options: ObjectStoreCacheOptions);
|
|
1653
|
+
get(key: string): Batch | undefined;
|
|
1654
|
+
set(key: string, batch: Batch): void;
|
|
1655
|
+
getVector(key: string): Vector | undefined;
|
|
1656
|
+
setVector(key: string, vector: Vector): boolean;
|
|
1657
|
+
getValue<T>(key: string): T | undefined;
|
|
1658
|
+
setValue<T>(key: string, value: T, bytes: number): void;
|
|
1659
|
+
private shouldAdmitDecodedVector;
|
|
1660
|
+
private shouldAdmitDecodedWorkProduct;
|
|
1661
|
+
}
|
|
1662
|
+
|
|
1169
1663
|
interface ReadParquetOptions {
|
|
1170
1664
|
/** Columns to project; all columns when omitted. */
|
|
1171
1665
|
columns?: string[];
|
|
@@ -1175,14 +1669,33 @@ interface ReadParquetOptions {
|
|
|
1175
1669
|
interface ReadParquetBatchOptions extends ReadParquetOptions {
|
|
1176
1670
|
batchSize?: number;
|
|
1177
1671
|
where?: Expr;
|
|
1672
|
+
stats?: QueryStats;
|
|
1673
|
+
decodedColumnCache?: DecodedColumnCache;
|
|
1674
|
+
decodedColumnCacheKey?: string;
|
|
1178
1675
|
}
|
|
1179
1676
|
interface ParquetRowBatch {
|
|
1180
1677
|
rowOffset: number;
|
|
1181
1678
|
rows: Row[];
|
|
1182
1679
|
}
|
|
1183
|
-
interface
|
|
1184
|
-
|
|
1680
|
+
interface ParquetColumnBatch {
|
|
1681
|
+
rowOffset: number;
|
|
1682
|
+
batch: Batch;
|
|
1683
|
+
residualPredicateSatisfied?: boolean;
|
|
1684
|
+
}
|
|
1685
|
+
type ParquetMetadata = Awaited<ReturnType<typeof parquetMetadataAsync>>;
|
|
1686
|
+
interface StoreAsyncBuffer {
|
|
1687
|
+
byteLength: number;
|
|
1688
|
+
etag?: string;
|
|
1689
|
+
slice(start: number, end?: number): Promise<ArrayBuffer>;
|
|
1690
|
+
}
|
|
1691
|
+
|
|
1692
|
+
interface RangeCacheOptions {
|
|
1693
|
+
maxBytes: number;
|
|
1694
|
+
maxEntryBytes?: number;
|
|
1695
|
+
sharedCache?: SharedMemoryCache;
|
|
1696
|
+
cacheOptions?: ObjectStoreCacheOptions;
|
|
1185
1697
|
}
|
|
1698
|
+
|
|
1186
1699
|
interface PlannedParquetRowGroup {
|
|
1187
1700
|
index: number;
|
|
1188
1701
|
rowStart: number;
|
|
@@ -1199,6 +1712,88 @@ interface ParquetRowGroupPlan {
|
|
|
1199
1712
|
end: number;
|
|
1200
1713
|
}[];
|
|
1201
1714
|
}
|
|
1715
|
+
declare function planRowGroupsFromMetadata(metadata: ParquetMetadata, where: Expr | undefined): ParquetRowGroupPlan;
|
|
1716
|
+
|
|
1717
|
+
interface ScanParquetTaskOptions {
|
|
1718
|
+
batchSize?: number;
|
|
1719
|
+
stats?: QueryStats;
|
|
1720
|
+
metadataCache?: CacheAdapter<ParquetMetadata>;
|
|
1721
|
+
}
|
|
1722
|
+
interface PlanParquetTaskWorkUnitsOptions {
|
|
1723
|
+
maxRowGroupsPerTask?: number;
|
|
1724
|
+
maxRowsPerTask?: number;
|
|
1725
|
+
metadataCache?: CacheAdapter<ParquetMetadata>;
|
|
1726
|
+
}
|
|
1727
|
+
interface AggregateParquetTaskOptions extends ScanParquetTaskOptions {
|
|
1728
|
+
budget?: QueryBudget;
|
|
1729
|
+
}
|
|
1730
|
+
interface AggregateParquetTasksOptions extends AggregateParquetTaskOptions {
|
|
1731
|
+
maxConcurrentTasks?: number;
|
|
1732
|
+
maxBufferedPartials?: number;
|
|
1733
|
+
preserveTaskBoundaries?: boolean;
|
|
1734
|
+
partialBoundary?(partial: VectorAggregateStateSnapshots, task: TaskInput, index: number): VectorAggregateStateSnapshots | Promise<VectorAggregateStateSnapshots>;
|
|
1735
|
+
}
|
|
1736
|
+
interface AggregateParquetGroupTaskOptions extends AggregateParquetTaskOptions {
|
|
1737
|
+
maxGroups?: number;
|
|
1738
|
+
}
|
|
1739
|
+
interface AggregateParquetGroupTasksOptions extends AggregateParquetGroupTaskOptions {
|
|
1740
|
+
maxConcurrentTasks?: number;
|
|
1741
|
+
maxBufferedPartials?: number;
|
|
1742
|
+
preserveTaskBoundaries?: boolean;
|
|
1743
|
+
orderBy?: OrderByTerm[];
|
|
1744
|
+
limit?: number;
|
|
1745
|
+
offset?: number;
|
|
1746
|
+
partialBoundary?(partial: VectorGroupByStateSnapshot, task: TaskInput, index: number): VectorGroupByStateSnapshot | Promise<VectorGroupByStateSnapshot>;
|
|
1747
|
+
}
|
|
1748
|
+
|
|
1749
|
+
declare function aggregateParquetTask(store: ObjectStore, task: TaskInput, spec: AggregateSpec, options?: AggregateParquetTaskOptions): Promise<VectorAggregateStateSnapshots>;
|
|
1750
|
+
declare function aggregateParquetTasks(store: ObjectStore, tasks: TaskInput[], spec: AggregateSpec, options?: AggregateParquetTasksOptions): Promise<Record<string, unknown>>;
|
|
1751
|
+
declare function aggregateParquetGroupTask(store: ObjectStore, task: TaskInput, groupColumns: readonly string[], spec: AggregateSpec, options?: AggregateParquetGroupTaskOptions): Promise<VectorGroupByStateSnapshot>;
|
|
1752
|
+
declare function aggregateParquetGroupTasks(store: ObjectStore, tasks: TaskInput[], groupColumns: readonly string[], spec: AggregateSpec, options?: AggregateParquetGroupTasksOptions): Promise<Row[]>;
|
|
1753
|
+
declare function aggregateParquetGroupTasksBatch(store: ObjectStore, tasks: TaskInput[], groupColumns: readonly string[], spec: AggregateSpec, options?: AggregateParquetGroupTasksOptions): Promise<Batch>;
|
|
1754
|
+
|
|
1755
|
+
/** @internal Exposed for pruning tests; not part of the stable public API. */
|
|
1756
|
+
declare function rowGroupMayMatch(rowGroup: RowGroup, expr: Expr | undefined): boolean;
|
|
1757
|
+
/** @internal Exposed for scan/aggregate tests; not part of the stable public API. */
|
|
1758
|
+
declare function rowGroupMustMatch(rowGroup: RowGroup, expr: Expr | undefined): boolean;
|
|
1759
|
+
|
|
1760
|
+
declare class ParquetScanAdapter implements ScanAdapter {
|
|
1761
|
+
private readonly store;
|
|
1762
|
+
private readonly defaultBatchSize;
|
|
1763
|
+
private readonly metadataCache;
|
|
1764
|
+
private readonly decodedColumnCache;
|
|
1765
|
+
private readonly scanRangeCache;
|
|
1766
|
+
constructor(store: ObjectStore, options?: {
|
|
1767
|
+
batchSize?: number;
|
|
1768
|
+
metadataCache?: CacheAdapter<ParquetMetadata>;
|
|
1769
|
+
decodedColumnCache?: DecodedColumnCache;
|
|
1770
|
+
scanRangeCache?: RangeCacheOptions;
|
|
1771
|
+
});
|
|
1772
|
+
scan(path: string, options: ScanOptions): AsyncIterable<Row[]>;
|
|
1773
|
+
scanColumns(path: string, options: ScanOptions): AsyncIterable<Batch>;
|
|
1774
|
+
scanColumnBatches(path: string, options: ScanOptions): AsyncIterable<ScanColumnBatch>;
|
|
1775
|
+
scanVectorBatches(path: string, options: ScanOptions): AsyncIterable<ScanVectorBatch>;
|
|
1776
|
+
planTask(path: string, options: ScanTaskPlanOptions): Promise<ScanTaskPlan>;
|
|
1777
|
+
private metadata;
|
|
1778
|
+
private scanBuffer;
|
|
1779
|
+
}
|
|
1780
|
+
|
|
1781
|
+
declare function rejectUnsupportedParquetSchema(metadata: ParquetMetadata): void;
|
|
1782
|
+
|
|
1783
|
+
/**
|
|
1784
|
+
* Bridge an ObjectStore path to hyparquet's AsyncBuffer (length + ranged slice).
|
|
1785
|
+
*/
|
|
1786
|
+
declare function asyncBufferFromStore(store: ObjectStore, path: string, options?: ScanOptions | undefined): Promise<StoreAsyncBuffer>;
|
|
1787
|
+
|
|
1788
|
+
declare function scanParquetTaskBatches(store: ObjectStore, task: TaskInput, options?: ScanParquetTaskOptions): AsyncIterable<Row[]>;
|
|
1789
|
+
declare function scanParquetTaskColumnBatches(store: ObjectStore, task: TaskInput, options?: ScanParquetTaskOptions): AsyncIterable<ParquetColumnBatch>;
|
|
1790
|
+
declare function planParquetTaskWorkUnits(store: ObjectStore, task: TaskInput, options: PlanParquetTaskWorkUnitsOptions): Promise<TaskInput[]>;
|
|
1791
|
+
/** Read Parquet footer metadata (row groups, schema, stats). */
|
|
1792
|
+
declare function readParquetMetadata(store: ObjectStore, path: string, metadataCache?: ScanParquetTaskOptions["metadataCache"]): Promise<ParquetMetadata>;
|
|
1793
|
+
|
|
1794
|
+
interface PlanParquetRowGroupsOptions {
|
|
1795
|
+
where?: Expr;
|
|
1796
|
+
}
|
|
1202
1797
|
type IcebergParquetDeleteFileContent = "position-delete" | "equality-delete" | "deletion-vector";
|
|
1203
1798
|
interface IcebergParquetDeleteFile {
|
|
1204
1799
|
content: IcebergParquetDeleteFileContent;
|
|
@@ -1282,26 +1877,13 @@ interface PartitionedParquetOutputEntryOptions {
|
|
|
1282
1877
|
}
|
|
1283
1878
|
interface ParquetLakeConfig extends Omit<LakeConfig, "scanner"> {
|
|
1284
1879
|
batchSize?: number;
|
|
1880
|
+
cache?: ObjectStoreCacheOptions;
|
|
1285
1881
|
metadataCache?: CacheAdapter<ParquetMetadata>;
|
|
1882
|
+
scanRangeCache?: RangeCacheOptions;
|
|
1286
1883
|
}
|
|
1287
|
-
type ParquetMetadata = Awaited<ReturnType<typeof parquetMetadataAsync>>;
|
|
1288
|
-
interface StoreAsyncBuffer {
|
|
1289
|
-
byteLength: number;
|
|
1290
|
-
etag?: string;
|
|
1291
|
-
slice(start: number, end?: number): Promise<ArrayBuffer>;
|
|
1292
|
-
}
|
|
1293
|
-
/**
|
|
1294
|
-
* Bridge an ObjectStore path to hyparquet's AsyncBuffer (length + ranged slice).
|
|
1295
|
-
*/
|
|
1296
|
-
declare function asyncBufferFromStore(store: ObjectStore, path: string, options?: ScanOptions | undefined): Promise<StoreAsyncBuffer>;
|
|
1297
|
-
/**
|
|
1298
|
-
* Read rows from a Parquet object. Early scaffold: full planner-driven
|
|
1299
|
-
* row-group pruning and batch streaming land in phase 1-2 (see BUILD_PLAN.md).
|
|
1300
|
-
*/
|
|
1301
1884
|
declare function readParquetObjects(store: ObjectStore, path: string, options?: ReadParquetOptions): Promise<Record<string, unknown>[]>;
|
|
1302
1885
|
declare function readParquetObjectBatches(store: ObjectStore, path: string, options?: ReadParquetBatchOptions): AsyncIterable<ParquetRowBatch>;
|
|
1303
|
-
|
|
1304
|
-
declare function readParquetMetadata(store: ObjectStore, path: string): Promise<hyparquet_src_types_js.FileMetaData>;
|
|
1886
|
+
declare function readParquetColumnBatches(store: ObjectStore, path: string, options?: ReadParquetBatchOptions): AsyncIterable<ParquetColumnBatch>;
|
|
1305
1887
|
declare function planRowGroups(store: ObjectStore, path: string, options?: PlanParquetRowGroupsOptions): Promise<ParquetRowGroupPlan>;
|
|
1306
1888
|
declare function readIcebergParquetDeletes(store: ObjectStore, deleteFile: IcebergParquetDeleteFile): Promise<DecodedIcebergParquetDeletes>;
|
|
1307
1889
|
declare function writeParquet(store: ObjectStore, path: string, options: WriteParquetOptions): Promise<{
|
|
@@ -1313,27 +1895,12 @@ declare function writePartitionedParquet(store: ObjectStore, prefix: string, opt
|
|
|
1313
1895
|
declare function writePartitionedParquetTask(store: ObjectStore, prefix: string, options: WritePartitionedParquetTaskOptions): Promise<WritePartitionedParquetTaskResult>;
|
|
1314
1896
|
declare function createParquetTableAs(store: ObjectStore, prefix: string, options: CreateParquetTableAsOptions): Promise<CreateParquetTableAsResult>;
|
|
1315
1897
|
declare function partitionedParquetOutputEntries(result: WritePartitionedParquetResult, options: PartitionedParquetOutputEntryOptions): OutputManifestEntry[];
|
|
1316
|
-
declare class ParquetScanAdapter implements ScanAdapter {
|
|
1317
|
-
private readonly store;
|
|
1318
|
-
private readonly defaultBatchSize;
|
|
1319
|
-
private readonly metadataCache;
|
|
1320
|
-
constructor(store: ObjectStore, options?: {
|
|
1321
|
-
batchSize?: number;
|
|
1322
|
-
metadataCache?: CacheAdapter<ParquetMetadata>;
|
|
1323
|
-
});
|
|
1324
|
-
scan(path: string, options: ScanOptions): AsyncIterable<Row[]>;
|
|
1325
|
-
planTask(path: string, options: ScanTaskPlanOptions): Promise<ScanTaskPlan>;
|
|
1326
|
-
private metadata;
|
|
1327
|
-
}
|
|
1328
|
-
declare function planRowGroupsFromMetadata(metadata: ParquetMetadata, where: Expr | undefined): ParquetRowGroupPlan;
|
|
1329
|
-
declare function rejectUnsupportedParquetSchema(metadata: ParquetMetadata): void;
|
|
1330
1898
|
type InsertValue = string | number | boolean | bigint | null;
|
|
1331
1899
|
type ComparableInsertValue = string | number | bigint;
|
|
1332
|
-
/** @internal Exposed for pruning tests; not part of the stable public API. */
|
|
1333
|
-
declare function rowGroupMayMatch(rowGroup: RowGroup, expr: Expr | undefined): boolean;
|
|
1334
1900
|
declare function parquetScanner(store: ObjectStore, options?: {
|
|
1335
1901
|
batchSize?: number;
|
|
1336
1902
|
metadataCache?: CacheAdapter<ParquetMetadata>;
|
|
1903
|
+
decodedColumnCache?: DecodedColumnCache;
|
|
1337
1904
|
}): ScanAdapter;
|
|
1338
1905
|
declare function createParquetLake(config: ParquetLakeConfig): Lake;
|
|
1339
1906
|
|
|
@@ -1383,4 +1950,4 @@ declare function planFiles(table: EngineTable, options?: PlanIcebergFilesOptions
|
|
|
1383
1950
|
declare function scanBatches(plan: EngineFilePlan, options?: ScanEngineOptions): AsyncIterable<ScanBatch>;
|
|
1384
1951
|
declare function scanRows(plan: EngineFilePlan, options?: ScanEngineOptions): AsyncIterable<Row>;
|
|
1385
1952
|
|
|
1386
|
-
export { type AggregateExpr, type AggregateGroupSnapshot, type AggregateOp, type AggregateOperatorState, type AggregateOptions, type AggregateResult, type AggregateSnapshotValue, type AggregateSpec, type AggregateStateSnapshot, AggregationBuilder, type ApplyIcebergDeletesOptions, type BBoxIndex, type BetweenExpr, type Bookmark, type BookmarkInit, type BookmarkPosition, type BookmarkQuery, type BroadcastJoinOptions, type CacheAdapter, CacheApiCache, type CacheApiCacheOptions, type CacheEntry, type CallExpr, type CheckpointAdapter, type CheckpointStore, type Clock, type ColumnExpr, type ColumnInput, type CompareExpr, type CompareOp, type ConditionalObjectStore, type ConditionalPutOptions, type CreateParquetTableAsOptions, type CreateParquetTableAsQuery, type CreateParquetTableAsResult, type CsvStreamOptions, type DecodedIcebergDeletes, type DecodedIcebergParquetDeletes, ERROR_CODES, type EngineFilePlan, type EngineTable, type ErrorDetails, type ExplainJson, type ExplainResult, type Expr, type IcebergAppendFile, type IcebergAppendOptions, type IcebergAppendOutputManifestOptions, type IcebergAppendResult, type IcebergCatalog, type IcebergCommitCatalog, type IcebergCommitInput, type IcebergCommitResult, type IcebergDeleteFile, type IcebergDeletionVector, type IcebergEnginePlan, type IcebergEngineTable, type IcebergEqualityDelete, type IcebergField, type IcebergGlueCatalogOptions, type IcebergNessieCatalogOptions, type IcebergParquetDeleteFile, type IcebergParquetDeleteFileContent, type IcebergPartitionField, type IcebergPartitionSpec, type IcebergPlan, type IcebergPositionDelete, type IcebergReadMode, IcebergRestCatalog, type IcebergRestCatalogOptions, type IcebergRowBatch, type IcebergSortOrder, IcebergTable, type IcebergTableIdentifier, IcebergUnsupportedCatalog, type IdGenerator, type InExpr, type IndexPruneResult, type IndexValue, type InsertValidationRules, type JoinType, type JsonExpr, type JsonOrderByTerm, type JsonQueryV1,
|
|
1953
|
+
export { type AggregateExpr, type AggregateGroupSnapshot, type AggregateOp, type AggregateOperatorState, type AggregateOptions, type AggregateParquetGroupTaskOptions, type AggregateParquetGroupTasksOptions, type AggregateParquetTaskOptions, type AggregateParquetTasksOptions, type AggregateResult, type AggregateSnapshotValue, type AggregateSpec, type AggregateStateSnapshot, AggregationBuilder, type ApplyIcebergDeletesOptions, type ArithmeticExpr, type BBox, type BBoxIndex, type Batch, type BatchExprValues, type BetweenExpr, type Bookmark, type BookmarkInit, type BookmarkPosition, type BookmarkQuery, type BroadcastJoinOptions, type CacheAdapter, CacheApiCache, type CacheApiCacheOptions, type CacheEntry, type CachePolicy, type CallExpr, type CaseExpr, type CaseWhenExpr, type CheckpointAdapter, type CheckpointStore, type Clock, type ColumnExpr, type ColumnInput, type CompareExpr, type CompareOp, type ConditionalObjectStore, type ConditionalPutOptions, type CreateParquetTableAsOptions, type CreateParquetTableAsQuery, type CreateParquetTableAsResult, type CsvStreamOptions, type DecodedIcebergDeletes, type DecodedIcebergParquetDeletes, ERROR_CODES, type EngineFilePlan, type EngineTable, type ErrorDetails, type ExplainJson, type ExplainResult, type Expr, type GeoBackend, type GeoJsonGeometry, type IcebergAppendFile, type IcebergAppendOptions, type IcebergAppendOutputManifestOptions, type IcebergAppendResult, type IcebergCatalog, type IcebergCommitCatalog, type IcebergCommitInput, type IcebergCommitResult, type IcebergDeleteFile, type IcebergDeletionVector, type IcebergEnginePlan, type IcebergEngineTable, type IcebergEqualityDelete, type IcebergField, type IcebergGlueCatalogOptions, type IcebergNessieCatalogOptions, type IcebergParquetDeleteFile, type IcebergParquetDeleteFileContent, type IcebergPartitionField, type IcebergPartitionSpec, type IcebergPlan, type IcebergPositionDelete, type IcebergReadMode, IcebergRestCatalog, type IcebergRestCatalogOptions, type IcebergRowBatch, type IcebergSortOrder, IcebergTable, type IcebergTableIdentifier, IcebergUnsupportedCatalog, type IdGenerator, type InExpr, type InMemoryLakeOptions, InMemoryRowsScanner, InMemoryRowsStore, type InMemoryTableOptions, type IndexPruneResult, type IndexValue, type InsertValidationRules, type JoinKey, type JoinType, type JsonExpr, type JsonOrderByTerm, type JsonQueryV1, Lake, type LakeConfig, LakeqlError, type LakeqlErrorCode, type LikeExpr, type ListOptions, type LiteralExpr, type LoadIcebergEngineTableOptions, type LoadIcebergTableFromObjectStoreOptions, type LoadIcebergTableFromRestOptions, type LoadIcebergTableOptions, type LoadParquetEngineTableOptions, type LoadTableOptions, type LockAdapter, type LogHook, type LogicalExpr, type LookupJoinFunction, type LookupJoinOptions, type Manifest, type ManifestDeleteFile, type ManifestFile, MemoryCache, MemoryCheckpointAdapter, MemoryObjectStore, MemorySpillAdapter, type MemorySpillAdapterOptions, type MetadataFile, type MetricsHook, type MinMaxColumnIndex, type NotExpr, type NullCheckExpr, type ObjectHead, type ObjectInfo, type ObjectStore, type ObjectStoreCacheOptions, ObjectStoreIcebergCommitCatalog, type ObjectStoreReadControls, type OperatorSnapshotValue, type OrderByTerm, type OutputManifest, type OutputManifestEntry, PACKAGE, type ParquetColumnBatch, type ParquetEnginePlan, type ParquetEngineTable, type ParquetLakeConfig, type ParquetMetadata, type ParquetRowBatch, type ParquetRowGroupPlan, ParquetScanAdapter, type PartitionedParquetOutputEntryOptions, type PathQueryInit, type PlanIcebergFilesOptions, type PlanParquetRowGroupsOptions, type PlanParquetTaskWorkUnitsOptions, type PlannedIcebergFile, type PlannedParquetRowGroup, type PredicatePlan, type PredicatePlanOptions, type ProjectIcebergRowOptions, type PutOptions, type QueryBudget, QueryBuilder, type QueryPolicy, type QueryPolicyContext, QueryResult, type QueryRunOptions, type QueryStats, type QueueAdapter, type ReadParquetBatchOptions, type ReadParquetOptions, type ResumableBatchOptions, ResumedQuery, type Row, type RuntimeSubstrate, type Scalar, type ScanAdapter, type ScanBatch, type ScanColumnBatch, type ScanEngineOptions, type ScanOptions, type ScanParquetTaskOptions, type ScanPlannedIcebergRowsOptions, type ScanTaskPlan, type ScanTaskPlanOptions, type ScanVectorBatch, type Selection, type SharedCacheEntry, type SharedCacheSetOptions, SharedMemoryCache, type SidecarFileIndex, type SliceOptions, type SliceResult, type Snapshot, type SortOperatorState, type SortOptions, type SortResult, type SortRunState, type SpillAdapter, type SpillRef, type SpillUsage, type SqlBoolean, type TaskCheckpoint, type TaskInput, type TaskManifest, type TaskManifestTask, type TaskState, type TaskTransitionInput, type TimestampUnit, TimestampValue, type TopKOperatorState, type TopKOptions, type TopKResult, type ValueInput, type Vector, type VectorAggregateOptions, type VectorAggregateSnapshotValue, type VectorAggregateState, type VectorAggregateStateSnapshot, type VectorAggregateStateSnapshots, type VectorAggregateStates, type VectorAggregateValue, type VectorGroup, type VectorGroupByGroupSnapshot, type VectorGroupByOptions, type VectorGroupBySnapshotValue, type VectorGroupByState, type VectorGroupByStateSnapshot, type VectorHashJoinOptions, type VectorProjectionSpec, type VectorTopKOptions, type WorkUnitFanInOptions, type WriteParquetOptions, type WriteParquetRowsOptions, type WritePartitionedParquetFile, type WritePartitionedParquetResult, type WritePartitionedParquetTaskOptions, type WritePartitionedParquetTaskResult, add, advanceTaskCheckpoint, aggregateParquetGroupTask, aggregateParquetGroupTasks, aggregateParquetGroupTasksBatch, aggregateParquetTask, aggregateParquetTasks, and, applyIcebergDeletes, assertBookmarkMatches, asyncBufferFromStore, batchExprValues, batchFromColumns, batchFromVectors, bboxIntersects, bboxMayIntersect, between, broadcastJoin, buildBBoxIndex, buildMinMaxIndex, cacheApiCache, cachedObjectStore, classifyPredicate, col, compareTimestampValues, concatBatches, createBookmark, createInMemoryLake, createParquetLake as createLake, createOutputManifest, createOutputManifestFromCheckpoints, createParquetLake, createParquetTableAs, createTaskManifest, createVectorAggregateStates, createVectorGroupByState, deserializeAggregateOperatorState, deserializeSortOperatorState, deserializeTopKOperatorState, div, encodeJsonLine, enforceVectorGroupByBudget, ensureGeoBackendForExprs, envelopeFromGeometry, envelopeOf, eq, evaluate, fanInWorkUnits, finalizeVectorAggregateStates, finalizeVectorGroupByBatch, finalizeVectorGroupByRows, fingerprint, fn, gatherBatch, getOrCreateVectorGroup, gt, gte, icebergGlueCatalog, icebergNessieCatalog, icebergRestCatalog, ilike, inMemoryRowsScanner, isIn, isLakeqlError, isNotNull, isNull, isTimestampValue, jsonSafeValue, jsonWorkUnitBoundary, like, lit, loadGeoBackend, loadIcebergTable, loadIcebergTableFromObjectStore, loadIcebergTableFromRest, loadTable, lookupJoin, lt, lte, matches, materializeBatchRows, materializeSelectedBatchRows, memoryCache, memoryCheckpointAdapter, memorySpillAdapter, memoryStore, mergeVectorAggregateStateSnapshots, mergeVectorAggregateStates, mergeVectorGroupByStates, mod, mul, ne, not, notIn, or, parquetScanner, parseGeometry, parseHivePartitions, parseJsonQuery, partitionedParquetOutputEntries, planFiles, planParquetTaskWorkUnits, planRowGroups, planRowGroupsFromMetadata, predicateSelection, pruneFilesWithIndex, readControlSignal, readIcebergParquetDeletes, readOutputManifest, readParquetColumnBatches, readParquetMetadata, readParquetObjectBatches, readParquetObjects, rejectUnsupportedParquetSchema, requireGeoBackend, restoreVectorAggregateStates, restoreVectorGroupByState, rowGroupMayMatch, rowGroupMustMatch, scalarVectorValue, scanBatches, scanParquetTaskBatches, scanParquetTaskColumnBatches, scanPlannedIcebergRows, scanRows, selectedRowCount, selectedRowIndices, serializeAggregateOperatorState, serializeSortOperatorState, serializeTopKOperatorState, setGeoBackend, signPaginationToken, snapshotVectorAggregateStates, snapshotVectorGroupByState, stableStringify, sub, throwIfAborted, timestampEpochForUnit, timestampFromEpoch, timestampToIsoString, timestampValueFromIso, toGeometry, transitionTaskCheckpoint, tryPredicateSelection, updateVectorAggregateStateValue, updateVectorAggregateStates, updateVectorGroupAggregateValue, updateVectorGroupByState, vectorAggregateBatch, vectorFromValues, vectorGroupByBatch, vectorHashJoin, vectorLength, vectorOrderByBatch, vectorProjectBatch, vectorSortIndices, vectorTopKBatch, vectorTopKIndices, vectorValue, verifyPaginationToken, withObjectStoreReadControls, writeOutputManifest, writeParquet, writePartitionedParquet, writePartitionedParquetTask };
|