@gscdump/engine 0.35.2 → 0.35.4
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/THIRD-PARTY-LICENSES.md +2 -2
- package/dist/_chunks/libs/hyparquet.mjs +388 -122
- package/dist/_chunks/libs/icebird.mjs +18 -27
- package/dist/_chunks/resolver.mjs +0 -1
- package/dist/_chunks/sink.d.mts +11 -31
- package/dist/iceberg/index.mjs +9 -1
- package/dist/ingest.mjs +1 -1
- package/package.json +7 -7
|
@@ -35,11 +35,11 @@ Repository: https://github.com/101arrowz/fzstd
|
|
|
35
35
|
|
|
36
36
|
---------------------------------------
|
|
37
37
|
|
|
38
|
-
## hyparquet, hyparquet-compressors, hyparquet-writer, icebird, squirreling
|
|
38
|
+
## hyparquet, hyparquet, hyparquet-compressors, hyparquet-writer, icebird, squirreling
|
|
39
39
|
|
|
40
40
|
License: MIT
|
|
41
41
|
By: Hyperparam
|
|
42
|
-
Repositories: https://github.com/hyparam/hyparquet, https://github.com/hyparam/hyparquet-compressors, https://github.com/hyparam/hyparquet-writer, https://github.com/hyparam/icebird, https://github.com/hyparam/squirreling
|
|
42
|
+
Repositories: https://github.com/hyparam/hyparquet, https://github.com/hyparam/hyparquet, https://github.com/hyparam/hyparquet-compressors, https://github.com/hyparam/hyparquet-writer, https://github.com/hyparam/icebird, https://github.com/hyparam/squirreling
|
|
43
43
|
|
|
44
44
|
> The MIT License (MIT)
|
|
45
45
|
>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const ParquetTypes = [
|
|
1
|
+
const ParquetTypes$1 = [
|
|
2
2
|
"BOOLEAN",
|
|
3
3
|
"INT32",
|
|
4
4
|
"INT64",
|
|
@@ -8,7 +8,7 @@ const ParquetTypes = [
|
|
|
8
8
|
"BYTE_ARRAY",
|
|
9
9
|
"FIXED_LEN_BYTE_ARRAY"
|
|
10
10
|
];
|
|
11
|
-
const Encodings = [
|
|
11
|
+
const Encodings$1 = [
|
|
12
12
|
"PLAIN",
|
|
13
13
|
"GROUP_VAR_INT",
|
|
14
14
|
"PLAIN_DICTIONARY",
|
|
@@ -20,12 +20,12 @@ const Encodings = [
|
|
|
20
20
|
"RLE_DICTIONARY",
|
|
21
21
|
"BYTE_STREAM_SPLIT"
|
|
22
22
|
];
|
|
23
|
-
const FieldRepetitionTypes = [
|
|
23
|
+
const FieldRepetitionTypes$1 = [
|
|
24
24
|
"REQUIRED",
|
|
25
25
|
"OPTIONAL",
|
|
26
26
|
"REPEATED"
|
|
27
27
|
];
|
|
28
|
-
const ConvertedTypes = [
|
|
28
|
+
const ConvertedTypes$1 = [
|
|
29
29
|
"UTF8",
|
|
30
30
|
"MAP",
|
|
31
31
|
"MAP_KEY_VALUE",
|
|
@@ -49,7 +49,7 @@ const ConvertedTypes = [
|
|
|
49
49
|
"BSON",
|
|
50
50
|
"INTERVAL"
|
|
51
51
|
];
|
|
52
|
-
const CompressionCodecs = [
|
|
52
|
+
const CompressionCodecs$1 = [
|
|
53
53
|
"UNCOMPRESSED",
|
|
54
54
|
"SNAPPY",
|
|
55
55
|
"GZIP",
|
|
@@ -59,18 +59,13 @@ const CompressionCodecs = [
|
|
|
59
59
|
"ZSTD",
|
|
60
60
|
"LZ4_RAW"
|
|
61
61
|
];
|
|
62
|
-
const PageTypes = [
|
|
62
|
+
const PageTypes$1 = [
|
|
63
63
|
"DATA_PAGE",
|
|
64
64
|
"INDEX_PAGE",
|
|
65
65
|
"DICTIONARY_PAGE",
|
|
66
66
|
"DATA_PAGE_V2"
|
|
67
67
|
];
|
|
68
|
-
const
|
|
69
|
-
"UNORDERED",
|
|
70
|
-
"ASCENDING",
|
|
71
|
-
"DESCENDING"
|
|
72
|
-
];
|
|
73
|
-
const EdgeInterpolationAlgorithms = [
|
|
68
|
+
const EdgeInterpolationAlgorithms$1 = [
|
|
74
69
|
"SPHERICAL",
|
|
75
70
|
"VINCENTY",
|
|
76
71
|
"THOMAS",
|
|
@@ -170,7 +165,7 @@ function readPolygon(reader, flags) {
|
|
|
170
165
|
}
|
|
171
166
|
return rings;
|
|
172
167
|
}
|
|
173
|
-
const decoder$
|
|
168
|
+
const decoder$5 = new TextDecoder();
|
|
174
169
|
const DEFAULT_PARSERS = {
|
|
175
170
|
timestampFromMilliseconds(millis) {
|
|
176
171
|
return new Date(Number(millis));
|
|
@@ -185,7 +180,10 @@ const DEFAULT_PARSERS = {
|
|
|
185
180
|
return /* @__PURE__ */ new Date(days * 864e5);
|
|
186
181
|
},
|
|
187
182
|
stringFromBytes(bytes) {
|
|
188
|
-
return bytes && decoder$
|
|
183
|
+
return bytes && decoder$5.decode(bytes);
|
|
184
|
+
},
|
|
185
|
+
jsonFromBytes(bytes) {
|
|
186
|
+
return bytes && JSON.parse(decoder$5.decode(bytes));
|
|
189
187
|
},
|
|
190
188
|
geometryFromBytes(bytes) {
|
|
191
189
|
return bytes && wkbToGeojson({
|
|
@@ -229,7 +227,7 @@ function convert(data, columnDecoder) {
|
|
|
229
227
|
if (ctype === "DATE") return Array.from(data).map((v) => parsers.dateFromDays(v));
|
|
230
228
|
if (ctype === "TIMESTAMP_MILLIS") return Array.from(data).map((v) => parsers.timestampFromMilliseconds(v));
|
|
231
229
|
if (ctype === "TIMESTAMP_MICROS") return Array.from(data).map((v) => parsers.timestampFromMicroseconds(v));
|
|
232
|
-
if (ctype === "JSON") return data.map((v) =>
|
|
230
|
+
if (ctype === "JSON") return data.map((v) => parsers.jsonFromBytes(v));
|
|
233
231
|
if (ctype === "BSON") throw new Error("parquet bson not supported");
|
|
234
232
|
if (ctype === "INTERVAL") throw new Error("parquet interval not supported");
|
|
235
233
|
if (ltype?.type === "GEOMETRY") return data.map((v) => parsers.geometryFromBytes(v));
|
|
@@ -283,13 +281,13 @@ function parseFloat16(bytes) {
|
|
|
283
281
|
if (exp === 31) return frac ? NaN : sign * Infinity;
|
|
284
282
|
return sign * 2 ** (exp - 15) * (1 + frac / 1024);
|
|
285
283
|
}
|
|
286
|
-
function schemaTree(schema, rootIndex, path) {
|
|
284
|
+
function schemaTree$1(schema, rootIndex, path) {
|
|
287
285
|
const element = schema[rootIndex];
|
|
288
286
|
const children = [];
|
|
289
287
|
let count = 1;
|
|
290
288
|
if (element.num_children) while (children.length < element.num_children) {
|
|
291
289
|
const childElement = schema[rootIndex + count];
|
|
292
|
-
const child = schemaTree(schema, rootIndex + count, [...path, childElement.name]);
|
|
290
|
+
const child = schemaTree$1(schema, rootIndex + count, [...path, childElement.name]);
|
|
293
291
|
count += child.count;
|
|
294
292
|
children.push(child);
|
|
295
293
|
}
|
|
@@ -300,8 +298,8 @@ function schemaTree(schema, rootIndex, path) {
|
|
|
300
298
|
path
|
|
301
299
|
};
|
|
302
300
|
}
|
|
303
|
-
function getSchemaPath(schema, name) {
|
|
304
|
-
let tree = schemaTree(schema, 0, []);
|
|
301
|
+
function getSchemaPath$1(schema, name) {
|
|
302
|
+
let tree = schemaTree$1(schema, 0, []);
|
|
305
303
|
const path = [tree];
|
|
306
304
|
for (const part of name) {
|
|
307
305
|
const child = tree.children.find((child) => child.element.name === part);
|
|
@@ -325,12 +323,12 @@ function getMaxRepetitionLevel(schemaPath) {
|
|
|
325
323
|
for (const { element } of schemaPath) if (element.repetition_type === "REPEATED") maxLevel++;
|
|
326
324
|
return maxLevel;
|
|
327
325
|
}
|
|
328
|
-
function getMaxDefinitionLevel(schemaPath) {
|
|
326
|
+
function getMaxDefinitionLevel$1(schemaPath) {
|
|
329
327
|
let maxLevel = 0;
|
|
330
328
|
for (const { element } of schemaPath.slice(1)) if (element.repetition_type !== "REQUIRED") maxLevel++;
|
|
331
329
|
return maxLevel;
|
|
332
330
|
}
|
|
333
|
-
function isListLike(schema) {
|
|
331
|
+
function isListLike$1(schema) {
|
|
334
332
|
if (!schema) return false;
|
|
335
333
|
if (schema.element.converted_type !== "LIST") return false;
|
|
336
334
|
if (schema.children.length > 1) return false;
|
|
@@ -339,7 +337,7 @@ function isListLike(schema) {
|
|
|
339
337
|
if (firstChild.element.repetition_type !== "REPEATED") return false;
|
|
340
338
|
return true;
|
|
341
339
|
}
|
|
342
|
-
function isMapLike(schema) {
|
|
340
|
+
function isMapLike$1(schema) {
|
|
343
341
|
if (!schema) return false;
|
|
344
342
|
if (schema.element.converted_type !== "MAP") return false;
|
|
345
343
|
if (schema.children.length > 1) return false;
|
|
@@ -466,9 +464,9 @@ function markGeoColumns(schema, key_value_metadata) {
|
|
|
466
464
|
}
|
|
467
465
|
}
|
|
468
466
|
const defaultInitialFetchSize = 1 << 19;
|
|
469
|
-
const decoder$
|
|
467
|
+
const decoder$4 = new TextDecoder();
|
|
470
468
|
function decode(value) {
|
|
471
|
-
return value && decoder$
|
|
469
|
+
return value && decoder$4.decode(value);
|
|
472
470
|
}
|
|
473
471
|
async function parquetMetadataAsync(asyncBuffer, { parsers, initialFetchSize = defaultInitialFetchSize, geoparquet = true } = {}) {
|
|
474
472
|
if (!asyncBuffer || !(asyncBuffer.byteLength >= 0)) throw new Error("parquet expected AsyncBuffer");
|
|
@@ -512,12 +510,12 @@ function parquetMetadata(arrayBuffer, { parsers, geoparquet = true } = {}) {
|
|
|
512
510
|
});
|
|
513
511
|
const version = metadata.field_1;
|
|
514
512
|
const schema = metadata.field_2.map((field) => ({
|
|
515
|
-
type: ParquetTypes[field.field_1],
|
|
513
|
+
type: ParquetTypes$1[field.field_1],
|
|
516
514
|
type_length: field.field_2,
|
|
517
|
-
repetition_type: FieldRepetitionTypes[field.field_3],
|
|
515
|
+
repetition_type: FieldRepetitionTypes$1[field.field_3],
|
|
518
516
|
name: decode(field.field_4),
|
|
519
517
|
num_children: field.field_5,
|
|
520
|
-
converted_type: ConvertedTypes[field.field_6],
|
|
518
|
+
converted_type: ConvertedTypes$1[field.field_6],
|
|
521
519
|
scale: field.field_7,
|
|
522
520
|
precision: field.field_8,
|
|
523
521
|
field_id: field.field_9,
|
|
@@ -530,10 +528,10 @@ function parquetMetadata(arrayBuffer, { parsers, geoparquet = true } = {}) {
|
|
|
530
528
|
file_path: decode(column.field_1),
|
|
531
529
|
file_offset: column.field_2,
|
|
532
530
|
meta_data: column.field_3 && {
|
|
533
|
-
type: ParquetTypes[column.field_3.field_1],
|
|
534
|
-
encodings: column.field_3.field_2?.map((e) => Encodings[e]),
|
|
531
|
+
type: ParquetTypes$1[column.field_3.field_1],
|
|
532
|
+
encodings: column.field_3.field_2?.map((e) => Encodings$1[e]),
|
|
535
533
|
path_in_schema: column.field_3.field_3.map(decode),
|
|
536
|
-
codec: CompressionCodecs[column.field_3.field_4],
|
|
534
|
+
codec: CompressionCodecs$1[column.field_3.field_4],
|
|
537
535
|
num_values: column.field_3.field_5,
|
|
538
536
|
total_uncompressed_size: column.field_3.field_6,
|
|
539
537
|
total_compressed_size: column.field_3.field_7,
|
|
@@ -546,8 +544,8 @@ function parquetMetadata(arrayBuffer, { parsers, geoparquet = true } = {}) {
|
|
|
546
544
|
dictionary_page_offset: column.field_3.field_11,
|
|
547
545
|
statistics: convertStats(column.field_3.field_12, columnSchema[columnIndex], parsers),
|
|
548
546
|
encoding_stats: column.field_3.field_13?.map((encodingStat) => ({
|
|
549
|
-
page_type: PageTypes[encodingStat.field_1],
|
|
550
|
-
encoding: Encodings[encodingStat.field_2],
|
|
547
|
+
page_type: PageTypes$1[encodingStat.field_1],
|
|
548
|
+
encoding: Encodings$1[encodingStat.field_2],
|
|
551
549
|
count: encodingStat.field_3
|
|
552
550
|
})),
|
|
553
551
|
bloom_filter_offset: column.field_3.field_14,
|
|
@@ -606,7 +604,7 @@ function parquetMetadata(arrayBuffer, { parsers, geoparquet = true } = {}) {
|
|
|
606
604
|
};
|
|
607
605
|
}
|
|
608
606
|
function parquetSchema({ schema }) {
|
|
609
|
-
return getSchemaPath(schema, [])[0];
|
|
607
|
+
return getSchemaPath$1(schema, [])[0];
|
|
610
608
|
}
|
|
611
609
|
function logicalType(logicalType) {
|
|
612
610
|
if (logicalType?.field_1) return { type: "STRING" };
|
|
@@ -650,7 +648,7 @@ function logicalType(logicalType) {
|
|
|
650
648
|
if (logicalType?.field_18) return {
|
|
651
649
|
type: "GEOGRAPHY",
|
|
652
650
|
crs: decode(logicalType.field_18.field_1),
|
|
653
|
-
algorithm: EdgeInterpolationAlgorithms[logicalType.field_18.field_2]
|
|
651
|
+
algorithm: EdgeInterpolationAlgorithms$1[logicalType.field_18.field_2]
|
|
654
652
|
};
|
|
655
653
|
return logicalType;
|
|
656
654
|
}
|
|
@@ -705,75 +703,75 @@ function readOffsetIndex(reader) {
|
|
|
705
703
|
unencoded_byte_array_data_bytes: thrift.field_2
|
|
706
704
|
};
|
|
707
705
|
}
|
|
708
|
-
const MASK = 18446744073709551615n;
|
|
709
|
-
const PRIME1 = 11400714785074694791n;
|
|
710
|
-
const PRIME2 = 14029467366897019727n;
|
|
711
|
-
const PRIME3 = 1609587929392839161n;
|
|
712
|
-
const PRIME4 = 9650029242287828579n;
|
|
713
|
-
const PRIME5 = 2870177450012600261n;
|
|
714
|
-
function rotl64(x, r) {
|
|
715
|
-
return (x << r | x >> 64n - r) & MASK;
|
|
716
|
-
}
|
|
717
|
-
function round(acc, val) {
|
|
718
|
-
acc = acc + val * PRIME2 & MASK;
|
|
719
|
-
acc = rotl64(acc, 31n);
|
|
720
|
-
return acc * PRIME1 & MASK;
|
|
721
|
-
}
|
|
722
|
-
function mergeRound(acc, val) {
|
|
723
|
-
acc ^= round(0n, val);
|
|
724
|
-
return acc * PRIME1 + PRIME4 & MASK;
|
|
725
|
-
}
|
|
726
|
-
function xxhash64(input, seed = 0n) {
|
|
706
|
+
const MASK$1 = 18446744073709551615n;
|
|
707
|
+
const PRIME1$1 = 11400714785074694791n;
|
|
708
|
+
const PRIME2$1 = 14029467366897019727n;
|
|
709
|
+
const PRIME3$1 = 1609587929392839161n;
|
|
710
|
+
const PRIME4$1 = 9650029242287828579n;
|
|
711
|
+
const PRIME5$1 = 2870177450012600261n;
|
|
712
|
+
function rotl64$1(x, r) {
|
|
713
|
+
return (x << r | x >> 64n - r) & MASK$1;
|
|
714
|
+
}
|
|
715
|
+
function round$1(acc, val) {
|
|
716
|
+
acc = acc + val * PRIME2$1 & MASK$1;
|
|
717
|
+
acc = rotl64$1(acc, 31n);
|
|
718
|
+
return acc * PRIME1$1 & MASK$1;
|
|
719
|
+
}
|
|
720
|
+
function mergeRound$1(acc, val) {
|
|
721
|
+
acc ^= round$1(0n, val);
|
|
722
|
+
return acc * PRIME1$1 + PRIME4$1 & MASK$1;
|
|
723
|
+
}
|
|
724
|
+
function xxhash64$1(input, seed = 0n) {
|
|
727
725
|
const view = new DataView(input.buffer, input.byteOffset, input.byteLength);
|
|
728
726
|
const len = input.byteLength;
|
|
729
727
|
let offset = 0;
|
|
730
728
|
let h64;
|
|
731
729
|
if (len >= 32) {
|
|
732
|
-
let v1 = seed + PRIME1 + PRIME2 & MASK;
|
|
733
|
-
let v2 = seed + PRIME2 & MASK;
|
|
730
|
+
let v1 = seed + PRIME1$1 + PRIME2$1 & MASK$1;
|
|
731
|
+
let v2 = seed + PRIME2$1 & MASK$1;
|
|
734
732
|
let v3 = seed;
|
|
735
|
-
let v4 = seed - PRIME1 & MASK;
|
|
733
|
+
let v4 = seed - PRIME1$1 & MASK$1;
|
|
736
734
|
while (offset + 32 <= len) {
|
|
737
|
-
v1 = round(v1, view.getBigUint64(offset, true));
|
|
735
|
+
v1 = round$1(v1, view.getBigUint64(offset, true));
|
|
738
736
|
offset += 8;
|
|
739
|
-
v2 = round(v2, view.getBigUint64(offset, true));
|
|
737
|
+
v2 = round$1(v2, view.getBigUint64(offset, true));
|
|
740
738
|
offset += 8;
|
|
741
|
-
v3 = round(v3, view.getBigUint64(offset, true));
|
|
739
|
+
v3 = round$1(v3, view.getBigUint64(offset, true));
|
|
742
740
|
offset += 8;
|
|
743
|
-
v4 = round(v4, view.getBigUint64(offset, true));
|
|
741
|
+
v4 = round$1(v4, view.getBigUint64(offset, true));
|
|
744
742
|
offset += 8;
|
|
745
743
|
}
|
|
746
|
-
h64 = rotl64(v1, 1n) + rotl64(v2, 7n) + rotl64(v3, 12n) + rotl64(v4, 18n) & MASK;
|
|
747
|
-
h64 = mergeRound(h64, v1);
|
|
748
|
-
h64 = mergeRound(h64, v2);
|
|
749
|
-
h64 = mergeRound(h64, v3);
|
|
750
|
-
h64 = mergeRound(h64, v4);
|
|
751
|
-
} else h64 = seed + PRIME5 & MASK;
|
|
752
|
-
h64 = h64 + BigInt(len) & MASK;
|
|
744
|
+
h64 = rotl64$1(v1, 1n) + rotl64$1(v2, 7n) + rotl64$1(v3, 12n) + rotl64$1(v4, 18n) & MASK$1;
|
|
745
|
+
h64 = mergeRound$1(h64, v1);
|
|
746
|
+
h64 = mergeRound$1(h64, v2);
|
|
747
|
+
h64 = mergeRound$1(h64, v3);
|
|
748
|
+
h64 = mergeRound$1(h64, v4);
|
|
749
|
+
} else h64 = seed + PRIME5$1 & MASK$1;
|
|
750
|
+
h64 = h64 + BigInt(len) & MASK$1;
|
|
753
751
|
while (offset + 8 <= len) {
|
|
754
|
-
h64 ^= round(0n, view.getBigUint64(offset, true));
|
|
755
|
-
h64 = rotl64(h64, 27n) * PRIME1 + PRIME4 & MASK;
|
|
752
|
+
h64 ^= round$1(0n, view.getBigUint64(offset, true));
|
|
753
|
+
h64 = rotl64$1(h64, 27n) * PRIME1$1 + PRIME4$1 & MASK$1;
|
|
756
754
|
offset += 8;
|
|
757
755
|
}
|
|
758
756
|
if (offset + 4 <= len) {
|
|
759
|
-
h64 ^= BigInt(view.getUint32(offset, true)) * PRIME1 & MASK;
|
|
760
|
-
h64 = rotl64(h64, 23n) * PRIME2 + PRIME3 & MASK;
|
|
757
|
+
h64 ^= BigInt(view.getUint32(offset, true)) * PRIME1$1 & MASK$1;
|
|
758
|
+
h64 = rotl64$1(h64, 23n) * PRIME2$1 + PRIME3$1 & MASK$1;
|
|
761
759
|
offset += 4;
|
|
762
760
|
}
|
|
763
761
|
while (offset < len) {
|
|
764
|
-
h64 ^= BigInt(view.getUint8(offset)) * PRIME5 & MASK;
|
|
765
|
-
h64 = rotl64(h64, 11n) * PRIME1 & MASK;
|
|
762
|
+
h64 ^= BigInt(view.getUint8(offset)) * PRIME5$1 & MASK$1;
|
|
763
|
+
h64 = rotl64$1(h64, 11n) * PRIME1$1 & MASK$1;
|
|
766
764
|
offset += 1;
|
|
767
765
|
}
|
|
768
766
|
h64 ^= h64 >> 33n;
|
|
769
|
-
h64 = h64 * PRIME2 & MASK;
|
|
767
|
+
h64 = h64 * PRIME2$1 & MASK$1;
|
|
770
768
|
h64 ^= h64 >> 29n;
|
|
771
|
-
h64 = h64 * PRIME3 & MASK;
|
|
769
|
+
h64 = h64 * PRIME3$1 & MASK$1;
|
|
772
770
|
h64 ^= h64 >> 32n;
|
|
773
771
|
return h64;
|
|
774
772
|
}
|
|
775
|
-
const textEncoder = new TextEncoder();
|
|
776
|
-
const SALT = new Uint32Array([
|
|
773
|
+
const textEncoder$1 = new TextEncoder();
|
|
774
|
+
const SALT$1 = new Uint32Array([
|
|
777
775
|
1203114875,
|
|
778
776
|
1150766481,
|
|
779
777
|
2284105051,
|
|
@@ -789,7 +787,7 @@ function blockIndex(hash, numBlocks) {
|
|
|
789
787
|
function blockMask(hash) {
|
|
790
788
|
const m = /* @__PURE__ */ new Uint32Array(8);
|
|
791
789
|
const low = Number(hash & 4294967295n) | 0;
|
|
792
|
-
for (let i = 0; i < 8; i++) m[i] = 1 << (Math.imul(low, SALT[i]) >>> 27);
|
|
790
|
+
for (let i = 0; i < 8; i++) m[i] = 1 << (Math.imul(low, SALT$1[i]) >>> 27);
|
|
793
791
|
return m;
|
|
794
792
|
}
|
|
795
793
|
function sbbfContains(blocks, hash) {
|
|
@@ -815,24 +813,24 @@ function readBloomFilter(reader) {
|
|
|
815
813
|
blocks
|
|
816
814
|
};
|
|
817
815
|
}
|
|
818
|
-
function hashParquetValue(value, element) {
|
|
816
|
+
function hashParquetValue$1(value, element) {
|
|
819
817
|
if (value === null || value === void 0) return void 0;
|
|
820
818
|
const { type, converted_type, logical_type } = element;
|
|
821
819
|
if (type === "BOOLEAN") {
|
|
822
820
|
if (typeof value !== "boolean") return void 0;
|
|
823
|
-
return xxhash64(new Uint8Array([value ? 1 : 0]));
|
|
821
|
+
return xxhash64$1(new Uint8Array([value ? 1 : 0]));
|
|
824
822
|
}
|
|
825
823
|
if (type === "FLOAT") {
|
|
826
824
|
if (typeof value !== "number") return void 0;
|
|
827
825
|
const buf = /* @__PURE__ */ new ArrayBuffer(4);
|
|
828
826
|
new DataView(buf).setFloat32(0, value, true);
|
|
829
|
-
return xxhash64(new Uint8Array(buf));
|
|
827
|
+
return xxhash64$1(new Uint8Array(buf));
|
|
830
828
|
}
|
|
831
829
|
if (type === "DOUBLE") {
|
|
832
830
|
if (typeof value !== "number") return void 0;
|
|
833
831
|
const buf = /* @__PURE__ */ new ArrayBuffer(8);
|
|
834
832
|
new DataView(buf).setFloat64(0, value, true);
|
|
835
|
-
return xxhash64(new Uint8Array(buf));
|
|
833
|
+
return xxhash64$1(new Uint8Array(buf));
|
|
836
834
|
}
|
|
837
835
|
if (type === "INT32") {
|
|
838
836
|
if (converted_type === "DATE" || converted_type === "DECIMAL" || converted_type === "TIME_MILLIS") return void 0;
|
|
@@ -840,7 +838,7 @@ function hashParquetValue(value, element) {
|
|
|
840
838
|
if (typeof value !== "number" || !Number.isInteger(value)) return void 0;
|
|
841
839
|
const buf = /* @__PURE__ */ new ArrayBuffer(4);
|
|
842
840
|
new DataView(buf).setInt32(0, value | 0, true);
|
|
843
|
-
return xxhash64(new Uint8Array(buf));
|
|
841
|
+
return xxhash64$1(new Uint8Array(buf));
|
|
844
842
|
}
|
|
845
843
|
if (type === "INT64") {
|
|
846
844
|
if (converted_type === "TIMESTAMP_MILLIS" || converted_type === "TIMESTAMP_MICROS") return void 0;
|
|
@@ -852,21 +850,21 @@ function hashParquetValue(value, element) {
|
|
|
852
850
|
else return void 0;
|
|
853
851
|
const buf = /* @__PURE__ */ new ArrayBuffer(8);
|
|
854
852
|
new DataView(buf).setBigUint64(0, BigInt.asUintN(64, bigValue), true);
|
|
855
|
-
return xxhash64(new Uint8Array(buf));
|
|
853
|
+
return xxhash64$1(new Uint8Array(buf));
|
|
856
854
|
}
|
|
857
855
|
if (type === "BYTE_ARRAY") {
|
|
858
856
|
if (converted_type === "JSON" || converted_type === "BSON" || converted_type === "DECIMAL") return void 0;
|
|
859
857
|
if (logical_type?.type === "JSON" || logical_type?.type === "BSON" || logical_type?.type === "VARIANT") return void 0;
|
|
860
858
|
if (logical_type?.type === "GEOMETRY" || logical_type?.type === "GEOGRAPHY") return void 0;
|
|
861
|
-
if (typeof value === "string") return xxhash64(textEncoder.encode(value));
|
|
862
|
-
if (value instanceof Uint8Array) return xxhash64(value);
|
|
859
|
+
if (typeof value === "string") return xxhash64$1(textEncoder$1.encode(value));
|
|
860
|
+
if (value instanceof Uint8Array) return xxhash64$1(value);
|
|
863
861
|
return;
|
|
864
862
|
}
|
|
865
863
|
if (type === "FIXED_LEN_BYTE_ARRAY") {
|
|
866
864
|
if (converted_type === "DECIMAL" || converted_type === "INTERVAL") return void 0;
|
|
867
865
|
if (logical_type?.type === "DECIMAL" || logical_type?.type === "UUID" || logical_type?.type === "FLOAT16") return void 0;
|
|
868
866
|
if (logical_type?.type === "GEOMETRY" || logical_type?.type === "GEOGRAPHY") return void 0;
|
|
869
|
-
if (value instanceof Uint8Array) return xxhash64(value);
|
|
867
|
+
if (value instanceof Uint8Array) return xxhash64$1(value);
|
|
870
868
|
return;
|
|
871
869
|
}
|
|
872
870
|
}
|
|
@@ -893,23 +891,6 @@ function walkBloomEligible(filter, out) {
|
|
|
893
891
|
} else out.add(field);
|
|
894
892
|
}
|
|
895
893
|
}
|
|
896
|
-
function toJson(obj) {
|
|
897
|
-
if (obj === void 0) return null;
|
|
898
|
-
if (typeof obj === "bigint") return Number(obj);
|
|
899
|
-
if (Object.is(obj, -0)) return 0;
|
|
900
|
-
if (Array.isArray(obj)) return obj.map(toJson);
|
|
901
|
-
if (obj instanceof Uint8Array) return Array.from(obj);
|
|
902
|
-
if (obj instanceof Date) return obj.toISOString();
|
|
903
|
-
if (obj instanceof Object) {
|
|
904
|
-
const newObj = {};
|
|
905
|
-
for (const key of Object.keys(obj)) {
|
|
906
|
-
if (obj[key] === void 0) continue;
|
|
907
|
-
newObj[key] = toJson(obj[key]);
|
|
908
|
-
}
|
|
909
|
-
return newObj;
|
|
910
|
-
}
|
|
911
|
-
return obj;
|
|
912
|
-
}
|
|
913
894
|
function concat(aaa, bbb) {
|
|
914
895
|
const chunk = 1e4;
|
|
915
896
|
for (let i = 0; i < bbb.length; i += chunk) aaa.push(...bbb.slice(i, i + chunk));
|
|
@@ -1072,13 +1053,13 @@ function canSkipRowGroup({ rowGroup, physicalColumns, filter, strict = true, blo
|
|
|
1072
1053
|
}
|
|
1073
1054
|
if (bloom && element) {
|
|
1074
1055
|
if (operator === "$eq") {
|
|
1075
|
-
const hash = hashParquetValue(target, element);
|
|
1056
|
+
const hash = hashParquetValue$1(target, element);
|
|
1076
1057
|
if (hash !== void 0 && !sbbfContains(bloom.blocks, hash)) return true;
|
|
1077
1058
|
}
|
|
1078
1059
|
if (operator === "$in" && Array.isArray(target) && target.length > 0) {
|
|
1079
1060
|
let allAbsent = true;
|
|
1080
1061
|
for (const v of target) {
|
|
1081
|
-
const h = hashParquetValue(v, element);
|
|
1062
|
+
const h = hashParquetValue$1(v, element);
|
|
1082
1063
|
if (h === void 0 || sbbfContains(bloom.blocks, h)) {
|
|
1083
1064
|
allAbsent = false;
|
|
1084
1065
|
break;
|
|
@@ -1238,7 +1219,7 @@ function prefetchAsyncBuffer(file, { fetches }) {
|
|
|
1238
1219
|
}
|
|
1239
1220
|
};
|
|
1240
1221
|
}
|
|
1241
|
-
const decoder = new TextDecoder();
|
|
1222
|
+
const decoder$3 = new TextDecoder();
|
|
1242
1223
|
const metadataCache = /* @__PURE__ */ new WeakMap();
|
|
1243
1224
|
function decodeVariantColumn(value, parsers = DEFAULT_PARSERS) {
|
|
1244
1225
|
if (Array.isArray(value)) return value.map((entry) => decodeVariantColumn(entry, parsers));
|
|
@@ -1302,7 +1283,7 @@ function parseVariantMetadata(bytes) {
|
|
|
1302
1283
|
const start = offsets[i];
|
|
1303
1284
|
const end = offsets[i + 1];
|
|
1304
1285
|
const strBytes = new Uint8Array(bytes.buffer, bytes.byteOffset + base + start, end - start);
|
|
1305
|
-
dictionary[i] = decoder.decode(strBytes);
|
|
1286
|
+
dictionary[i] = decoder$3.decode(strBytes);
|
|
1306
1287
|
}
|
|
1307
1288
|
const metadata = {
|
|
1308
1289
|
dictionary,
|
|
@@ -1326,7 +1307,7 @@ function readVariant(reader, metadata, parsers) {
|
|
|
1326
1307
|
if (basicType === 3) return readVariantArray(reader, header, metadata, parsers);
|
|
1327
1308
|
const bytes = new Uint8Array(reader.view.buffer, reader.view.byteOffset + reader.offset, header);
|
|
1328
1309
|
reader.offset += header;
|
|
1329
|
-
return decoder.decode(bytes);
|
|
1310
|
+
return decoder$3.decode(bytes);
|
|
1330
1311
|
}
|
|
1331
1312
|
function readVariantPrimitive(reader, typeId, parsers) {
|
|
1332
1313
|
switch (typeId) {
|
|
@@ -1380,7 +1361,7 @@ function readVariantPrimitive(reader, typeId, parsers) {
|
|
|
1380
1361
|
case 15: return readVariantBinary(reader);
|
|
1381
1362
|
case 16: {
|
|
1382
1363
|
const bytes = readVariantBinary(reader);
|
|
1383
|
-
return decoder.decode(bytes);
|
|
1364
|
+
return decoder$3.decode(bytes);
|
|
1384
1365
|
}
|
|
1385
1366
|
case 17: {
|
|
1386
1367
|
const value = reader.view.getBigInt64(reader.offset, true);
|
|
@@ -1462,7 +1443,7 @@ function readVariantBinary(reader) {
|
|
|
1462
1443
|
return bytes;
|
|
1463
1444
|
}
|
|
1464
1445
|
function assembleLists(output, definitionLevels, repetitionLevels, values, schemaPath) {
|
|
1465
|
-
const maxDefinitionLevel = getMaxDefinitionLevel(schemaPath);
|
|
1446
|
+
const maxDefinitionLevel = getMaxDefinitionLevel$1(schemaPath);
|
|
1466
1447
|
if (!definitionLevels?.length && !repetitionLevels.length) {
|
|
1467
1448
|
if (!maxDefinitionLevel || !values.length) return values;
|
|
1468
1449
|
definitionLevels = new Array(values.length).fill(maxDefinitionLevel);
|
|
@@ -1522,7 +1503,7 @@ function assembleNested(subcolumnData, schema, parsers, depth = 0) {
|
|
|
1522
1503
|
const path = schema.path.join(".");
|
|
1523
1504
|
const optional = schema.element.repetition_type === "OPTIONAL";
|
|
1524
1505
|
const nextDepth = optional ? depth + 1 : depth;
|
|
1525
|
-
if (isListLike(schema)) {
|
|
1506
|
+
if (isListLike$1(schema)) {
|
|
1526
1507
|
let sublist = schema.children[0];
|
|
1527
1508
|
let subDepth = nextDepth;
|
|
1528
1509
|
if (sublist.children.length === 1) {
|
|
@@ -1538,7 +1519,7 @@ function assembleNested(subcolumnData, schema, parsers, depth = 0) {
|
|
|
1538
1519
|
subcolumnData.delete(subcolumn);
|
|
1539
1520
|
return;
|
|
1540
1521
|
}
|
|
1541
|
-
if (isMapLike(schema)) {
|
|
1522
|
+
if (isMapLike$1(schema)) {
|
|
1542
1523
|
const mapName = schema.children[0].element.name;
|
|
1543
1524
|
assembleNested(subcolumnData, schema.children[0].children[0], parsers, nextDepth + 1);
|
|
1544
1525
|
assembleNested(subcolumnData, schema.children[0].children[1], parsers, nextDepth + 1);
|
|
@@ -1931,7 +1912,7 @@ function readRepetitionLevels(reader, daph, schemaPath) {
|
|
|
1931
1912
|
return [];
|
|
1932
1913
|
}
|
|
1933
1914
|
function readDefinitionLevels(reader, daph, schemaPath) {
|
|
1934
|
-
const maxDefinitionLevel = getMaxDefinitionLevel(schemaPath);
|
|
1915
|
+
const maxDefinitionLevel = getMaxDefinitionLevel$1(schemaPath);
|
|
1935
1916
|
if (!maxDefinitionLevel) return {
|
|
1936
1917
|
definitionLevels: [],
|
|
1937
1918
|
numNulls: 0
|
|
@@ -2013,7 +1994,7 @@ function readRepetitionLevelsV2(reader, daph2, schemaPath) {
|
|
|
2013
1994
|
return values;
|
|
2014
1995
|
}
|
|
2015
1996
|
function readDefinitionLevelsV2(reader, daph2, schemaPath) {
|
|
2016
|
-
const maxDefinitionLevel = getMaxDefinitionLevel(schemaPath);
|
|
1997
|
+
const maxDefinitionLevel = getMaxDefinitionLevel$1(schemaPath);
|
|
2017
1998
|
if (maxDefinitionLevel) {
|
|
2018
1999
|
const values = new Array(daph2.num_values);
|
|
2019
2000
|
readRleBitPackedHybrid(reader, bitWidth(maxDefinitionLevel), values, daph2.definition_levels_byte_length);
|
|
@@ -2106,15 +2087,15 @@ function readPage(reader, header, columnDecoder, dictionary, previousChunk, page
|
|
|
2106
2087
|
function parquetHeader(reader) {
|
|
2107
2088
|
const header = deserializeTCompactProtocol(reader);
|
|
2108
2089
|
return {
|
|
2109
|
-
type: PageTypes[header.field_1],
|
|
2090
|
+
type: PageTypes$1[header.field_1],
|
|
2110
2091
|
uncompressed_page_size: header.field_2,
|
|
2111
2092
|
compressed_page_size: header.field_3,
|
|
2112
2093
|
crc: header.field_4,
|
|
2113
2094
|
data_page_header: header.field_5 && {
|
|
2114
2095
|
num_values: header.field_5.field_1,
|
|
2115
|
-
encoding: Encodings[header.field_5.field_2],
|
|
2116
|
-
definition_level_encoding: Encodings[header.field_5.field_3],
|
|
2117
|
-
repetition_level_encoding: Encodings[header.field_5.field_4],
|
|
2096
|
+
encoding: Encodings$1[header.field_5.field_2],
|
|
2097
|
+
definition_level_encoding: Encodings$1[header.field_5.field_3],
|
|
2098
|
+
repetition_level_encoding: Encodings$1[header.field_5.field_4],
|
|
2118
2099
|
statistics: header.field_5.field_5 && {
|
|
2119
2100
|
max: header.field_5.field_5.field_1,
|
|
2120
2101
|
min: header.field_5.field_5.field_2,
|
|
@@ -2127,14 +2108,14 @@ function parquetHeader(reader) {
|
|
|
2127
2108
|
index_page_header: header.field_6,
|
|
2128
2109
|
dictionary_page_header: header.field_7 && {
|
|
2129
2110
|
num_values: header.field_7.field_1,
|
|
2130
|
-
encoding: Encodings[header.field_7.field_2],
|
|
2111
|
+
encoding: Encodings$1[header.field_7.field_2],
|
|
2131
2112
|
is_sorted: header.field_7.field_3
|
|
2132
2113
|
},
|
|
2133
2114
|
data_page_header_v2: header.field_8 && {
|
|
2134
2115
|
num_values: header.field_8.field_1,
|
|
2135
2116
|
num_nulls: header.field_8.field_2,
|
|
2136
2117
|
num_rows: header.field_8.field_3,
|
|
2137
|
-
encoding: Encodings[header.field_8.field_4],
|
|
2118
|
+
encoding: Encodings$1[header.field_8.field_4],
|
|
2138
2119
|
definition_levels_byte_length: header.field_8.field_5,
|
|
2139
2120
|
repetition_levels_byte_length: header.field_8.field_6,
|
|
2140
2121
|
is_compressed: header.field_8.field_7 === void 0 ? true : header.field_8.field_7,
|
|
@@ -2146,7 +2127,7 @@ function readRowGroup(options, { metadata }, groupPlan) {
|
|
|
2146
2127
|
const asyncColumns = [];
|
|
2147
2128
|
for (const chunk of groupPlan.chunks) {
|
|
2148
2129
|
const { data_page_offset, dictionary_page_offset, path_in_schema: pathInSchema } = chunk.columnMetadata;
|
|
2149
|
-
const schemaPath = getSchemaPath(metadata.schema, pathInSchema);
|
|
2130
|
+
const schemaPath = getSchemaPath$1(metadata.schema, pathInSchema);
|
|
2150
2131
|
const columnDecoder = {
|
|
2151
2132
|
pathInSchema,
|
|
2152
2133
|
element: schemaPath[schemaPath.length - 1].element,
|
|
@@ -2389,4 +2370,289 @@ function parquetReadObjects(options) {
|
|
|
2389
2370
|
}).catch(reject);
|
|
2390
2371
|
});
|
|
2391
2372
|
}
|
|
2373
|
+
function schemaTree(schema, rootIndex, path) {
|
|
2374
|
+
const element = schema[rootIndex];
|
|
2375
|
+
const children = [];
|
|
2376
|
+
let count = 1;
|
|
2377
|
+
if (element.num_children) while (children.length < element.num_children) {
|
|
2378
|
+
const childElement = schema[rootIndex + count];
|
|
2379
|
+
const child = schemaTree(schema, rootIndex + count, [...path, childElement.name]);
|
|
2380
|
+
count += child.count;
|
|
2381
|
+
children.push(child);
|
|
2382
|
+
}
|
|
2383
|
+
return {
|
|
2384
|
+
count,
|
|
2385
|
+
element,
|
|
2386
|
+
children,
|
|
2387
|
+
path
|
|
2388
|
+
};
|
|
2389
|
+
}
|
|
2390
|
+
function getSchemaPath(schema, name) {
|
|
2391
|
+
let tree = schemaTree(schema, 0, []);
|
|
2392
|
+
const path = [tree];
|
|
2393
|
+
for (const part of name) {
|
|
2394
|
+
const child = tree.children.find((child) => child.element.name === part);
|
|
2395
|
+
if (!child) throw new Error(`parquet schema element not found: ${name}`);
|
|
2396
|
+
path.push(child);
|
|
2397
|
+
tree = child;
|
|
2398
|
+
}
|
|
2399
|
+
return path;
|
|
2400
|
+
}
|
|
2401
|
+
function getMaxDefinitionLevel(schemaPath) {
|
|
2402
|
+
let maxLevel = 0;
|
|
2403
|
+
for (const { element } of schemaPath.slice(1)) if (element.repetition_type !== "REQUIRED") maxLevel++;
|
|
2404
|
+
return maxLevel;
|
|
2405
|
+
}
|
|
2406
|
+
function isListLike(schema) {
|
|
2407
|
+
if (!schema) return false;
|
|
2408
|
+
if (schema.element.converted_type !== "LIST") return false;
|
|
2409
|
+
if (schema.children.length > 1) return false;
|
|
2410
|
+
const firstChild = schema.children[0];
|
|
2411
|
+
if (firstChild.children.length > 1) return false;
|
|
2412
|
+
if (firstChild.element.repetition_type !== "REPEATED") return false;
|
|
2413
|
+
return true;
|
|
2414
|
+
}
|
|
2415
|
+
function isMapLike(schema) {
|
|
2416
|
+
if (!schema) return false;
|
|
2417
|
+
if (schema.element.converted_type !== "MAP") return false;
|
|
2418
|
+
if (schema.children.length > 1) return false;
|
|
2419
|
+
const firstChild = schema.children[0];
|
|
2420
|
+
if (firstChild.children.length !== 2) return false;
|
|
2421
|
+
if (firstChild.element.repetition_type !== "REPEATED") return false;
|
|
2422
|
+
if (firstChild.children.find((child) => child.element.name === "key")?.element.repetition_type === "REPEATED") return false;
|
|
2423
|
+
if (firstChild.children.find((child) => child.element.name === "value")?.element.repetition_type === "REPEATED") return false;
|
|
2424
|
+
return true;
|
|
2425
|
+
}
|
|
2426
|
+
const MASK = 18446744073709551615n;
|
|
2427
|
+
const PRIME1 = 11400714785074694791n;
|
|
2428
|
+
const PRIME2 = 14029467366897019727n;
|
|
2429
|
+
const PRIME3 = 1609587929392839161n;
|
|
2430
|
+
const PRIME4 = 9650029242287828579n;
|
|
2431
|
+
const PRIME5 = 2870177450012600261n;
|
|
2432
|
+
function rotl64(x, r) {
|
|
2433
|
+
return (x << r | x >> 64n - r) & MASK;
|
|
2434
|
+
}
|
|
2435
|
+
function round(acc, val) {
|
|
2436
|
+
acc = acc + val * PRIME2 & MASK;
|
|
2437
|
+
acc = rotl64(acc, 31n);
|
|
2438
|
+
return acc * PRIME1 & MASK;
|
|
2439
|
+
}
|
|
2440
|
+
function mergeRound(acc, val) {
|
|
2441
|
+
acc ^= round(0n, val);
|
|
2442
|
+
return acc * PRIME1 + PRIME4 & MASK;
|
|
2443
|
+
}
|
|
2444
|
+
function xxhash64(input, seed = 0n) {
|
|
2445
|
+
const view = new DataView(input.buffer, input.byteOffset, input.byteLength);
|
|
2446
|
+
const len = input.byteLength;
|
|
2447
|
+
let offset = 0;
|
|
2448
|
+
let h64;
|
|
2449
|
+
if (len >= 32) {
|
|
2450
|
+
let v1 = seed + PRIME1 + PRIME2 & MASK;
|
|
2451
|
+
let v2 = seed + PRIME2 & MASK;
|
|
2452
|
+
let v3 = seed;
|
|
2453
|
+
let v4 = seed - PRIME1 & MASK;
|
|
2454
|
+
while (offset + 32 <= len) {
|
|
2455
|
+
v1 = round(v1, view.getBigUint64(offset, true));
|
|
2456
|
+
offset += 8;
|
|
2457
|
+
v2 = round(v2, view.getBigUint64(offset, true));
|
|
2458
|
+
offset += 8;
|
|
2459
|
+
v3 = round(v3, view.getBigUint64(offset, true));
|
|
2460
|
+
offset += 8;
|
|
2461
|
+
v4 = round(v4, view.getBigUint64(offset, true));
|
|
2462
|
+
offset += 8;
|
|
2463
|
+
}
|
|
2464
|
+
h64 = rotl64(v1, 1n) + rotl64(v2, 7n) + rotl64(v3, 12n) + rotl64(v4, 18n) & MASK;
|
|
2465
|
+
h64 = mergeRound(h64, v1);
|
|
2466
|
+
h64 = mergeRound(h64, v2);
|
|
2467
|
+
h64 = mergeRound(h64, v3);
|
|
2468
|
+
h64 = mergeRound(h64, v4);
|
|
2469
|
+
} else h64 = seed + PRIME5 & MASK;
|
|
2470
|
+
h64 = h64 + BigInt(len) & MASK;
|
|
2471
|
+
while (offset + 8 <= len) {
|
|
2472
|
+
h64 ^= round(0n, view.getBigUint64(offset, true));
|
|
2473
|
+
h64 = rotl64(h64, 27n) * PRIME1 + PRIME4 & MASK;
|
|
2474
|
+
offset += 8;
|
|
2475
|
+
}
|
|
2476
|
+
if (offset + 4 <= len) {
|
|
2477
|
+
h64 ^= BigInt(view.getUint32(offset, true)) * PRIME1 & MASK;
|
|
2478
|
+
h64 = rotl64(h64, 23n) * PRIME2 + PRIME3 & MASK;
|
|
2479
|
+
offset += 4;
|
|
2480
|
+
}
|
|
2481
|
+
while (offset < len) {
|
|
2482
|
+
h64 ^= BigInt(view.getUint8(offset)) * PRIME5 & MASK;
|
|
2483
|
+
h64 = rotl64(h64, 11n) * PRIME1 & MASK;
|
|
2484
|
+
offset += 1;
|
|
2485
|
+
}
|
|
2486
|
+
h64 ^= h64 >> 33n;
|
|
2487
|
+
h64 = h64 * PRIME2 & MASK;
|
|
2488
|
+
h64 ^= h64 >> 29n;
|
|
2489
|
+
h64 = h64 * PRIME3 & MASK;
|
|
2490
|
+
h64 ^= h64 >> 32n;
|
|
2491
|
+
return h64;
|
|
2492
|
+
}
|
|
2493
|
+
const textEncoder = new TextEncoder();
|
|
2494
|
+
new Uint32Array([
|
|
2495
|
+
1203114875,
|
|
2496
|
+
1150766481,
|
|
2497
|
+
2284105051,
|
|
2498
|
+
2729912477,
|
|
2499
|
+
1884591559,
|
|
2500
|
+
770785867,
|
|
2501
|
+
2667333959,
|
|
2502
|
+
1550580529
|
|
2503
|
+
]);
|
|
2504
|
+
function hashParquetValue(value, element) {
|
|
2505
|
+
if (value === null || value === void 0) return void 0;
|
|
2506
|
+
const { type, converted_type, logical_type } = element;
|
|
2507
|
+
if (type === "BOOLEAN") {
|
|
2508
|
+
if (typeof value !== "boolean") return void 0;
|
|
2509
|
+
return xxhash64(new Uint8Array([value ? 1 : 0]));
|
|
2510
|
+
}
|
|
2511
|
+
if (type === "FLOAT") {
|
|
2512
|
+
if (typeof value !== "number") return void 0;
|
|
2513
|
+
const buf = /* @__PURE__ */ new ArrayBuffer(4);
|
|
2514
|
+
new DataView(buf).setFloat32(0, value, true);
|
|
2515
|
+
return xxhash64(new Uint8Array(buf));
|
|
2516
|
+
}
|
|
2517
|
+
if (type === "DOUBLE") {
|
|
2518
|
+
if (typeof value !== "number") return void 0;
|
|
2519
|
+
const buf = /* @__PURE__ */ new ArrayBuffer(8);
|
|
2520
|
+
new DataView(buf).setFloat64(0, value, true);
|
|
2521
|
+
return xxhash64(new Uint8Array(buf));
|
|
2522
|
+
}
|
|
2523
|
+
if (type === "INT32") {
|
|
2524
|
+
if (converted_type === "DATE" || converted_type === "DECIMAL" || converted_type === "TIME_MILLIS") return void 0;
|
|
2525
|
+
if (logical_type?.type === "DATE" || logical_type?.type === "TIME" || logical_type?.type === "DECIMAL") return void 0;
|
|
2526
|
+
if (typeof value !== "number" || !Number.isInteger(value)) return void 0;
|
|
2527
|
+
const buf = /* @__PURE__ */ new ArrayBuffer(4);
|
|
2528
|
+
new DataView(buf).setInt32(0, value | 0, true);
|
|
2529
|
+
return xxhash64(new Uint8Array(buf));
|
|
2530
|
+
}
|
|
2531
|
+
if (type === "INT64") {
|
|
2532
|
+
if (converted_type === "TIMESTAMP_MILLIS" || converted_type === "TIMESTAMP_MICROS") return void 0;
|
|
2533
|
+
if (converted_type === "TIME_MICROS" || converted_type === "DECIMAL") return void 0;
|
|
2534
|
+
if (logical_type?.type === "TIMESTAMP" || logical_type?.type === "TIME" || logical_type?.type === "DECIMAL") return void 0;
|
|
2535
|
+
let bigValue;
|
|
2536
|
+
if (typeof value === "bigint") bigValue = value;
|
|
2537
|
+
else if (typeof value === "number" && Number.isSafeInteger(value)) bigValue = BigInt(value);
|
|
2538
|
+
else return void 0;
|
|
2539
|
+
const buf = /* @__PURE__ */ new ArrayBuffer(8);
|
|
2540
|
+
new DataView(buf).setBigUint64(0, BigInt.asUintN(64, bigValue), true);
|
|
2541
|
+
return xxhash64(new Uint8Array(buf));
|
|
2542
|
+
}
|
|
2543
|
+
if (type === "BYTE_ARRAY") {
|
|
2544
|
+
if (converted_type === "JSON" || converted_type === "BSON" || converted_type === "DECIMAL") return void 0;
|
|
2545
|
+
if (logical_type?.type === "JSON" || logical_type?.type === "BSON" || logical_type?.type === "VARIANT") return void 0;
|
|
2546
|
+
if (logical_type?.type === "GEOMETRY" || logical_type?.type === "GEOGRAPHY") return void 0;
|
|
2547
|
+
if (typeof value === "string") return xxhash64(textEncoder.encode(value));
|
|
2548
|
+
if (value instanceof Uint8Array) return xxhash64(value);
|
|
2549
|
+
return;
|
|
2550
|
+
}
|
|
2551
|
+
if (type === "FIXED_LEN_BYTE_ARRAY") {
|
|
2552
|
+
if (converted_type === "DECIMAL" || converted_type === "INTERVAL") return void 0;
|
|
2553
|
+
if (logical_type?.type === "DECIMAL" || logical_type?.type === "UUID" || logical_type?.type === "FLOAT16") return void 0;
|
|
2554
|
+
if (logical_type?.type === "GEOMETRY" || logical_type?.type === "GEOGRAPHY") return void 0;
|
|
2555
|
+
if (value instanceof Uint8Array) return xxhash64(value);
|
|
2556
|
+
return;
|
|
2557
|
+
}
|
|
2558
|
+
}
|
|
2559
|
+
const ParquetTypes = [
|
|
2560
|
+
"BOOLEAN",
|
|
2561
|
+
"INT32",
|
|
2562
|
+
"INT64",
|
|
2563
|
+
"INT96",
|
|
2564
|
+
"FLOAT",
|
|
2565
|
+
"DOUBLE",
|
|
2566
|
+
"BYTE_ARRAY",
|
|
2567
|
+
"FIXED_LEN_BYTE_ARRAY"
|
|
2568
|
+
];
|
|
2569
|
+
const Encodings = [
|
|
2570
|
+
"PLAIN",
|
|
2571
|
+
"GROUP_VAR_INT",
|
|
2572
|
+
"PLAIN_DICTIONARY",
|
|
2573
|
+
"RLE",
|
|
2574
|
+
"BIT_PACKED",
|
|
2575
|
+
"DELTA_BINARY_PACKED",
|
|
2576
|
+
"DELTA_LENGTH_BYTE_ARRAY",
|
|
2577
|
+
"DELTA_BYTE_ARRAY",
|
|
2578
|
+
"RLE_DICTIONARY",
|
|
2579
|
+
"BYTE_STREAM_SPLIT"
|
|
2580
|
+
];
|
|
2581
|
+
const FieldRepetitionTypes = [
|
|
2582
|
+
"REQUIRED",
|
|
2583
|
+
"OPTIONAL",
|
|
2584
|
+
"REPEATED"
|
|
2585
|
+
];
|
|
2586
|
+
const ConvertedTypes = [
|
|
2587
|
+
"UTF8",
|
|
2588
|
+
"MAP",
|
|
2589
|
+
"MAP_KEY_VALUE",
|
|
2590
|
+
"LIST",
|
|
2591
|
+
"ENUM",
|
|
2592
|
+
"DECIMAL",
|
|
2593
|
+
"DATE",
|
|
2594
|
+
"TIME_MILLIS",
|
|
2595
|
+
"TIME_MICROS",
|
|
2596
|
+
"TIMESTAMP_MILLIS",
|
|
2597
|
+
"TIMESTAMP_MICROS",
|
|
2598
|
+
"UINT_8",
|
|
2599
|
+
"UINT_16",
|
|
2600
|
+
"UINT_32",
|
|
2601
|
+
"UINT_64",
|
|
2602
|
+
"INT_8",
|
|
2603
|
+
"INT_16",
|
|
2604
|
+
"INT_32",
|
|
2605
|
+
"INT_64",
|
|
2606
|
+
"JSON",
|
|
2607
|
+
"BSON",
|
|
2608
|
+
"INTERVAL"
|
|
2609
|
+
];
|
|
2610
|
+
const CompressionCodecs = [
|
|
2611
|
+
"UNCOMPRESSED",
|
|
2612
|
+
"SNAPPY",
|
|
2613
|
+
"GZIP",
|
|
2614
|
+
"LZO",
|
|
2615
|
+
"BROTLI",
|
|
2616
|
+
"LZ4",
|
|
2617
|
+
"ZSTD",
|
|
2618
|
+
"LZ4_RAW"
|
|
2619
|
+
];
|
|
2620
|
+
const PageTypes = [
|
|
2621
|
+
"DATA_PAGE",
|
|
2622
|
+
"INDEX_PAGE",
|
|
2623
|
+
"DICTIONARY_PAGE",
|
|
2624
|
+
"DATA_PAGE_V2"
|
|
2625
|
+
];
|
|
2626
|
+
const BoundaryOrders = [
|
|
2627
|
+
"UNORDERED",
|
|
2628
|
+
"ASCENDING",
|
|
2629
|
+
"DESCENDING"
|
|
2630
|
+
];
|
|
2631
|
+
const EdgeInterpolationAlgorithms = [
|
|
2632
|
+
"SPHERICAL",
|
|
2633
|
+
"VINCENTY",
|
|
2634
|
+
"THOMAS",
|
|
2635
|
+
"ANDOYER",
|
|
2636
|
+
"KARNEY"
|
|
2637
|
+
];
|
|
2638
|
+
new TextDecoder();
|
|
2639
|
+
new TextDecoder();
|
|
2640
|
+
function toJson(obj) {
|
|
2641
|
+
if (obj === void 0) return null;
|
|
2642
|
+
if (typeof obj === "bigint") return Number(obj);
|
|
2643
|
+
if (Object.is(obj, -0)) return 0;
|
|
2644
|
+
if (Array.isArray(obj)) return obj.map(toJson);
|
|
2645
|
+
if (obj instanceof Uint8Array) return Array.from(obj);
|
|
2646
|
+
if (obj instanceof Date) return obj.toISOString();
|
|
2647
|
+
if (obj instanceof Object) {
|
|
2648
|
+
const newObj = {};
|
|
2649
|
+
for (const key of Object.keys(obj)) {
|
|
2650
|
+
if (obj[key] === void 0) continue;
|
|
2651
|
+
newObj[key] = toJson(obj[key]);
|
|
2652
|
+
}
|
|
2653
|
+
return newObj;
|
|
2654
|
+
}
|
|
2655
|
+
return obj;
|
|
2656
|
+
}
|
|
2657
|
+
new TextDecoder();
|
|
2392
2658
|
export { BoundaryOrders, CompressionCodecs, ConvertedTypes, EdgeInterpolationAlgorithms, Encodings, FieldRepetitionTypes, PageTypes, ParquetTypes, asyncBufferFromUrl, getMaxDefinitionLevel, getSchemaPath, hashParquetValue, isListLike, isMapLike, parquetReadObjects, parseDecimal, snappyUncompress, toJson };
|
|
@@ -241,32 +241,6 @@ async function fetchAvroRecords(url, resolver, byteLength) {
|
|
|
241
241
|
});
|
|
242
242
|
}
|
|
243
243
|
const MAX_SAFE = BigInt(Number.MAX_SAFE_INTEGER);
|
|
244
|
-
function stringifyIcebergJson(value, indent) {
|
|
245
|
-
const sp = indent ? " ".repeat(indent) : "";
|
|
246
|
-
function emit(v, depth) {
|
|
247
|
-
if (typeof v === "bigint") return v.toString();
|
|
248
|
-
if (v === null) return "null";
|
|
249
|
-
if (typeof v === "string") return JSON.stringify(v);
|
|
250
|
-
if (typeof v === "number" || typeof v === "boolean") return JSON.stringify(v);
|
|
251
|
-
if (Array.isArray(v)) {
|
|
252
|
-
if (v.length === 0) return "[]";
|
|
253
|
-
const inner = v.map((x) => emit(x, depth + 1));
|
|
254
|
-
if (!sp) return "[" + inner.join(",") + "]";
|
|
255
|
-
const pad = sp.repeat(depth + 1), close = sp.repeat(depth);
|
|
256
|
-
return "[\n" + pad + inner.join(",\n" + pad) + "\n" + close + "]";
|
|
257
|
-
}
|
|
258
|
-
if (typeof v === "object") {
|
|
259
|
-
const keys = Object.keys(v).filter((k) => v[k] !== void 0);
|
|
260
|
-
if (keys.length === 0) return "{}";
|
|
261
|
-
const inner = keys.map((k) => JSON.stringify(k) + (sp ? ": " : ":") + emit(v[k], depth + 1));
|
|
262
|
-
if (!sp) return "{" + inner.join(",") + "}";
|
|
263
|
-
const pad = sp.repeat(depth + 1), close = sp.repeat(depth);
|
|
264
|
-
return "{\n" + pad + inner.join(",\n" + pad) + "\n" + close + "}";
|
|
265
|
-
}
|
|
266
|
-
return JSON.stringify(v);
|
|
267
|
-
}
|
|
268
|
-
return emit(value, 0);
|
|
269
|
-
}
|
|
270
244
|
function parseIcebergJson(text) {
|
|
271
245
|
let i = 0;
|
|
272
246
|
function skipWs() {
|
|
@@ -395,6 +369,23 @@ function parseIcebergJson(text) {
|
|
|
395
369
|
if (i !== text.length) throw new Error(`unexpected trailing input at ${i}`);
|
|
396
370
|
return value;
|
|
397
371
|
}
|
|
372
|
+
function stringifyIcebergJson(value, indent = 2) {
|
|
373
|
+
const pad = " ".repeat(indent);
|
|
374
|
+
function serialize(val, depth) {
|
|
375
|
+
if (typeof val === "bigint") return val.toString();
|
|
376
|
+
if (val === null || typeof val !== "object") return JSON.stringify(val);
|
|
377
|
+
const inner = pad.repeat(depth + 1);
|
|
378
|
+
const outer = pad.repeat(depth);
|
|
379
|
+
if (Array.isArray(val)) {
|
|
380
|
+
if (val.length === 0) return "[]";
|
|
381
|
+
return `[\n${val.map((v) => inner + serialize(v === void 0 ? null : v, depth + 1)).join(",\n")}\n${outer}]`;
|
|
382
|
+
}
|
|
383
|
+
const keys = Object.keys(val).filter((k) => val[k] !== void 0);
|
|
384
|
+
if (keys.length === 0) return "{}";
|
|
385
|
+
return `{\n${keys.map((k) => `${inner}${JSON.stringify(k)}: ${serialize(val[k], depth + 1)}`).join(",\n")}\n${outer}}`;
|
|
386
|
+
}
|
|
387
|
+
return serialize(value, 0);
|
|
388
|
+
}
|
|
398
389
|
async function restCatalogLoadTable(ctx, { namespace, table }) {
|
|
399
390
|
const body = parseIcebergJson(await (await restFetch(ctx, `namespaces/${encodeNamespace(namespace)}/tables/${encodeURIComponent(table)}`)).text());
|
|
400
391
|
return {
|
|
@@ -737,7 +728,7 @@ async function icebergCreate({ tableUrl, resolver, schema, formatVersion, partit
|
|
|
737
728
|
if (formatVersion >= 3) metadata["next-row-id"] = 0;
|
|
738
729
|
if (!resolver.writer) throw new Error("resolver.writer is required");
|
|
739
730
|
const metadataWriter = conditionalCommits ? resolver.writer(metadataUrl, { ifNoneMatch: "*" }) : resolver.writer(metadataUrl);
|
|
740
|
-
const metadataBytes = new TextEncoder().encode(stringifyIcebergJson(metadata
|
|
731
|
+
const metadataBytes = new TextEncoder().encode(stringifyIcebergJson(metadata));
|
|
741
732
|
metadataWriter.appendBytes(metadataBytes);
|
|
742
733
|
await metadataWriter.finish();
|
|
743
734
|
const versionHintUrl = `${tableUrl}/metadata/version-hint.text`;
|
|
@@ -282,7 +282,6 @@ function createSqlFragments(config) {
|
|
|
282
282
|
let col;
|
|
283
283
|
if (metric === "clicks") col = t.clicks;
|
|
284
284
|
else if (metric === "impressions") col = t.impressions;
|
|
285
|
-
else if (metric === "position") col = t.sum_position;
|
|
286
285
|
if (!col) continue;
|
|
287
286
|
const v = Number(f.expression);
|
|
288
287
|
switch (f.operator) {
|
package/dist/_chunks/sink.d.mts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { Row as Row$1, SearchType, TenantCtx as TenantCtx$1 } from "./storage.mjs";
|
|
2
2
|
import { EngineError } from "./errors.mjs";
|
|
3
|
+
import { icebergCreateTable } from "./libs/icebird.mjs";
|
|
3
4
|
import { Result } from "gscdump/result";
|
|
4
|
-
import { CatalogCache, CommitRetryOptions, ConnectIcebergOptions, DEFAULT_PARTITION_KEY_ENCODING as DEFAULT_PARTITION_KEY_ENCODING$1, IcebergCatalogConfig, IcebergColumn, IcebergColumn as IcebergColumn$1, IcebergColumnType, IcebergConnection, IcebergConnection as IcebergConnection$1, IcebergListedDataFile, IcebergPartitionField, IcebergPartitionField as IcebergPartitionField$1, IcebergPartitionSpec, IcebergPartitionSpecField, IcebergPartitionTransform, IcebergPrimitiveType, IcebergS3Config, IcebergSchema, IcebergSchemaField, IcebergSortOrder, IcebergSortOrderField, IcebergTableSpec, IcebergTableSpec as IcebergTableSpec$1, PartitionKeyEncoding, PartitionKeyEncoding as PartitionKeyEncoding$1, QueryProfiler, connectIcebergCatalog, ensureIcebergNamespace, listIcebergTables } from "@gscdump/lakehouse";
|
|
5
|
+
import { CatalogCache, CommitRetryOptions, ConnectIcebergOptions, DEFAULT_PARTITION_KEY_ENCODING as DEFAULT_PARTITION_KEY_ENCODING$1, IcebergCatalogConfig, IcebergColumn, IcebergColumn as IcebergColumn$1, IcebergColumnType, IcebergConnection, IcebergConnection as IcebergConnection$1, IcebergListedDataFile, IcebergListedDataFile as IcebergListedDataFile$1, IcebergPartitionField, IcebergPartitionField as IcebergPartitionField$1, IcebergPartitionSpec, IcebergPartitionSpecField, IcebergPartitionTransform, IcebergPrimitiveType, IcebergS3Config, IcebergSchema, IcebergSchemaField, IcebergSortOrder, IcebergSortOrderField, IcebergTableSpec, IcebergTableSpec as IcebergTableSpec$1, PartitionKeyEncoding, PartitionKeyEncoding as PartitionKeyEncoding$1, QueryProfiler, connectIcebergCatalog, ensureIcebergNamespace, listIcebergTables } from "@gscdump/lakehouse";
|
|
5
6
|
import { icebergAppendRetrying, isCommitRateLimited } from "@gscdump/lakehouse/unsafe-raw";
|
|
6
7
|
import { TableName } from "@gscdump/contracts";
|
|
7
8
|
/** The 9 fact tables that exist as global Iceberg tables. */
|
|
@@ -69,47 +70,26 @@ declare function isIcebergTable(table: string): table is IcebergTableName;
|
|
|
69
70
|
* Iceberg job instead of failing loudly.
|
|
70
71
|
*/
|
|
71
72
|
declare function assertIcebergTable(table: string): IcebergTableName;
|
|
73
|
+
type IcebirdCreateTableOptions = Parameters<typeof icebergCreateTable>[0];
|
|
74
|
+
type IcebirdSchema = NonNullable<IcebirdCreateTableOptions['schema']>;
|
|
75
|
+
type IcebirdPartitionSpec = NonNullable<IcebirdCreateTableOptions['partitionSpec']>;
|
|
76
|
+
type IcebirdSortOrder = NonNullable<IcebirdCreateTableOptions['sortOrder']>;
|
|
72
77
|
/**
|
|
73
78
|
* Build the icebird `Schema` for one of the 9 fact tables from the frozen
|
|
74
79
|
* `ICEBERG_SCHEMAS` contract. Field ids are advisory — R2 Data Catalog
|
|
75
80
|
* re-assigns them on `createTable`.
|
|
76
81
|
*/
|
|
77
|
-
declare function icebergSchemaFor(table: IcebergTableName, encoding?: PartitionKeyEncoding$1):
|
|
78
|
-
type: "struct";
|
|
79
|
-
'schema-id': number;
|
|
80
|
-
fields: {
|
|
81
|
-
id: number;
|
|
82
|
-
name: string;
|
|
83
|
-
required: boolean;
|
|
84
|
-
type: import("@gscdump/lakehouse").IcebergPrimitiveType;
|
|
85
|
-
}[];
|
|
86
|
-
};
|
|
82
|
+
declare function icebergSchemaFor(table: IcebergTableName, encoding?: PartitionKeyEncoding$1): IcebirdSchema;
|
|
87
83
|
/**
|
|
88
84
|
* Build the icebird `PartitionSpec` for one of the 9 fact tables: the locked
|
|
89
85
|
* spec `identity(site_id) + identity(search_type) + month(date)`.
|
|
90
86
|
*/
|
|
91
|
-
declare function icebergPartitionSpecFor(table: IcebergTableName, encoding?: PartitionKeyEncoding$1):
|
|
92
|
-
'spec-id': number;
|
|
93
|
-
fields: {
|
|
94
|
-
'source-id': number;
|
|
95
|
-
'field-id': number;
|
|
96
|
-
name: string;
|
|
97
|
-
transform: import("@gscdump/lakehouse").IcebergPartitionTransform;
|
|
98
|
-
}[];
|
|
99
|
-
};
|
|
87
|
+
declare function icebergPartitionSpecFor(table: IcebergTableName, encoding?: PartitionKeyEncoding$1): IcebirdPartitionSpec;
|
|
100
88
|
/**
|
|
101
89
|
* Build the icebird `SortOrder` for a fact table from its `clusterKey`
|
|
102
90
|
* (dimension-first, then `date`).
|
|
103
91
|
*/
|
|
104
|
-
declare function icebergSortOrderFor(table: IcebergTableName, encoding?: PartitionKeyEncoding$1):
|
|
105
|
-
'order-id': number;
|
|
106
|
-
fields: {
|
|
107
|
-
'source-id': number;
|
|
108
|
-
transform: "identity";
|
|
109
|
-
direction: "asc";
|
|
110
|
-
'null-order': "nulls-last";
|
|
111
|
-
}[];
|
|
112
|
-
};
|
|
92
|
+
declare function icebergSortOrderFor(table: IcebergTableName, encoding?: PartitionKeyEncoding$1): IcebirdSortOrder;
|
|
113
93
|
/**
|
|
114
94
|
* Outcome of a single table create/drop: the table name plus a `Result` —
|
|
115
95
|
* `Ok(void)` on success, `Err(iceberg-table-op-failed)` carrying the failure
|
|
@@ -153,7 +133,7 @@ interface ListIcebergDataFilesOptions {
|
|
|
153
133
|
* List the parquet data files in the current snapshot of `table`, filtered to
|
|
154
134
|
* a single partition slice `(siteId, searchType, month(date) ∈ range)`.
|
|
155
135
|
*/
|
|
156
|
-
declare function listIcebergDataFiles(conn: IcebergConnection, opts: ListIcebergDataFilesOptions): Promise<
|
|
136
|
+
declare function listIcebergDataFiles(conn: IcebergConnection, opts: ListIcebergDataFilesOptions): Promise<IcebergListedDataFile[]>;
|
|
157
137
|
/**
|
|
158
138
|
* Identifies one fact slice — the atomic unit a sink emits.
|
|
159
139
|
* `(table, site, searchType, date)`. `userId` rides along on `ctx` for
|
|
@@ -268,4 +248,4 @@ interface IcebergAppendSinkOptions extends SinkOptions {
|
|
|
268
248
|
*/
|
|
269
249
|
encoding?: PartitionKeyEncoding$1;
|
|
270
250
|
}
|
|
271
|
-
export { type CatalogCache, type CommitRetryOptions, type ConnectIcebergOptions, DEFAULT_PARTITION_KEY_ENCODING$1 as DEFAULT_PARTITION_KEY_ENCODING, ICEBERG_FIELD_ID_BASE, ICEBERG_PARTITION_COLUMNS, ICEBERG_PARTITION_SPEC, ICEBERG_SCHEMAS, ICEBERG_SCHEMAS_INT, ICEBERG_SCHEMAS_STRING, ICEBERG_TABLES, INT_SEARCH_TYPE, IcebergAppendSinkOptions, type IcebergCatalogConfig, type IcebergColumn$1 as IcebergColumn, type IcebergColumnType, type IcebergConnection$1 as IcebergConnection, type IcebergListedDataFile, type IcebergPartitionField$1 as IcebergPartitionField, type IcebergPartitionSpec, type IcebergPartitionSpecField, type IcebergPartitionTransform, type IcebergPrimitiveType, type IcebergS3Config, type IcebergSchema, type IcebergSchemaField, type IcebergSortOrder, type IcebergSortOrderField, IcebergTableName, IcebergTableOpResult, type IcebergTableSpec$1 as IcebergTableSpec, ListIcebergDataFilesOptions, type PartitionKeyEncoding$1 as PartitionKeyEncoding, SEARCH_TYPE_INT, Sink, SinkCapabilities, SinkCloseResult, SinkOptions, SinkSlice, SinkWriteResult, SliceOverwriteWriter, assertIcebergTable, connectIcebergCatalog, createIcebergTables, dropIcebergTables$1 as dropIcebergTables, ensureIcebergNamespace, icebergAppendRetrying, icebergPartitionColumns, icebergPartitionSpecFor, icebergSchemaFor, icebergSchemasFor, icebergSortOrderFor, icebergTableSpec, isCommitRateLimited, isIcebergTable, listIcebergDataFiles, listIcebergTables };
|
|
251
|
+
export { type CatalogCache, type CommitRetryOptions, type ConnectIcebergOptions, DEFAULT_PARTITION_KEY_ENCODING$1 as DEFAULT_PARTITION_KEY_ENCODING, ICEBERG_FIELD_ID_BASE, ICEBERG_PARTITION_COLUMNS, ICEBERG_PARTITION_SPEC, ICEBERG_SCHEMAS, ICEBERG_SCHEMAS_INT, ICEBERG_SCHEMAS_STRING, ICEBERG_TABLES, INT_SEARCH_TYPE, IcebergAppendSinkOptions, type IcebergCatalogConfig, type IcebergColumn$1 as IcebergColumn, type IcebergColumnType, type IcebergConnection$1 as IcebergConnection, type IcebergListedDataFile$1 as IcebergListedDataFile, type IcebergPartitionField$1 as IcebergPartitionField, type IcebergPartitionSpec, type IcebergPartitionSpecField, type IcebergPartitionTransform, type IcebergPrimitiveType, type IcebergS3Config, type IcebergSchema, type IcebergSchemaField, type IcebergSortOrder, type IcebergSortOrderField, IcebergTableName, IcebergTableOpResult, type IcebergTableSpec$1 as IcebergTableSpec, ListIcebergDataFilesOptions, type PartitionKeyEncoding$1 as PartitionKeyEncoding, SEARCH_TYPE_INT, Sink, SinkCapabilities, SinkCloseResult, SinkOptions, SinkSlice, SinkWriteResult, SliceOverwriteWriter, assertIcebergTable, connectIcebergCatalog, createIcebergTables, dropIcebergTables$1 as dropIcebergTables, ensureIcebergNamespace, icebergAppendRetrying, icebergPartitionColumns, icebergPartitionSpecFor, icebergSchemaFor, icebergSchemasFor, icebergSortOrderFor, icebergTableSpec, isCommitRateLimited, isIcebergTable, listIcebergDataFiles, listIcebergTables };
|
package/dist/iceberg/index.mjs
CHANGED
|
@@ -84,7 +84,15 @@ async function listIcebergDataFiles(conn, opts) {
|
|
|
84
84
|
field: "search_type",
|
|
85
85
|
value: opts.searchType,
|
|
86
86
|
encoding: "string"
|
|
87
|
-
}] : [
|
|
87
|
+
}] : [{
|
|
88
|
+
field: "site_id",
|
|
89
|
+
value: opts.siteId,
|
|
90
|
+
encoding: "int32"
|
|
91
|
+
}, {
|
|
92
|
+
field: "search_type",
|
|
93
|
+
value: opts.searchType,
|
|
94
|
+
encoding: "int32"
|
|
95
|
+
}];
|
|
88
96
|
return resolveIcebergDataFiles(conn, {
|
|
89
97
|
namespace: conn.namespace,
|
|
90
98
|
table: opts.table,
|
package/dist/ingest.mjs
CHANGED
|
@@ -26,7 +26,7 @@ function toPath(gscUrl) {
|
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
28
|
function toSumPosition(apiPosition, impressions) {
|
|
29
|
-
return ((apiPosition >= 1 ? apiPosition : 1) - 1) *
|
|
29
|
+
return ((apiPosition >= 1 ? apiPosition : 1) - 1) * impressions;
|
|
30
30
|
}
|
|
31
31
|
function transformGscRow(table, apiRow, options = {}) {
|
|
32
32
|
const keys = apiRow.keys;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gscdump/engine",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.35.
|
|
4
|
+
"version": "0.35.4",
|
|
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",
|
|
@@ -181,18 +181,18 @@
|
|
|
181
181
|
"dependencies": {
|
|
182
182
|
"drizzle-orm": "1.0.0-rc.3",
|
|
183
183
|
"proper-lockfile": "^4.1.2",
|
|
184
|
-
"@gscdump/
|
|
185
|
-
"
|
|
186
|
-
"gscdump": "0.35.
|
|
184
|
+
"@gscdump/lakehouse": "0.35.4",
|
|
185
|
+
"gscdump": "0.35.4",
|
|
186
|
+
"@gscdump/contracts": "0.35.4"
|
|
187
187
|
},
|
|
188
188
|
"devDependencies": {
|
|
189
189
|
"@duckdb/duckdb-wasm": "^1.32.0",
|
|
190
190
|
"@types/proper-lockfile": "^4.1.4",
|
|
191
191
|
"aws4fetch": "^1.0.20",
|
|
192
|
-
"hyparquet": "^1.26.
|
|
192
|
+
"hyparquet": "^1.26.2",
|
|
193
193
|
"hyparquet-writer": "^0.16.1",
|
|
194
|
-
"icebird": "^0.8.
|
|
195
|
-
"tsx": "^4.22.
|
|
194
|
+
"icebird": "^0.8.12",
|
|
195
|
+
"tsx": "^4.22.5",
|
|
196
196
|
"unstorage": "^1.17.5",
|
|
197
197
|
"vitest": "^4.1.9"
|
|
198
198
|
},
|