@gscdump/engine 5.3.0 → 5.6.0
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.
|
@@ -213,15 +213,24 @@ function asyncBufferFromBytes(bytes) {
|
|
|
213
213
|
}
|
|
214
214
|
async function decodeParquetToRows(bytes, opts = {}) {
|
|
215
215
|
const rows = [];
|
|
216
|
-
for await (const group of decodeParquetGroups(bytes, opts)) for (
|
|
216
|
+
for await (const group of decodeParquetGroups(bytes, opts)) for (let i = 0; i < group.length; i++) rows.push(group[i]);
|
|
217
217
|
return rows;
|
|
218
218
|
}
|
|
219
219
|
async function* decodeParquetGroups(bytes, opts = {}) {
|
|
220
220
|
if (bytes.byteLength === 0) return;
|
|
221
221
|
const file = asyncBufferFromBytes(bytes);
|
|
222
222
|
const metadata = await parquetMetadataAsync(file);
|
|
223
|
-
const
|
|
223
|
+
const tree = parquetSchema(metadata);
|
|
224
|
+
const present = /* @__PURE__ */ new Set();
|
|
225
|
+
const dateColumns = [];
|
|
226
|
+
let nested = false;
|
|
227
|
+
for (const child of tree.children) {
|
|
228
|
+
present.add(child.element.name);
|
|
229
|
+
if (child.children.length > 0) nested = true;
|
|
230
|
+
else if (isDateCapableElement(child.element)) dateColumns.push(child.element.name);
|
|
231
|
+
}
|
|
224
232
|
const columns = opts.columns?.filter((name) => present.has(name));
|
|
233
|
+
const normalizeColumns = nested ? null : dateColumns;
|
|
225
234
|
let groupStart = 0;
|
|
226
235
|
for (const group of metadata.row_groups) {
|
|
227
236
|
const groupEnd = groupStart + Number(group.num_rows);
|
|
@@ -243,15 +252,22 @@ async function* decodeParquetGroups(bytes, opts = {}) {
|
|
|
243
252
|
useBloomFilters: true,
|
|
244
253
|
usePageIndex: true
|
|
245
254
|
} : {}
|
|
246
|
-
}));
|
|
255
|
+
}), normalizeColumns);
|
|
247
256
|
groupStart = groupEnd;
|
|
248
257
|
}
|
|
249
258
|
}
|
|
250
|
-
function
|
|
259
|
+
function isDateCapableElement(element) {
|
|
260
|
+
if (element.type === "INT96") return true;
|
|
261
|
+
const converted = element.converted_type;
|
|
262
|
+
if (converted === "DATE" || converted === "TIMESTAMP_MILLIS" || converted === "TIMESTAMP_MICROS") return true;
|
|
263
|
+
return element.logical_type?.type === "TIMESTAMP";
|
|
264
|
+
}
|
|
265
|
+
function normalizeDecodedDates(rows, dateColumns) {
|
|
266
|
+
if (dateColumns !== null && dateColumns.length === 0) return rows;
|
|
251
267
|
const dates = /* @__PURE__ */ new Map();
|
|
252
268
|
for (const row of rows) {
|
|
253
269
|
const r = row;
|
|
254
|
-
for (const k
|
|
270
|
+
for (const k of dateColumns ?? Object.keys(r)) {
|
|
255
271
|
const v = r[k];
|
|
256
272
|
if (v instanceof Date) {
|
|
257
273
|
const day = Math.floor(v.getTime() / EPOCH_DAY_MS);
|
package/dist/iceberg/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ICEBERG_FIELD_ID_BASE, ICEBERG_PARTITION_COLUMNS, ICEBERG_PARTITION_SPEC, ICEBERG_SCHEMAS, ICEBERG_SCHEMAS_INT, ICEBERG_SCHEMAS_STRING, ICEBERG_TABLES, INT_SEARCH_TYPE, IcebergTableName, SEARCH_TYPE_INT, assertIcebergTable, icebergPartitionColumns, icebergSchemasFor, icebergTableSpec, isIcebergTable } from "./schema.mjs";
|
|
1
|
+
import { ICEBERG_FIELD_ID_BASE, ICEBERG_PARTITION_COLUMNS, ICEBERG_PARTITION_SPEC, ICEBERG_SCHEMAS, ICEBERG_SCHEMAS_INT, ICEBERG_SCHEMAS_STRING, ICEBERG_TABLES, INT_SEARCH_TYPE, IcebergTableName, SEARCH_TYPE_INT, assertIcebergTable, gscDataset, icebergPartitionColumns, icebergSchemasFor, icebergTableSpec, isIcebergTable } from "./schema.mjs";
|
|
2
2
|
import { IcebergTableOpResult, ListIcebergDataFilesOptions, createIcebergTables, dropIcebergTables, icebergPartitionSpecFor, icebergSchemaFor, icebergSortOrderFor, listIcebergDataFiles } from "./catalog.mjs";
|
|
3
3
|
import { IcebergAppendSinkOptions } from "../sink.mjs";
|
|
4
4
|
import { IcebergAppendSink, createIcebergAppendSink } from "./append-sink.mjs";
|
|
5
|
-
export { ICEBERG_FIELD_ID_BASE, ICEBERG_PARTITION_COLUMNS, ICEBERG_PARTITION_SPEC, ICEBERG_SCHEMAS, ICEBERG_SCHEMAS_INT, ICEBERG_SCHEMAS_STRING, ICEBERG_TABLES, INT_SEARCH_TYPE, type IcebergAppendSink, type IcebergAppendSinkOptions, type IcebergTableName, type IcebergTableOpResult, type ListIcebergDataFilesOptions, SEARCH_TYPE_INT, assertIcebergTable, createIcebergAppendSink, createIcebergTables, dropIcebergTables, icebergPartitionColumns, icebergPartitionSpecFor, icebergSchemaFor, icebergSchemasFor, icebergSortOrderFor, icebergTableSpec, isIcebergTable, listIcebergDataFiles };
|
|
5
|
+
export { ICEBERG_FIELD_ID_BASE, ICEBERG_PARTITION_COLUMNS, ICEBERG_PARTITION_SPEC, ICEBERG_SCHEMAS, ICEBERG_SCHEMAS_INT, ICEBERG_SCHEMAS_STRING, ICEBERG_TABLES, INT_SEARCH_TYPE, type IcebergAppendSink, type IcebergAppendSinkOptions, type IcebergTableName, type IcebergTableOpResult, type ListIcebergDataFilesOptions, SEARCH_TYPE_INT, assertIcebergTable, createIcebergAppendSink, createIcebergTables, dropIcebergTables, gscDataset, icebergPartitionColumns, icebergPartitionSpecFor, icebergSchemaFor, icebergSchemasFor, icebergSortOrderFor, icebergTableSpec, isIcebergTable, listIcebergDataFiles };
|
package/dist/iceberg/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ICEBERG_FIELD_ID_BASE, ICEBERG_PARTITION_COLUMNS, ICEBERG_PARTITION_SPEC, ICEBERG_SCHEMAS, ICEBERG_SCHEMAS_INT, ICEBERG_SCHEMAS_STRING, ICEBERG_TABLES, INT_SEARCH_TYPE, SEARCH_TYPE_INT, assertIcebergTable, icebergPartitionColumns, icebergSchemasFor, icebergTableSpec, isIcebergTable } from "./schema.mjs";
|
|
1
|
+
import { ICEBERG_FIELD_ID_BASE, ICEBERG_PARTITION_COLUMNS, ICEBERG_PARTITION_SPEC, ICEBERG_SCHEMAS, ICEBERG_SCHEMAS_INT, ICEBERG_SCHEMAS_STRING, ICEBERG_TABLES, INT_SEARCH_TYPE, SEARCH_TYPE_INT, assertIcebergTable, gscDataset, icebergPartitionColumns, icebergSchemasFor, icebergTableSpec, isIcebergTable } from "./schema.mjs";
|
|
2
2
|
import { createIcebergTables, dropIcebergTables, icebergPartitionSpecFor, icebergSchemaFor, icebergSortOrderFor, listIcebergDataFiles } from "./catalog.mjs";
|
|
3
3
|
import { createIcebergAppendSink } from "./append-sink.mjs";
|
|
4
|
-
export { ICEBERG_FIELD_ID_BASE, ICEBERG_PARTITION_COLUMNS, ICEBERG_PARTITION_SPEC, ICEBERG_SCHEMAS, ICEBERG_SCHEMAS_INT, ICEBERG_SCHEMAS_STRING, ICEBERG_TABLES, INT_SEARCH_TYPE, SEARCH_TYPE_INT, assertIcebergTable, createIcebergAppendSink, createIcebergTables, dropIcebergTables, icebergPartitionColumns, icebergPartitionSpecFor, icebergSchemaFor, icebergSchemasFor, icebergSortOrderFor, icebergTableSpec, isIcebergTable, listIcebergDataFiles };
|
|
4
|
+
export { ICEBERG_FIELD_ID_BASE, ICEBERG_PARTITION_COLUMNS, ICEBERG_PARTITION_SPEC, ICEBERG_SCHEMAS, ICEBERG_SCHEMAS_INT, ICEBERG_SCHEMAS_STRING, ICEBERG_TABLES, INT_SEARCH_TYPE, SEARCH_TYPE_INT, assertIcebergTable, createIcebergAppendSink, createIcebergTables, dropIcebergTables, gscDataset, icebergPartitionColumns, icebergPartitionSpecFor, icebergSchemaFor, icebergSchemasFor, icebergSortOrderFor, icebergTableSpec, isIcebergTable, listIcebergDataFiles };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { SearchType } from "../storage.mjs";
|
|
2
|
+
import { IcebergDataset } from "@gscdump/lakehouse";
|
|
2
3
|
import { IcebergColumn, IcebergPartitionField, IcebergS3Config, IcebergTableSpec, PartitionKeyEncoding, PartitionKeyEncoding as PartitionKeyEncoding$1 } from "@gscdump/lakehouse/schema";
|
|
3
4
|
import { TableName } from "@gscdump/contracts";
|
|
4
5
|
/** The 9 fact tables that exist as global Iceberg tables. */
|
|
@@ -38,6 +39,12 @@ export declare function icebergPartitionColumns(encoding?: PartitionKeyEncoding)
|
|
|
38
39
|
export declare const ICEBERG_FIELD_ID_BASE = 3;
|
|
39
40
|
/** Shared partition spec — identical across every table. */
|
|
40
41
|
export declare const ICEBERG_PARTITION_SPEC: readonly IcebergPartitionField[];
|
|
42
|
+
/**
|
|
43
|
+
* The `IcebergDataset` registry instance for one `gsc.*` table + encoding —
|
|
44
|
+
* the single source `./append-sink.ts`'s identity injection / dedupe key /
|
|
45
|
+
* cluster pre-sort and `./catalog.ts`'s create-table derivation read from.
|
|
46
|
+
*/
|
|
47
|
+
export declare function gscDataset(table: IcebergTableName, encoding?: PartitionKeyEncoding): IcebergDataset;
|
|
41
48
|
/**
|
|
42
49
|
* Derive the full Iceberg table spec for a table + encoding. Thin wrapper
|
|
43
50
|
* over {@link gscDataset}'s `tableSpec` (ADR-0021 R2-FIXES C5) — kept as a
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gscdump/engine",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "5.
|
|
4
|
+
"version": "5.6.0",
|
|
5
5
|
"description": "Append-only Parquet/DuckDB storage engine + planner + adapters for the gscdump pipeline. Node + edge runtimes; opt-in heavy peers.",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "Harlan Wilton",
|
|
@@ -189,10 +189,10 @@
|
|
|
189
189
|
}
|
|
190
190
|
},
|
|
191
191
|
"dependencies": {
|
|
192
|
-
"@gscdump/contracts": "^5.
|
|
193
|
-
"@gscdump/lakehouse": "^5.
|
|
192
|
+
"@gscdump/contracts": "^5.6.0",
|
|
193
|
+
"@gscdump/lakehouse": "^5.6.0",
|
|
194
194
|
"drizzle-orm": "1.0.0-rc.4",
|
|
195
|
-
"gscdump": "^5.
|
|
195
|
+
"gscdump": "^5.6.0",
|
|
196
196
|
"pathe": "^2.0.3",
|
|
197
197
|
"proper-lockfile": "^4.1.2"
|
|
198
198
|
},
|