lakeql 0.1.7 → 0.1.8
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/dist/bin.js +1 -1
- package/dist/{chunk-BFLGC6Y5.js → chunk-5K5JMJ2M.js} +396 -70
- package/dist/{chunk-RZL45ZSN.js → chunk-MXGEAVHL.js} +363 -16
- package/dist/cloudflare.d.ts +20 -3
- package/dist/cloudflare.js +102 -3
- package/dist/index.d.ts +83 -7
- package/dist/index.js +2 -2
- package/dist/node.d.ts +28 -5
- package/dist/node.js +175 -19
- package/package.json +10 -8
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { LakeqlError, TimestampValue, isTimestampValue, timestampEpochForUnit, compareTimestampValues, timestampValueFromIso, matches, ensureGeoBackendForExprs, encodeJsonLine, jsonSafeValue, evaluate, timestampFromEpoch, requireGeoBackend, regexpReplaceValue, regexpMatchesValue, toGeometry, parseGeometry, envelopeOf, envelopeFromGeometry, bboxIntersects } from './chunk-TFD5RFKB.js';
|
|
2
2
|
import { parquetReadObjects, parquetMetadataAsync, parquetSchema, parquetRead } from 'hyparquet';
|
|
3
3
|
import { getSchemaPath, isFlatColumn } from 'hyparquet/src/schema.js';
|
|
4
|
+
import { decompress } from 'fzstd';
|
|
4
5
|
import { DEFAULT_PARSERS, convert, convertWithDictionary } from 'hyparquet/src/convert.js';
|
|
5
6
|
import { Encodings, PageTypes } from 'hyparquet/src/constants.js';
|
|
6
7
|
import { decompressPage, readDataPage, readDataPageV2 } from 'hyparquet/src/datapage.js';
|
|
@@ -4601,6 +4602,8 @@ var QueryResult = class {
|
|
|
4601
4602
|
now: config.now,
|
|
4602
4603
|
startedAt
|
|
4603
4604
|
};
|
|
4605
|
+
if (config.limit !== void 0)
|
|
4606
|
+
scanOptions.canStopEarly = true;
|
|
4604
4607
|
const partitionValues = config.hive ? parseHivePartitions(object.path) : {};
|
|
4605
4608
|
const physicalColumns = readColumns?.filter((column) => !(column in partitionValues));
|
|
4606
4609
|
if (physicalColumns !== void 0 && physicalColumns.length > 0) {
|
|
@@ -4655,6 +4658,8 @@ var QueryResult = class {
|
|
|
4655
4658
|
now: config.now,
|
|
4656
4659
|
startedAt
|
|
4657
4660
|
};
|
|
4661
|
+
if (config.limit !== void 0)
|
|
4662
|
+
scanOptions.canStopEarly = true;
|
|
4658
4663
|
const partitionValues = config.hive ? parseHivePartitions(object.path) : {};
|
|
4659
4664
|
const physicalColumns = columns?.filter((column) => !(column in partitionValues));
|
|
4660
4665
|
if (physicalColumns !== void 0 && physicalColumns.length > 0) {
|
|
@@ -4711,6 +4716,11 @@ var QueryResult = class {
|
|
|
4711
4716
|
const scanVectorBatches = config.scanner.scanVectorBatches;
|
|
4712
4717
|
if (scanVectorBatches === void 0)
|
|
4713
4718
|
return;
|
|
4719
|
+
const lateMaterialized = await this.lateMaterializedLimitRows(startedAt);
|
|
4720
|
+
if (lateMaterialized !== void 0) {
|
|
4721
|
+
yield* rowsAsBatches(lateMaterialized, config.batchSize ?? 4096);
|
|
4722
|
+
return;
|
|
4723
|
+
}
|
|
4714
4724
|
let offsetSkipped = 0;
|
|
4715
4725
|
let returned = 0;
|
|
4716
4726
|
const { planned: paths, skipped: skippedFiles } = await this.planObjects();
|
|
@@ -4728,6 +4738,8 @@ var QueryResult = class {
|
|
|
4728
4738
|
now: config.now,
|
|
4729
4739
|
startedAt
|
|
4730
4740
|
};
|
|
4741
|
+
if (config.limit !== void 0)
|
|
4742
|
+
scanOptions.canStopEarly = true;
|
|
4731
4743
|
if (columns !== void 0 && columns.length > 0)
|
|
4732
4744
|
scanOptions.columns = columns;
|
|
4733
4745
|
if (config.where !== void 0)
|
|
@@ -4763,6 +4775,70 @@ var QueryResult = class {
|
|
|
4763
4775
|
stats.elapsedMs = config.now() - startedAt;
|
|
4764
4776
|
config.metrics?.timing("lakeql.query.elapsed", stats.elapsedMs, { queryId: stats.queryId });
|
|
4765
4777
|
}
|
|
4778
|
+
async lateMaterializedLimitRows(startedAt) {
|
|
4779
|
+
const config = this.config;
|
|
4780
|
+
if (config.limit === void 0 || config.where === void 0 || config.select === void 0 || config.scanner.scanVectorBatches === void 0 || !vectorExprSupported(config.where) || !Object.values(config.projections ?? {}).every(vectorExprSupported)) {
|
|
4781
|
+
return void 0;
|
|
4782
|
+
}
|
|
4783
|
+
const predicateColumns = predicateReadColumns(config.where);
|
|
4784
|
+
const outputColumns = outputReadColumns(config.select, config.projections);
|
|
4785
|
+
if (predicateColumns.length === 0 || outputColumns.length === 0)
|
|
4786
|
+
return void 0;
|
|
4787
|
+
const lateColumns = outputColumns.filter((column) => !predicateColumns.includes(column));
|
|
4788
|
+
if (lateColumns.length === 0)
|
|
4789
|
+
return void 0;
|
|
4790
|
+
const refs = [];
|
|
4791
|
+
const maxRefs = (config.offset ?? 0) + config.limit;
|
|
4792
|
+
const scanVectorBatches = config.scanner.scanVectorBatches;
|
|
4793
|
+
const { planned: paths, skipped: skippedFiles } = await this.planObjects();
|
|
4794
|
+
this.stats.filesSkipped = skippedFiles;
|
|
4795
|
+
for (const object of paths) {
|
|
4796
|
+
this.stats.filesPlanned += 1;
|
|
4797
|
+
this.stats.filesRead += 1;
|
|
4798
|
+
this.stats.bytesRequested += object.size;
|
|
4799
|
+
enforceBudget(config.budget, this.stats, config.now, startedAt);
|
|
4800
|
+
const scanOptions = {
|
|
4801
|
+
columns: predicateColumns,
|
|
4802
|
+
where: config.where,
|
|
4803
|
+
canStopEarly: true,
|
|
4804
|
+
batchSize: columnarBatchSize(config.batchSize),
|
|
4805
|
+
stats: this.stats,
|
|
4806
|
+
budget: config.budget,
|
|
4807
|
+
now: config.now,
|
|
4808
|
+
startedAt
|
|
4809
|
+
};
|
|
4810
|
+
for await (const { rowOffset, batch } of scanVectorBatches.call(config.scanner, object.path, scanOptions)) {
|
|
4811
|
+
const selection = predicateSelection(batch, config.where);
|
|
4812
|
+
const selected = [...selectedRowIndices(batch.rowCount, selection)];
|
|
4813
|
+
this.stats.rowsMatched += selected.length;
|
|
4814
|
+
for (const index of selected) {
|
|
4815
|
+
refs.push({
|
|
4816
|
+
path: object.path,
|
|
4817
|
+
rowIndex: rowOffset + index,
|
|
4818
|
+
keys: rankKeyRow(batch, index, predicateColumns)
|
|
4819
|
+
});
|
|
4820
|
+
enforceBufferedRowsBudget(config.budget, refs.length);
|
|
4821
|
+
enforceOperatorMemoryBudget(config.budget, estimateOperatorMemoryBytes(refs));
|
|
4822
|
+
if (refs.length >= maxRefs)
|
|
4823
|
+
break;
|
|
4824
|
+
}
|
|
4825
|
+
enforceBudget(config.budget, this.stats, config.now, startedAt);
|
|
4826
|
+
if (refs.length >= maxRefs)
|
|
4827
|
+
break;
|
|
4828
|
+
}
|
|
4829
|
+
if (refs.length >= maxRefs)
|
|
4830
|
+
break;
|
|
4831
|
+
}
|
|
4832
|
+
const selectedRefs = refs.slice(config.offset ?? 0, maxRefs);
|
|
4833
|
+
const rowsByRef = await this.materializeRowRefs(selectedRefs, outputColumns, predicateColumns, startedAt, config.batchSize ?? 4096);
|
|
4834
|
+
const rows = selectedRefs.map((ref) => rowsByRef.get(rowRefKey(ref))).filter((row) => row !== void 0).map((row) => project(row, config.select, config.projections));
|
|
4835
|
+
for (const _row of rows) {
|
|
4836
|
+
this.stats.rowsReturned += 1;
|
|
4837
|
+
enforceBudget(config.budget, this.stats, config.now, startedAt);
|
|
4838
|
+
}
|
|
4839
|
+
this.stats.elapsedMs = config.now() - startedAt;
|
|
4840
|
+
return rows;
|
|
4841
|
+
}
|
|
4766
4842
|
async toArray() {
|
|
4767
4843
|
const rows = [];
|
|
4768
4844
|
for await (const row of this.rows())
|
|
@@ -5243,7 +5319,7 @@ var QueryResult = class {
|
|
|
5243
5319
|
this.stats.elapsedMs = config.now() - startedAt;
|
|
5244
5320
|
return rows.map((row) => project(row, config.select, void 0));
|
|
5245
5321
|
}
|
|
5246
|
-
async materializeRowRefs(refs, columns, rankColumns, startedAt) {
|
|
5322
|
+
async materializeRowRefs(refs, columns, rankColumns, startedAt, maxWindowRows = columnarBatchSize(this.config.batchSize)) {
|
|
5247
5323
|
const scanVectorBatches = vectorBatchScanner(this.config.scanner);
|
|
5248
5324
|
if (scanVectorBatches === void 0)
|
|
5249
5325
|
return /* @__PURE__ */ new Map();
|
|
@@ -5253,7 +5329,7 @@ var QueryResult = class {
|
|
|
5253
5329
|
const lateColumns = columns.filter((column) => !rankColumns.includes(column));
|
|
5254
5330
|
if (lateColumns.length === 0)
|
|
5255
5331
|
return rows;
|
|
5256
|
-
for (const window of materializationWindows(refs,
|
|
5332
|
+
for (const window of materializationWindows(refs, maxWindowRows)) {
|
|
5257
5333
|
const scanOptions = {
|
|
5258
5334
|
columns: lateColumns,
|
|
5259
5335
|
rowStart: window.rowStart,
|
|
@@ -6701,6 +6777,24 @@ function projectedReadColumns(select, where, orderBy = void 0, projections = voi
|
|
|
6701
6777
|
collectExprColumns(where, columns);
|
|
6702
6778
|
return columns.size === 0 ? void 0 : [...columns].sort();
|
|
6703
6779
|
}
|
|
6780
|
+
function predicateReadColumns(where) {
|
|
6781
|
+
const columns = /* @__PURE__ */ new Set();
|
|
6782
|
+
collectExprColumns(where, columns);
|
|
6783
|
+
return [...columns].sort();
|
|
6784
|
+
}
|
|
6785
|
+
function outputReadColumns(select, projections) {
|
|
6786
|
+
const columns = /* @__PURE__ */ new Set();
|
|
6787
|
+
for (const column of select)
|
|
6788
|
+
columns.add(column);
|
|
6789
|
+
for (const expr of Object.values(projections ?? {}))
|
|
6790
|
+
collectExprColumns(expr, columns);
|
|
6791
|
+
return [...columns].sort();
|
|
6792
|
+
}
|
|
6793
|
+
async function* rowsAsBatches(rows, batchSize) {
|
|
6794
|
+
for (let index = 0; index < rows.length; index += batchSize) {
|
|
6795
|
+
yield rows.slice(index, index + batchSize);
|
|
6796
|
+
}
|
|
6797
|
+
}
|
|
6704
6798
|
function aggregateReadColumns(groupColumns, spec, where) {
|
|
6705
6799
|
const columns = /* @__PURE__ */ new Set();
|
|
6706
6800
|
for (const column of groupColumns)
|
|
@@ -7807,6 +7901,39 @@ function copyBytes2(data) {
|
|
|
7807
7901
|
}
|
|
7808
7902
|
|
|
7809
7903
|
// ../core/dist/store.js
|
|
7904
|
+
function uriObjectStore(store, authorities) {
|
|
7905
|
+
const mappings = (Array.isArray(authorities) ? authorities : [authorities]).map(normalizeUriAuthority);
|
|
7906
|
+
const wrapped = {
|
|
7907
|
+
async get(path) {
|
|
7908
|
+
return await store.get(normalizeObjectStorePath(path, mappings));
|
|
7909
|
+
},
|
|
7910
|
+
async getRange(path, range) {
|
|
7911
|
+
return await store.getRange(normalizeObjectStorePath(path, mappings), range);
|
|
7912
|
+
},
|
|
7913
|
+
async put(path, body, options) {
|
|
7914
|
+
return await store.put(normalizeObjectStorePath(path, mappings), body, options);
|
|
7915
|
+
},
|
|
7916
|
+
async delete(path) {
|
|
7917
|
+
return await store.delete(normalizeObjectStorePath(path, mappings));
|
|
7918
|
+
},
|
|
7919
|
+
async *list(prefix, options) {
|
|
7920
|
+
yield* store.list(normalizeObjectStorePath(prefix, mappings), options);
|
|
7921
|
+
},
|
|
7922
|
+
async head(path) {
|
|
7923
|
+
return await store.head(normalizeObjectStorePath(path, mappings));
|
|
7924
|
+
}
|
|
7925
|
+
};
|
|
7926
|
+
if (isConditionalObjectStore(store)) {
|
|
7927
|
+
const conditional = {
|
|
7928
|
+
...wrapped,
|
|
7929
|
+
async conditionalPut(path, body, options) {
|
|
7930
|
+
return await store.conditionalPut(normalizeObjectStorePath(path, mappings), body, options);
|
|
7931
|
+
}
|
|
7932
|
+
};
|
|
7933
|
+
return conditional;
|
|
7934
|
+
}
|
|
7935
|
+
return wrapped;
|
|
7936
|
+
}
|
|
7810
7937
|
function withObjectStoreReadControls(store, controls) {
|
|
7811
7938
|
if (controls.maxConcurrentReads === void 0 && controls.signal === void 0 && controls.maxElapsedMs === void 0) {
|
|
7812
7939
|
return store;
|
|
@@ -7876,6 +8003,97 @@ async function controlledRead(controls, semaphore, read) {
|
|
|
7876
8003
|
release?.();
|
|
7877
8004
|
}
|
|
7878
8005
|
}
|
|
8006
|
+
function normalizeUriAuthority(mapping) {
|
|
8007
|
+
const scheme = requiredUriPart(mapping.scheme, "scheme").toLowerCase();
|
|
8008
|
+
const authority = requiredUriPart(mapping.authority, "authority");
|
|
8009
|
+
const prefix = trimSlashes(mapping.prefix ?? "");
|
|
8010
|
+
return { scheme, authority, prefix };
|
|
8011
|
+
}
|
|
8012
|
+
function normalizeObjectStorePath(path, mappings) {
|
|
8013
|
+
const maybeUri = absoluteObjectStoreUri(path);
|
|
8014
|
+
if (maybeUri === void 0)
|
|
8015
|
+
return path;
|
|
8016
|
+
const match = mappings.find((mapping) => mapping.scheme === maybeUri.scheme && mapping.authority === maybeUri.authority);
|
|
8017
|
+
if (match === void 0) {
|
|
8018
|
+
throw new LakeqlError("LAKEQL_VALIDATION_ERROR", "Object URI does not match configured store", {
|
|
8019
|
+
path,
|
|
8020
|
+
scheme: maybeUri.scheme,
|
|
8021
|
+
authority: maybeUri.authority,
|
|
8022
|
+
configuredAuthorities: mappings.map((mapping) => `${mapping.scheme}://${mapping.authority}`)
|
|
8023
|
+
});
|
|
8024
|
+
}
|
|
8025
|
+
const key = maybeUri.path;
|
|
8026
|
+
if (match.prefix === "")
|
|
8027
|
+
return key;
|
|
8028
|
+
if (key === match.prefix)
|
|
8029
|
+
return "";
|
|
8030
|
+
const prefix = `${match.prefix}/`;
|
|
8031
|
+
if (key.startsWith(prefix))
|
|
8032
|
+
return key.slice(prefix.length);
|
|
8033
|
+
throw new LakeqlError("LAKEQL_VALIDATION_ERROR", "Object URI is outside configured prefix", {
|
|
8034
|
+
path,
|
|
8035
|
+
prefix: match.prefix
|
|
8036
|
+
});
|
|
8037
|
+
}
|
|
8038
|
+
function absoluteObjectStoreUri(path) {
|
|
8039
|
+
if (!/^[A-Za-z][A-Za-z0-9+.-]*:\/\//u.test(path))
|
|
8040
|
+
return void 0;
|
|
8041
|
+
rejectPathEscape(rawUriPath(path), path);
|
|
8042
|
+
let url;
|
|
8043
|
+
try {
|
|
8044
|
+
url = new URL(path);
|
|
8045
|
+
} catch (cause) {
|
|
8046
|
+
throw new LakeqlError("LAKEQL_VALIDATION_ERROR", "Invalid object URI", { path, cause });
|
|
8047
|
+
}
|
|
8048
|
+
const objectPath = trimLeadingSlash(url.pathname);
|
|
8049
|
+
rejectPathEscape(objectPath, path);
|
|
8050
|
+
return {
|
|
8051
|
+
scheme: url.protocol.slice(0, -1).toLowerCase(),
|
|
8052
|
+
authority: url.host,
|
|
8053
|
+
path: objectPath
|
|
8054
|
+
};
|
|
8055
|
+
}
|
|
8056
|
+
function rejectPathEscape(objectPath, original) {
|
|
8057
|
+
const decoded = objectPath.split("/").map((segment) => {
|
|
8058
|
+
try {
|
|
8059
|
+
return decodeURIComponent(segment);
|
|
8060
|
+
} catch {
|
|
8061
|
+
return segment;
|
|
8062
|
+
}
|
|
8063
|
+
}).join("/");
|
|
8064
|
+
if (decoded === ".." || decoded.startsWith("../") || decoded.includes("/../") || decoded.endsWith("/..")) {
|
|
8065
|
+
throw new LakeqlError("LAKEQL_VALIDATION_ERROR", "Object URI path may not escape its store", {
|
|
8066
|
+
path: original
|
|
8067
|
+
});
|
|
8068
|
+
}
|
|
8069
|
+
}
|
|
8070
|
+
function rawUriPath(uri) {
|
|
8071
|
+
const authorityStart = uri.indexOf("://") + 3;
|
|
8072
|
+
const pathStart = uri.indexOf("/", authorityStart);
|
|
8073
|
+
if (pathStart === -1)
|
|
8074
|
+
return "";
|
|
8075
|
+
const queryStart = uri.indexOf("?", pathStart);
|
|
8076
|
+
const fragmentStart = uri.indexOf("#", pathStart);
|
|
8077
|
+
const endCandidates = [queryStart, fragmentStart].filter((index) => index !== -1);
|
|
8078
|
+
const pathEnd = endCandidates.length === 0 ? uri.length : Math.min(...endCandidates);
|
|
8079
|
+
return trimLeadingSlash(uri.slice(pathStart, pathEnd));
|
|
8080
|
+
}
|
|
8081
|
+
function requiredUriPart(value, name) {
|
|
8082
|
+
const trimmed = value.trim();
|
|
8083
|
+
if (trimmed === "") {
|
|
8084
|
+
throw new LakeqlError("LAKEQL_VALIDATION_ERROR", `Object URI ${name} is required`);
|
|
8085
|
+
}
|
|
8086
|
+
return trimmed;
|
|
8087
|
+
}
|
|
8088
|
+
function trimSlashes(value) {
|
|
8089
|
+
return value.replace(/^\/+/u, "").replace(/\/+$/u, "");
|
|
8090
|
+
}
|
|
8091
|
+
function trimLeadingSlash(value) {
|
|
8092
|
+
return value.replace(/^\/+/u, "");
|
|
8093
|
+
}
|
|
8094
|
+
function isConditionalObjectStore(store) {
|
|
8095
|
+
return typeof store.conditionalPut === "function";
|
|
8096
|
+
}
|
|
7879
8097
|
async function* controlledList(store, prefix, options, controls) {
|
|
7880
8098
|
throwIfAborted(controls.signal);
|
|
7881
8099
|
for await (const object of store.list(prefix, options)) {
|
|
@@ -8365,23 +8583,27 @@ function timestampStatsValue(value) {
|
|
|
8365
8583
|
}
|
|
8366
8584
|
|
|
8367
8585
|
// ../parquet/dist/schema.js
|
|
8368
|
-
function rejectUnsupportedParquetSchema(metadata) {
|
|
8586
|
+
function rejectUnsupportedParquetSchema(metadata, options = {}) {
|
|
8369
8587
|
const schema = metadata.schema;
|
|
8370
8588
|
if (!Array.isArray(schema) || schema.length === 0)
|
|
8371
8589
|
return;
|
|
8590
|
+
const selected = options.columns === void 0 ? void 0 : new Set(options.columns);
|
|
8372
8591
|
const root = schema[0];
|
|
8373
8592
|
const childCount = schemaChildCount(root);
|
|
8374
8593
|
let index = 1;
|
|
8375
8594
|
for (let child = 0; child < childCount && index < schema.length; child += 1) {
|
|
8376
|
-
index = rejectUnsupportedParquetSchemaNode(schema, index, []);
|
|
8595
|
+
index = rejectUnsupportedParquetSchemaNode(schema, index, [], selected);
|
|
8377
8596
|
}
|
|
8378
8597
|
}
|
|
8379
|
-
function rejectUnsupportedParquetSchemaNode(schema, index, path) {
|
|
8598
|
+
function rejectUnsupportedParquetSchemaNode(schema, index, path, selected) {
|
|
8380
8599
|
const element = schema[index];
|
|
8381
8600
|
if (element === void 0)
|
|
8382
8601
|
return index + 1;
|
|
8383
8602
|
const name = String(element.name ?? `field_${index}`);
|
|
8384
8603
|
const nodePath = [...path, name];
|
|
8604
|
+
if (selected !== void 0 && path.length === 0 && !selected.has(name)) {
|
|
8605
|
+
return skipParquetSchemaSubtree(schema, index);
|
|
8606
|
+
}
|
|
8385
8607
|
const childCount = schemaChildCount(element);
|
|
8386
8608
|
rejectUnsupportedParquetLeaf(element, nodePath);
|
|
8387
8609
|
if (childCount === 0)
|
|
@@ -8551,6 +8773,11 @@ function bytesToArrayBuffer2(bytes) {
|
|
|
8551
8773
|
new Uint8Array(out).set(bytes);
|
|
8552
8774
|
return out;
|
|
8553
8775
|
}
|
|
8776
|
+
var lakeqlParquetCompressors = {
|
|
8777
|
+
ZSTD(input, outputLength) {
|
|
8778
|
+
return decompress(input, new Uint8Array(outputLength));
|
|
8779
|
+
}
|
|
8780
|
+
};
|
|
8554
8781
|
|
|
8555
8782
|
// ../parquet/dist/decoded-column-cache.js
|
|
8556
8783
|
var DecodedColumnCache = class {
|
|
@@ -8802,6 +9029,7 @@ async function readParquetColumnBatch(file, metadata, columns, rowStart, rowEnd)
|
|
|
8802
9029
|
columns,
|
|
8803
9030
|
rowStart,
|
|
8804
9031
|
rowEnd,
|
|
9032
|
+
compressors: lakeqlParquetCompressors,
|
|
8805
9033
|
parsers: lakeqlParquetParsers,
|
|
8806
9034
|
onChunk(chunk) {
|
|
8807
9035
|
appendColumnChunk(columnValues, chunk, rowStart, rowEnd);
|
|
@@ -9017,7 +9245,7 @@ async function* readParquetVectorBatchesFromFile(file, metadata, options) {
|
|
|
9017
9245
|
rowGroupStart = rowGroupEnd;
|
|
9018
9246
|
continue;
|
|
9019
9247
|
}
|
|
9020
|
-
const vectorSources = columnVectorSources(file, metadata, rowGroup, columns, rowGroupStart, Math.max(rowGroupStart, requestedStart), Math.min(rowGroupEnd, requestedEnd), options);
|
|
9248
|
+
const vectorSources = columnVectorSources(file, metadata, rowGroup, columns, rowGroupStart, rowGroupEnd, Math.max(rowGroupStart, requestedStart), Math.min(rowGroupEnd, requestedEnd), options);
|
|
9021
9249
|
if (vectorSources === void 0)
|
|
9022
9250
|
return;
|
|
9023
9251
|
recordRowGroupRead(options.stats);
|
|
@@ -9110,14 +9338,14 @@ function canRepresentDirectVectorLeaf(leaf) {
|
|
|
9110
9338
|
function usesDictionaryEncoding(column) {
|
|
9111
9339
|
return column.encodings?.some(isDictionaryEncoding) === true || column.encoding_stats?.some((stats) => isDictionaryEncoding(stats.encoding)) === true;
|
|
9112
9340
|
}
|
|
9113
|
-
function columnVectorSources(file, metadata, rowGroup, columns, rowGroupStart, requestedStart, requestedEnd, options) {
|
|
9341
|
+
function columnVectorSources(file, metadata, rowGroup, columns, rowGroupStart, rowGroupEnd, requestedStart, requestedEnd, options) {
|
|
9114
9342
|
const sources = [];
|
|
9115
9343
|
for (const column of columns) {
|
|
9116
9344
|
const metadataForColumn = directLeafColumnMetadata(rowGroup, column);
|
|
9117
9345
|
if (metadataForColumn !== void 0 && canDirectVector(metadata, metadataForColumn)) {
|
|
9118
9346
|
sources.push({
|
|
9119
9347
|
columns: [column],
|
|
9120
|
-
iterator: readColumnVectorBatches(file, metadata, metadataForColumn, column, rowGroupStart, requestedStart, requestedEnd, options)[Symbol.asyncIterator]()
|
|
9348
|
+
iterator: readColumnVectorBatches(file, metadata, metadataForColumn, column, rowGroupStart, rowGroupEnd, requestedStart, requestedEnd, options)[Symbol.asyncIterator]()
|
|
9121
9349
|
});
|
|
9122
9350
|
continue;
|
|
9123
9351
|
}
|
|
@@ -9204,11 +9432,15 @@ async function* readNestedColumnVectorBatches(file, metadata, column, requestedS
|
|
|
9204
9432
|
yield { rowOffset: rowStart, batch };
|
|
9205
9433
|
}
|
|
9206
9434
|
}
|
|
9207
|
-
async function* readColumnVectorBatches(file, metadata, columnMetadata, column, rowGroupStart, requestedStart, requestedEnd, options) {
|
|
9435
|
+
async function* readColumnVectorBatches(file, metadata, columnMetadata, column, rowGroupStart, rowGroupEnd, requestedStart, requestedEnd, options) {
|
|
9208
9436
|
const chunkStart = safeNumber2(columnMetadata.dictionary_page_offset ?? columnMetadata.data_page_offset);
|
|
9209
9437
|
const compressedSize = safeNumber2(columnMetadata.total_compressed_size);
|
|
9210
9438
|
if (chunkStart === void 0 || compressedSize === void 0)
|
|
9211
9439
|
return;
|
|
9440
|
+
if (options.canStopEarly === true || requestedStart > rowGroupStart || requestedEnd < rowGroupEnd) {
|
|
9441
|
+
yield* readColumnWindowVectorBatches(file, metadata, columnMetadata, column, rowGroupStart, requestedStart, requestedEnd, chunkStart, chunkStart + compressedSize, options);
|
|
9442
|
+
return;
|
|
9443
|
+
}
|
|
9212
9444
|
const buffer = await file.slice(chunkStart, chunkStart + compressedSize);
|
|
9213
9445
|
const reader = { view: new DataView(buffer), offset: 0 };
|
|
9214
9446
|
const schemaPath = getSchemaPath(metadata.schema, columnMetadata.path_in_schema);
|
|
@@ -9220,6 +9452,7 @@ async function* readColumnVectorBatches(file, metadata, columnMetadata, column,
|
|
|
9220
9452
|
element: leaf.element,
|
|
9221
9453
|
schemaPath,
|
|
9222
9454
|
parsers: { ...DEFAULT_PARSERS, ...lakeqlParquetParsers },
|
|
9455
|
+
compressors: lakeqlParquetCompressors,
|
|
9223
9456
|
...columnMetadata
|
|
9224
9457
|
};
|
|
9225
9458
|
let dictionary;
|
|
@@ -9284,6 +9517,117 @@ async function* readColumnVectorBatches(file, metadata, columnMetadata, column,
|
|
|
9284
9517
|
pageRowStart = pageRowEnd;
|
|
9285
9518
|
}
|
|
9286
9519
|
}
|
|
9520
|
+
async function* readColumnWindowVectorBatches(file, metadata, columnMetadata, column, rowGroupStart, requestedStart, requestedEnd, chunkStart, chunkEnd, options) {
|
|
9521
|
+
const schemaPath = getSchemaPath(metadata.schema, columnMetadata.path_in_schema);
|
|
9522
|
+
const leaf = schemaPath[schemaPath.length - 1];
|
|
9523
|
+
if (leaf === void 0)
|
|
9524
|
+
return;
|
|
9525
|
+
const columnDecoder = {
|
|
9526
|
+
pathInSchema: columnMetadata.path_in_schema,
|
|
9527
|
+
element: leaf.element,
|
|
9528
|
+
schemaPath,
|
|
9529
|
+
parsers: { ...DEFAULT_PARSERS, ...lakeqlParquetParsers },
|
|
9530
|
+
compressors: lakeqlParquetCompressors,
|
|
9531
|
+
...columnMetadata
|
|
9532
|
+
};
|
|
9533
|
+
let dictionary;
|
|
9534
|
+
let pageRowStart = rowGroupStart;
|
|
9535
|
+
let offset = 0;
|
|
9536
|
+
while (chunkStart + offset < chunkEnd && pageRowStart < requestedEnd) {
|
|
9537
|
+
const page = await readPageWindow(file, chunkStart, chunkEnd, offset);
|
|
9538
|
+
if (page === void 0)
|
|
9539
|
+
return;
|
|
9540
|
+
offset += page.headerBytes + page.header.compressed_page_size;
|
|
9541
|
+
if (page.header.type === "DICTIONARY_PAGE") {
|
|
9542
|
+
dictionary = dictionaryPageValues(page.compressedBytes, page.header, columnDecoder, column, rowGroupStart, page.bodyOffset, file, options);
|
|
9543
|
+
continue;
|
|
9544
|
+
}
|
|
9545
|
+
const rowCount = dataPageRowCount(page.header);
|
|
9546
|
+
if (rowCount === void 0)
|
|
9547
|
+
continue;
|
|
9548
|
+
const pageRowEnd = pageRowStart + rowCount;
|
|
9549
|
+
if (pageRowEnd <= requestedStart || pageRowStart >= requestedEnd) {
|
|
9550
|
+
pageRowStart = pageRowEnd;
|
|
9551
|
+
continue;
|
|
9552
|
+
}
|
|
9553
|
+
const start = Math.max(pageRowStart, requestedStart);
|
|
9554
|
+
const end = Math.min(pageRowEnd, requestedEnd);
|
|
9555
|
+
if (start < end) {
|
|
9556
|
+
const cache = options.decodedColumnCache;
|
|
9557
|
+
const key = cache === void 0 || options.decodedColumnCacheKey === void 0 ? void 0 : decodedColumnPageCacheKey({
|
|
9558
|
+
path: options.decodedColumnCacheKey,
|
|
9559
|
+
byteLength: file.byteLength,
|
|
9560
|
+
...file.etag === void 0 ? {} : { etag: file.etag },
|
|
9561
|
+
column,
|
|
9562
|
+
rowGroupStart,
|
|
9563
|
+
pageRowStart,
|
|
9564
|
+
pageRowEnd,
|
|
9565
|
+
pageOffset: page.bodyOffset,
|
|
9566
|
+
compressedPageSize: page.header.compressed_page_size
|
|
9567
|
+
});
|
|
9568
|
+
const cached = key === void 0 || cache === void 0 ? void 0 : cache.getVector(key);
|
|
9569
|
+
let vector;
|
|
9570
|
+
if (cached !== void 0) {
|
|
9571
|
+
vector = cached;
|
|
9572
|
+
} else {
|
|
9573
|
+
const values = dataPageValues(page.compressedBytes, page.header, columnDecoder, dictionary);
|
|
9574
|
+
if (values === void 0)
|
|
9575
|
+
continue;
|
|
9576
|
+
vector = flatPageVector(values.values, values.definitionLevels, 0, rowCount, values.dictionary);
|
|
9577
|
+
if (key !== void 0 && cache !== void 0)
|
|
9578
|
+
cache.setVector(key, vector);
|
|
9579
|
+
}
|
|
9580
|
+
if (key !== void 0 && options.stats !== void 0) {
|
|
9581
|
+
if (cached === void 0)
|
|
9582
|
+
options.stats.cacheMisses += 1;
|
|
9583
|
+
else
|
|
9584
|
+
options.stats.cacheHits += 1;
|
|
9585
|
+
}
|
|
9586
|
+
yield {
|
|
9587
|
+
rowOffset: start,
|
|
9588
|
+
batch: batchFromVectors({
|
|
9589
|
+
[column]: sliceVector(vector, start - pageRowStart, end - pageRowStart)
|
|
9590
|
+
})
|
|
9591
|
+
};
|
|
9592
|
+
}
|
|
9593
|
+
pageRowStart = pageRowEnd;
|
|
9594
|
+
}
|
|
9595
|
+
}
|
|
9596
|
+
async function readPageWindow(file, chunkStart, chunkEnd, offset) {
|
|
9597
|
+
const absoluteOffset = chunkStart + offset;
|
|
9598
|
+
if (absoluteOffset >= chunkEnd)
|
|
9599
|
+
return void 0;
|
|
9600
|
+
const header = await readPageHeader(file, absoluteOffset, chunkEnd);
|
|
9601
|
+
const bodyOffset = absoluteOffset + header.headerBytes;
|
|
9602
|
+
const bodyEnd = bodyOffset + header.header.compressed_page_size;
|
|
9603
|
+
if (bodyEnd > chunkEnd)
|
|
9604
|
+
return void 0;
|
|
9605
|
+
const body = await file.slice(bodyOffset, bodyEnd);
|
|
9606
|
+
return {
|
|
9607
|
+
...header,
|
|
9608
|
+
bodyOffset,
|
|
9609
|
+
compressedBytes: new Uint8Array(body)
|
|
9610
|
+
};
|
|
9611
|
+
}
|
|
9612
|
+
async function readPageHeader(file, absoluteOffset, chunkEnd) {
|
|
9613
|
+
let size = 256;
|
|
9614
|
+
let lastError;
|
|
9615
|
+
while (absoluteOffset + size <= chunkEnd || size === 256) {
|
|
9616
|
+
const end = Math.min(chunkEnd, absoluteOffset + size);
|
|
9617
|
+
const bytes = await file.slice(absoluteOffset, end);
|
|
9618
|
+
const reader = { view: new DataView(bytes), offset: 0 };
|
|
9619
|
+
try {
|
|
9620
|
+
const header = parquetHeader(reader);
|
|
9621
|
+
return { header, headerBytes: reader.offset };
|
|
9622
|
+
} catch (cause) {
|
|
9623
|
+
lastError = cause;
|
|
9624
|
+
if (end === chunkEnd)
|
|
9625
|
+
break;
|
|
9626
|
+
size *= 4;
|
|
9627
|
+
}
|
|
9628
|
+
}
|
|
9629
|
+
throw lastError instanceof Error ? lastError : new Error("Unable to read Parquet page header");
|
|
9630
|
+
}
|
|
9287
9631
|
function dataPageRowCount(header) {
|
|
9288
9632
|
if (header.type === "DATA_PAGE")
|
|
9289
9633
|
return header.data_page_header?.num_values;
|
|
@@ -9312,7 +9656,7 @@ function dictionaryPageValues(compressedBytes, header, columnDecoder, column, ro
|
|
|
9312
9656
|
options.stats.cacheHits += 1;
|
|
9313
9657
|
return cached;
|
|
9314
9658
|
}
|
|
9315
|
-
const page = decompressPage(compressedBytes, Number(header.uncompressed_page_size), columnDecoder.codec,
|
|
9659
|
+
const page = decompressPage(compressedBytes, Number(header.uncompressed_page_size), columnDecoder.codec, columnDecoder.compressors);
|
|
9316
9660
|
const pageReader = {
|
|
9317
9661
|
view: new DataView(page.buffer, page.byteOffset, page.byteLength),
|
|
9318
9662
|
offset: 0
|
|
@@ -9330,7 +9674,7 @@ function dataPageValues(compressedBytes, header, columnDecoder, dictionary) {
|
|
|
9330
9674
|
const dataHeader = header.data_page_header;
|
|
9331
9675
|
if (dataHeader === void 0)
|
|
9332
9676
|
return void 0;
|
|
9333
|
-
const page = decompressPage(compressedBytes, Number(header.uncompressed_page_size), columnDecoder.codec,
|
|
9677
|
+
const page = decompressPage(compressedBytes, Number(header.uncompressed_page_size), columnDecoder.codec, columnDecoder.compressors);
|
|
9334
9678
|
const { definitionLevels, dataPage } = readDataPage(page, dataHeader, columnDecoder);
|
|
9335
9679
|
const compactDataPage = compactPresentValues(dataPage);
|
|
9336
9680
|
const pageDictionary = dictionary !== void 0 && isDictionaryEncoding(dataHeader.encoding) ? dictionary : void 0;
|
|
@@ -9678,7 +10022,7 @@ var ParquetScanAdapter = class {
|
|
|
9678
10022
|
const batchSize = options.batchSize || this.defaultBatchSize;
|
|
9679
10023
|
const file = this.scanBuffer(path, await asyncBufferFromStore(this.store, path, options));
|
|
9680
10024
|
const metadata = await this.metadata(path, file, options);
|
|
9681
|
-
rejectUnsupportedParquetSchema(metadata);
|
|
10025
|
+
rejectUnsupportedParquetSchema(metadata, { columns: options.columns });
|
|
9682
10026
|
const readColumns = options.columns;
|
|
9683
10027
|
if (readColumns) {
|
|
9684
10028
|
recordReadColumns(options.stats, readColumns);
|
|
@@ -9702,6 +10046,7 @@ var ParquetScanAdapter = class {
|
|
|
9702
10046
|
rowFormat: "object",
|
|
9703
10047
|
rowStart,
|
|
9704
10048
|
rowEnd,
|
|
10049
|
+
compressors: lakeqlParquetCompressors,
|
|
9705
10050
|
parsers: lakeqlParquetParsers
|
|
9706
10051
|
};
|
|
9707
10052
|
if (readColumns)
|
|
@@ -9729,7 +10074,7 @@ var ParquetScanAdapter = class {
|
|
|
9729
10074
|
async *scanVectorBatches(path, options) {
|
|
9730
10075
|
const file = this.scanBuffer(path, await asyncBufferFromStore(this.store, path, options));
|
|
9731
10076
|
const metadata = await this.metadata(path, file, options);
|
|
9732
|
-
rejectUnsupportedParquetSchema(metadata);
|
|
10077
|
+
rejectUnsupportedParquetSchema(metadata, { columns: options.columns });
|
|
9733
10078
|
try {
|
|
9734
10079
|
const vectorOptions = {
|
|
9735
10080
|
batchSize: options.batchSize || this.defaultBatchSize,
|
|
@@ -9737,6 +10082,7 @@ var ParquetScanAdapter = class {
|
|
|
9737
10082
|
...options.rowEnd === void 0 ? {} : { rowEnd: options.rowEnd },
|
|
9738
10083
|
...options.columns === void 0 ? {} : { columns: options.columns },
|
|
9739
10084
|
...options.where === void 0 ? {} : { where: options.where },
|
|
10085
|
+
...options.canStopEarly === void 0 ? {} : { canStopEarly: options.canStopEarly },
|
|
9740
10086
|
...this.decodedColumnCache === void 0 ? {} : {
|
|
9741
10087
|
decodedColumnCache: this.decodedColumnCache,
|
|
9742
10088
|
decodedColumnCacheKey: path
|
|
@@ -9756,6 +10102,7 @@ var ParquetScanAdapter = class {
|
|
|
9756
10102
|
...options.rowEnd === void 0 ? {} : { rowEnd: options.rowEnd },
|
|
9757
10103
|
...options.columns === void 0 ? {} : { columns: options.columns },
|
|
9758
10104
|
...options.where === void 0 ? {} : { where: options.where },
|
|
10105
|
+
...options.canStopEarly === void 0 ? {} : { canStopEarly: options.canStopEarly },
|
|
9759
10106
|
...this.decodedColumnCache === void 0 ? {} : {
|
|
9760
10107
|
decodedColumnCache: this.decodedColumnCache,
|
|
9761
10108
|
decodedColumnCacheKey: path
|
|
@@ -10441,7 +10788,7 @@ async function* readParquetObjectBatches(store, path, options = {}) {
|
|
|
10441
10788
|
const file = await asyncBufferFromStore(store, path);
|
|
10442
10789
|
try {
|
|
10443
10790
|
const metadata = await readParquetMetadataFromFile(file);
|
|
10444
|
-
rejectUnsupportedParquetSchema(metadata);
|
|
10791
|
+
rejectUnsupportedParquetSchema(metadata, { columns: options.columns });
|
|
10445
10792
|
yield* readParquetObjectBatchesFromFile(file, metadata, options);
|
|
10446
10793
|
} catch (cause) {
|
|
10447
10794
|
if (cause instanceof LakeqlError)
|
|
@@ -10453,7 +10800,7 @@ async function* readParquetColumnBatches(store, path, options = {}) {
|
|
|
10453
10800
|
const file = await asyncBufferFromStore(store, path);
|
|
10454
10801
|
try {
|
|
10455
10802
|
const metadata = await readParquetMetadataFromFile(file);
|
|
10456
|
-
rejectUnsupportedParquetSchema(metadata);
|
|
10803
|
+
rejectUnsupportedParquetSchema(metadata, { columns: options.columns });
|
|
10457
10804
|
yield* readParquetColumnBatchesFromFile(file, metadata, options);
|
|
10458
10805
|
} catch (cause) {
|
|
10459
10806
|
if (cause instanceof LakeqlError)
|
|
@@ -11031,4 +11378,4 @@ function createParquetLake(config) {
|
|
|
11031
11378
|
});
|
|
11032
11379
|
}
|
|
11033
11380
|
|
|
11034
|
-
export { AggregationBuilder, CacheApiCache, Lake, MemoryCache, MemoryCheckpointAdapter, MemoryObjectStore, MemorySpillAdapter, ParquetScanAdapter, QueryBuilder, QueryResult, ResumedQuery, SharedMemoryCache, add, advanceTaskCheckpoint, aggregateParquetGroupTask, aggregateParquetGroupTasks, aggregateParquetGroupTasksBatch, aggregateParquetTask, aggregateParquetTasks, and, assertBookmarkMatches, asyncBufferFromStore, batchExprValues, batchFromColumns, batchFromVectors, bboxMayIntersect, between, broadcastJoin, buildBBoxIndex, buildMinMaxIndex, cacheApiCache, cachedObjectStore, classifyPredicate, col, concatBatches, createBookmark, createOutputManifest, createOutputManifestFromCheckpoints, createParquetLake, createParquetTableAs, createTaskManifest, createVectorAggregateStates, createVectorGroupByState, deserializeAggregateOperatorState, deserializeSortOperatorState, deserializeTopKOperatorState, div, enforceVectorGroupByBudget, eq, fanInWorkUnits, finalizeVectorAggregateStates, finalizeVectorGroupByBatch, finalizeVectorGroupByRows, fingerprint, fn, gatherBatch, getOrCreateVectorGroup, gt, gte, ilike, isIn, isNotNull, isNull, jsonWorkUnitBoundary, like, lit, lookupJoin, lt, lte, materializeBatchRows, materializeSelectedBatchRows, memoryCache, memoryCheckpointAdapter, memorySpillAdapter, memoryStore, mergeVectorAggregateStateSnapshots, mergeVectorAggregateStates, mergeVectorGroupByStates, mod, mul, ne, not, notIn, or, parquetScanner, parseHivePartitions, parseJsonQuery, partitionedParquetOutputEntries, planParquetTaskWorkUnits, planRowGroups, planRowGroupsFromMetadata, predicateSelection, pruneFilesWithIndex, readControlSignal, readIcebergParquetDeletes, readOutputManifest, readParquetColumnBatches, readParquetMetadata, readParquetObjectBatches, readParquetObjects, rejectUnsupportedParquetSchema, restoreVectorAggregateStates, restoreVectorGroupByState, rowGroupMayMatch, rowGroupMustMatch, scalarVectorValue, scanParquetTaskBatches, scanParquetTaskColumnBatches, selectedRowCount, selectedRowIndices, serializeAggregateOperatorState, serializeSortOperatorState, serializeTopKOperatorState, signPaginationToken, snapshotVectorAggregateStates, snapshotVectorGroupByState, stableStringify, sub, throwIfAborted, transitionTaskCheckpoint, tryPredicateSelection, updateVectorAggregateStateValue, updateVectorAggregateStates, updateVectorGroupAggregateValue, updateVectorGroupByState, vectorAggregateBatch, vectorFromValues, vectorGroupByBatch, vectorLength, vectorOrderByBatch, vectorProjectBatch, vectorSortIndices, vectorTopKBatch, vectorTopKIndices, vectorValue, verifyPaginationToken, withObjectStoreReadControls, writeOutputManifest, writeParquet, writePartitionedParquet, writePartitionedParquetTask };
|
|
11381
|
+
export { AggregationBuilder, CacheApiCache, Lake, MemoryCache, MemoryCheckpointAdapter, MemoryObjectStore, MemorySpillAdapter, ParquetScanAdapter, QueryBuilder, QueryResult, ResumedQuery, SharedMemoryCache, add, advanceTaskCheckpoint, aggregateParquetGroupTask, aggregateParquetGroupTasks, aggregateParquetGroupTasksBatch, aggregateParquetTask, aggregateParquetTasks, and, assertBookmarkMatches, asyncBufferFromStore, batchExprValues, batchFromColumns, batchFromVectors, bboxMayIntersect, between, broadcastJoin, buildBBoxIndex, buildMinMaxIndex, cacheApiCache, cachedObjectStore, classifyPredicate, col, concatBatches, createBookmark, createOutputManifest, createOutputManifestFromCheckpoints, createParquetLake, createParquetTableAs, createTaskManifest, createVectorAggregateStates, createVectorGroupByState, deserializeAggregateOperatorState, deserializeSortOperatorState, deserializeTopKOperatorState, div, enforceVectorGroupByBudget, eq, fanInWorkUnits, finalizeVectorAggregateStates, finalizeVectorGroupByBatch, finalizeVectorGroupByRows, fingerprint, fn, gatherBatch, getOrCreateVectorGroup, gt, gte, ilike, isIn, isNotNull, isNull, jsonWorkUnitBoundary, like, lit, lookupJoin, lt, lte, materializeBatchRows, materializeSelectedBatchRows, memoryCache, memoryCheckpointAdapter, memorySpillAdapter, memoryStore, mergeVectorAggregateStateSnapshots, mergeVectorAggregateStates, mergeVectorGroupByStates, mod, mul, ne, not, notIn, or, parquetScanner, parseHivePartitions, parseJsonQuery, partitionedParquetOutputEntries, planParquetTaskWorkUnits, planRowGroups, planRowGroupsFromMetadata, predicateSelection, pruneFilesWithIndex, readControlSignal, readIcebergParquetDeletes, readOutputManifest, readParquetColumnBatches, readParquetMetadata, readParquetObjectBatches, readParquetObjects, rejectUnsupportedParquetSchema, restoreVectorAggregateStates, restoreVectorGroupByState, rowGroupMayMatch, rowGroupMustMatch, scalarVectorValue, scanParquetTaskBatches, scanParquetTaskColumnBatches, selectedRowCount, selectedRowIndices, serializeAggregateOperatorState, serializeSortOperatorState, serializeTopKOperatorState, signPaginationToken, snapshotVectorAggregateStates, snapshotVectorGroupByState, stableStringify, sub, throwIfAborted, transitionTaskCheckpoint, tryPredicateSelection, updateVectorAggregateStateValue, updateVectorAggregateStates, updateVectorGroupAggregateValue, updateVectorGroupByState, uriObjectStore, vectorAggregateBatch, vectorFromValues, vectorGroupByBatch, vectorLength, vectorOrderByBatch, vectorProjectBatch, vectorSortIndices, vectorTopKBatch, vectorTopKIndices, vectorValue, verifyPaginationToken, withObjectStoreReadControls, writeOutputManifest, writeParquet, writePartitionedParquet, writePartitionedParquetTask };
|
package/dist/cloudflare.d.ts
CHANGED
|
@@ -1,8 +1,24 @@
|
|
|
1
|
-
import { ObjectStore } from './index.js';
|
|
2
|
-
export { AggregateExpr, AggregateGroupSnapshot, AggregateOp, AggregateOperatorState, AggregateOptions, AggregateParquetGroupTaskOptions, AggregateParquetGroupTasksOptions, AggregateParquetTaskOptions, AggregateParquetTasksOptions, AggregateResult, AggregateSnapshotValue, AggregateSpec, AggregateStateSnapshot, AggregationBuilder, ApplyIcebergDeletesOptions, ArithmeticExpr, BBox, BBoxIndex, Batch, BatchExprValues, BetweenExpr, Bookmark, BookmarkInit, BookmarkPosition, BookmarkQuery, BroadcastJoinOptions,
|
|
1
|
+
import { CacheAdapter, ObjectStore } from './index.js';
|
|
2
|
+
export { AggregateExpr, AggregateGroupSnapshot, AggregateOp, AggregateOperatorState, AggregateOptions, AggregateParquetGroupTaskOptions, AggregateParquetGroupTasksOptions, AggregateParquetTaskOptions, AggregateParquetTasksOptions, AggregateResult, AggregateSnapshotValue, AggregateSpec, AggregateStateSnapshot, AggregationBuilder, ApplyIcebergDeletesOptions, ArithmeticExpr, BBox, BBoxIndex, Batch, BatchExprValues, BetweenExpr, Bookmark, BookmarkInit, BookmarkPosition, BookmarkQuery, BroadcastJoinOptions, CacheApiCache, CacheApiCacheOptions, CacheEntry, CachePolicy, CallExpr, CaseExpr, CaseWhenExpr, CheckpointAdapter, CheckpointStore, Clock, ColumnExpr, ColumnInput, CompareExpr, CompareOp, ConditionalObjectStore, ConditionalPutOptions, CreateParquetTableAsOptions, CreateParquetTableAsQuery, CreateParquetTableAsResult, CsvStreamOptions, DecodedIcebergDeletes, DecodedIcebergParquetDeletes, ERROR_CODES, EngineFilePlan, EngineTable, ErrorDetails, ExplainJson, ExplainResult, Expr, GeoBackend, GeoJsonGeometry, IcebergAppendFile, IcebergAppendOptions, IcebergAppendOutputManifestOptions, IcebergAppendResult, IcebergCatalog, IcebergCommitCatalog, IcebergCommitInput, IcebergCommitResult, IcebergDeleteFile, IcebergDeletionVector, IcebergEnginePlan, IcebergEngineTable, IcebergEqualityDelete, IcebergField, IcebergGlueCatalogOptions, IcebergLoadTableOptions, IcebergNessieCatalogOptions, IcebergParquetDeleteFile, IcebergParquetDeleteFileContent, IcebergPartitionField, IcebergPartitionSpec, IcebergPlan, IcebergPositionDelete, IcebergReadMode, IcebergRestAccessDelegation, IcebergRestCatalog, IcebergRestCatalogConfig, IcebergRestCatalogOptions, IcebergRestLoadContext, IcebergRestLoadTableOptions, IcebergRestLoadTableResult, IcebergRestStorageCredential, IcebergRowBatch, IcebergSortOrder, IcebergTable, IcebergTableIdentifier, IcebergUnsupportedCatalog, IdGenerator, InExpr, InMemoryLakeOptions, InMemoryRowsScanner, InMemoryRowsStore, InMemoryTableOptions, IndexPruneResult, IndexValue, InsertValidationRules, JoinKey, JoinType, JsonExpr, JsonOrderByTerm, JsonQueryV1, Lake, LakeConfig, LakeqlError, LakeqlErrorCode, LikeExpr, ListOptions, LiteralExpr, LoadIcebergEngineTableOptions, LoadIcebergTableFromObjectStoreOptions, LoadIcebergTableFromRestOptions, LoadIcebergTableOptions, LoadParquetEngineTableOptions, LoadTableOptions, LockAdapter, LogHook, LogicalExpr, LookupJoinFunction, LookupJoinOptions, Manifest, ManifestDeleteFile, ManifestFile, MemoryCache, MemoryCheckpointAdapter, MemoryObjectStore, MemorySpillAdapter, MemorySpillAdapterOptions, MetadataFile, MetricsHook, MinMaxColumnIndex, NotExpr, NullCheckExpr, ObjectHead, ObjectInfo, ObjectStoreCacheOptions, ObjectStoreIcebergCommitCatalog, ObjectStoreJsonCache, ObjectStoreJsonCacheOptions, ObjectStoreReadControls, ObjectStoreUriAuthority, OperatorSnapshotValue, OrderByTerm, OutputManifest, OutputManifestEntry, PACKAGE, ParquetColumnBatch, ParquetEnginePlan, ParquetEngineTable, ParquetLakeConfig, ParquetMetadata, ParquetRowBatch, ParquetRowGroupPlan, ParquetScanAdapter, PartitionedParquetOutputEntryOptions, PathQueryInit, PlanIcebergFilesOptions, PlanParquetRowGroupsOptions, PlanParquetTaskWorkUnitsOptions, PlannedIcebergFile, PlannedParquetRowGroup, PredicatePlan, PredicatePlanOptions, ProjectIcebergRowOptions, PutOptions, QueryBudget, QueryBuilder, QueryPolicy, QueryPolicyContext, QueryResult, QueryRunOptions, QueryStats, QueueAdapter, ReadParquetBatchOptions, ReadParquetOptions, ResumableBatchOptions, ResumedQuery, Row, RuntimeSubstrate, Scalar, ScanAdapter, ScanBatch, ScanColumnBatch, ScanEngineOptions, ScanOptions, ScanParquetTaskOptions, ScanPlannedIcebergRowsOptions, ScanTaskPlan, ScanTaskPlanOptions, ScanVectorBatch, Selection, SharedCacheEntry, SharedCacheSetOptions, SharedMemoryCache, SidecarFileIndex, SliceOptions, SliceResult, Snapshot, SortOperatorState, SortOptions, SortResult, SortRunState, SpillAdapter, SpillRef, SpillUsage, SqlBoolean, TaskCheckpoint, TaskInput, TaskManifest, TaskManifestTask, TaskState, TaskTransitionInput, TimestampUnit, TimestampValue, TopKOperatorState, TopKOptions, TopKResult, ValueInput, Vector, VectorAggregateOptions, VectorAggregateSnapshotValue, VectorAggregateState, VectorAggregateStateSnapshot, VectorAggregateStateSnapshots, VectorAggregateStates, VectorAggregateValue, VectorGroup, VectorGroupByGroupSnapshot, VectorGroupByOptions, VectorGroupBySnapshotValue, VectorGroupByState, VectorGroupByStateSnapshot, VectorHashJoinOptions, VectorProjectionSpec, VectorTopKOptions, WorkUnitFanInOptions, WriteParquetOptions, WriteParquetRowsOptions, WritePartitionedParquetFile, WritePartitionedParquetResult, WritePartitionedParquetTaskOptions, 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, createLake, createOutputManifest, createOutputManifestFromCheckpoints, createLake as 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, objectStoreJsonCache, 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, uriObjectStore, vectorAggregateBatch, vectorFromValues, vectorGroupByBatch, vectorHashJoin, vectorLength, vectorOrderByBatch, vectorProjectBatch, vectorSortIndices, vectorTopKBatch, vectorTopKIndices, vectorValue, verifyPaginationToken, withObjectStoreReadControls, writeOutputManifest, writeParquet, writePartitionedParquet, writePartitionedParquetTask } from './index.js';
|
|
3
3
|
import 'hyparquet-writer';
|
|
4
4
|
import 'hyparquet';
|
|
5
5
|
|
|
6
|
+
interface D1DatabaseLike {
|
|
7
|
+
prepare(query: string): D1PreparedStatementLike;
|
|
8
|
+
}
|
|
9
|
+
interface D1PreparedStatementLike {
|
|
10
|
+
bind(...values: unknown[]): D1PreparedStatementLike;
|
|
11
|
+
first<T = unknown>(column?: string): Promise<T | null>;
|
|
12
|
+
run(): Promise<unknown>;
|
|
13
|
+
}
|
|
14
|
+
interface CloudflareD1JsonCacheOptions {
|
|
15
|
+
db: D1DatabaseLike;
|
|
16
|
+
table?: string;
|
|
17
|
+
prefix?: string;
|
|
18
|
+
ttlMs?: number;
|
|
19
|
+
now?: () => number;
|
|
20
|
+
createTable?: boolean;
|
|
21
|
+
}
|
|
6
22
|
interface R2ObjectBody {
|
|
7
23
|
key: string;
|
|
8
24
|
size: number;
|
|
@@ -39,5 +55,6 @@ interface R2BucketLike {
|
|
|
39
55
|
}>;
|
|
40
56
|
}
|
|
41
57
|
declare function r2Store(bucket: R2BucketLike): ObjectStore;
|
|
58
|
+
declare function cloudflareD1JsonCache<T = unknown>(options: CloudflareD1JsonCacheOptions): CacheAdapter<T>;
|
|
42
59
|
|
|
43
|
-
export { ObjectStore, r2Store };
|
|
60
|
+
export { CacheAdapter, ObjectStore, cloudflareD1JsonCache, r2Store };
|