@genome-spy/app 0.73.0 → 0.75.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.
- package/dist/AbortablePromiseCache-3gHJdF3E.js +96 -0
- package/dist/blosc-oa0DlI6G.js +692 -0
- package/dist/browser-Dvlo92rx.js +126 -0
- package/dist/chunk-CPXzm0be.js +11 -0
- package/dist/chunk-INHXZS53-fPMmEwMt.js +13 -0
- package/dist/esm-B8-vSu-c.js +369 -0
- package/dist/esm-BDFRLEuD.js +1248 -0
- package/dist/esm-BygJiwh0.js +573 -0
- package/dist/esm-CGX-qz1d.js +155 -0
- package/dist/esm-Cmo4qEPr.js +1015 -0
- package/dist/esm-CuMSzCHy.js +298 -0
- package/dist/esm-D-WfYOx7.js +461 -0
- package/dist/esm-DCCYNvaz.js +1426 -0
- package/dist/esm-n0auOe11.js +121 -0
- package/dist/index.es.js +41252 -52718
- package/dist/index.js +1093 -1099
- package/dist/lz4-jZ0zyLBa.js +626 -0
- package/dist/parquetRead-CJe1UPsz.js +1609 -0
- package/dist/schema.json +11293 -5027
- package/dist/style.css +2 -1
- package/dist/zstd-C6ksIG9r.js +583 -0
- package/package.json +14 -5
- package/dist/AbortablePromiseCache-Dj0vzLnp.js +0 -149
- package/dist/blosc-D1xNXZJs.js +0 -719
- package/dist/browser-0iNU5Wit.js +0 -138
- package/dist/chunk-INHXZS53-DiyuLb3Z.js +0 -14
- package/dist/index-BUsSzlHg.js +0 -1771
- package/dist/index-BYsZN7b0.js +0 -1597
- package/dist/index-C7wOh6y1.js +0 -657
- package/dist/index-CRaQAuki.js +0 -326
- package/dist/index-D9v1PCj9.js +0 -507
- package/dist/index-GDOuv_D5.js +0 -266
- package/dist/index-Gt44EOIH.js +0 -628
- package/dist/inflate-GtwLkvSP.js +0 -1048
- package/dist/lz4-1Ws5oVWR.js +0 -640
- package/dist/parquetRead-BnAGCa4_.js +0 -1663
- package/dist/unzip-Bac01w6X.js +0 -1492
- package/dist/zstd-C4EcZnjq.js +0 -603
|
@@ -0,0 +1,1609 @@
|
|
|
1
|
+
//#region ../../node_modules/hyparquet/src/constants.js
|
|
2
|
+
var e = [
|
|
3
|
+
"BOOLEAN",
|
|
4
|
+
"INT32",
|
|
5
|
+
"INT64",
|
|
6
|
+
"INT96",
|
|
7
|
+
"FLOAT",
|
|
8
|
+
"DOUBLE",
|
|
9
|
+
"BYTE_ARRAY",
|
|
10
|
+
"FIXED_LEN_BYTE_ARRAY"
|
|
11
|
+
], t = [
|
|
12
|
+
"PLAIN",
|
|
13
|
+
"GROUP_VAR_INT",
|
|
14
|
+
"PLAIN_DICTIONARY",
|
|
15
|
+
"RLE",
|
|
16
|
+
"BIT_PACKED",
|
|
17
|
+
"DELTA_BINARY_PACKED",
|
|
18
|
+
"DELTA_LENGTH_BYTE_ARRAY",
|
|
19
|
+
"DELTA_BYTE_ARRAY",
|
|
20
|
+
"RLE_DICTIONARY",
|
|
21
|
+
"BYTE_STREAM_SPLIT"
|
|
22
|
+
], n = [
|
|
23
|
+
"REQUIRED",
|
|
24
|
+
"OPTIONAL",
|
|
25
|
+
"REPEATED"
|
|
26
|
+
], r = [
|
|
27
|
+
"UTF8",
|
|
28
|
+
"MAP",
|
|
29
|
+
"MAP_KEY_VALUE",
|
|
30
|
+
"LIST",
|
|
31
|
+
"ENUM",
|
|
32
|
+
"DECIMAL",
|
|
33
|
+
"DATE",
|
|
34
|
+
"TIME_MILLIS",
|
|
35
|
+
"TIME_MICROS",
|
|
36
|
+
"TIMESTAMP_MILLIS",
|
|
37
|
+
"TIMESTAMP_MICROS",
|
|
38
|
+
"UINT_8",
|
|
39
|
+
"UINT_16",
|
|
40
|
+
"UINT_32",
|
|
41
|
+
"UINT_64",
|
|
42
|
+
"INT_8",
|
|
43
|
+
"INT_16",
|
|
44
|
+
"INT_32",
|
|
45
|
+
"INT_64",
|
|
46
|
+
"JSON",
|
|
47
|
+
"BSON",
|
|
48
|
+
"INTERVAL"
|
|
49
|
+
], i = [
|
|
50
|
+
"UNCOMPRESSED",
|
|
51
|
+
"SNAPPY",
|
|
52
|
+
"GZIP",
|
|
53
|
+
"LZO",
|
|
54
|
+
"BROTLI",
|
|
55
|
+
"LZ4",
|
|
56
|
+
"ZSTD",
|
|
57
|
+
"LZ4_RAW"
|
|
58
|
+
], a = [
|
|
59
|
+
"DATA_PAGE",
|
|
60
|
+
"INDEX_PAGE",
|
|
61
|
+
"DICTIONARY_PAGE",
|
|
62
|
+
"DATA_PAGE_V2"
|
|
63
|
+
], o = [
|
|
64
|
+
"SPHERICAL",
|
|
65
|
+
"VINCENTY",
|
|
66
|
+
"THOMAS",
|
|
67
|
+
"ANDOYER",
|
|
68
|
+
"KARNEY"
|
|
69
|
+
];
|
|
70
|
+
//#endregion
|
|
71
|
+
//#region ../../node_modules/hyparquet/src/wkb.js
|
|
72
|
+
function s(e) {
|
|
73
|
+
let t = c(e);
|
|
74
|
+
if (t.type === 1) return {
|
|
75
|
+
type: "Point",
|
|
76
|
+
coordinates: l(e, t)
|
|
77
|
+
};
|
|
78
|
+
if (t.type === 2) return {
|
|
79
|
+
type: "LineString",
|
|
80
|
+
coordinates: u(e, t)
|
|
81
|
+
};
|
|
82
|
+
if (t.type === 3) return {
|
|
83
|
+
type: "Polygon",
|
|
84
|
+
coordinates: d(e, t)
|
|
85
|
+
};
|
|
86
|
+
if (t.type === 4) {
|
|
87
|
+
let n = [];
|
|
88
|
+
for (let r = 0; r < t.count; r++) n.push(l(e, c(e)));
|
|
89
|
+
return {
|
|
90
|
+
type: "MultiPoint",
|
|
91
|
+
coordinates: n
|
|
92
|
+
};
|
|
93
|
+
} else if (t.type === 5) {
|
|
94
|
+
let n = [];
|
|
95
|
+
for (let r = 0; r < t.count; r++) n.push(u(e, c(e)));
|
|
96
|
+
return {
|
|
97
|
+
type: "MultiLineString",
|
|
98
|
+
coordinates: n
|
|
99
|
+
};
|
|
100
|
+
} else if (t.type === 6) {
|
|
101
|
+
let n = [];
|
|
102
|
+
for (let r = 0; r < t.count; r++) n.push(d(e, c(e)));
|
|
103
|
+
return {
|
|
104
|
+
type: "MultiPolygon",
|
|
105
|
+
coordinates: n
|
|
106
|
+
};
|
|
107
|
+
} else if (t.type === 7) {
|
|
108
|
+
let n = [];
|
|
109
|
+
for (let r = 0; r < t.count; r++) n.push(s(e));
|
|
110
|
+
return {
|
|
111
|
+
type: "GeometryCollection",
|
|
112
|
+
geometries: n
|
|
113
|
+
};
|
|
114
|
+
} else throw Error(`Unsupported geometry type: ${t.type}`);
|
|
115
|
+
}
|
|
116
|
+
function c(e) {
|
|
117
|
+
let { view: t } = e, n = t.getUint8(e.offset++) === 1, r = t.getUint32(e.offset, n);
|
|
118
|
+
e.offset += 4;
|
|
119
|
+
let i = r % 1e3, a = Math.floor(r / 1e3), o = 0;
|
|
120
|
+
i > 1 && i <= 7 && (o = t.getUint32(e.offset, n), e.offset += 4);
|
|
121
|
+
let s = 2;
|
|
122
|
+
return a && s++, a === 3 && s++, {
|
|
123
|
+
littleEndian: n,
|
|
124
|
+
type: i,
|
|
125
|
+
dim: s,
|
|
126
|
+
count: o
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
function l(e, t) {
|
|
130
|
+
let n = [];
|
|
131
|
+
for (let r = 0; r < t.dim; r++) {
|
|
132
|
+
let r = e.view.getFloat64(e.offset, t.littleEndian);
|
|
133
|
+
e.offset += 8, n.push(r);
|
|
134
|
+
}
|
|
135
|
+
return n;
|
|
136
|
+
}
|
|
137
|
+
function u(e, t) {
|
|
138
|
+
let n = [];
|
|
139
|
+
for (let r = 0; r < t.count; r++) n.push(l(e, t));
|
|
140
|
+
return n;
|
|
141
|
+
}
|
|
142
|
+
function d(e, t) {
|
|
143
|
+
let { view: n } = e, r = [];
|
|
144
|
+
for (let i = 0; i < t.count; i++) {
|
|
145
|
+
let i = n.getUint32(e.offset, t.littleEndian);
|
|
146
|
+
e.offset += 4, r.push(u(e, {
|
|
147
|
+
...t,
|
|
148
|
+
count: i
|
|
149
|
+
}));
|
|
150
|
+
}
|
|
151
|
+
return r;
|
|
152
|
+
}
|
|
153
|
+
//#endregion
|
|
154
|
+
//#region ../../node_modules/hyparquet/src/convert.js
|
|
155
|
+
var f = new TextDecoder(), p = {
|
|
156
|
+
timestampFromMilliseconds(e) {
|
|
157
|
+
return new Date(Number(e));
|
|
158
|
+
},
|
|
159
|
+
timestampFromMicroseconds(e) {
|
|
160
|
+
return new Date(Number(e / 1000n));
|
|
161
|
+
},
|
|
162
|
+
timestampFromNanoseconds(e) {
|
|
163
|
+
return new Date(Number(e / 1000000n));
|
|
164
|
+
},
|
|
165
|
+
dateFromDays(e) {
|
|
166
|
+
return /* @__PURE__ */ new Date(e * 864e5);
|
|
167
|
+
},
|
|
168
|
+
stringFromBytes(e) {
|
|
169
|
+
return e && f.decode(e);
|
|
170
|
+
},
|
|
171
|
+
geometryFromBytes(e) {
|
|
172
|
+
return e && s({
|
|
173
|
+
view: new DataView(e.buffer, e.byteOffset, e.byteLength),
|
|
174
|
+
offset: 0
|
|
175
|
+
});
|
|
176
|
+
},
|
|
177
|
+
geographyFromBytes(e) {
|
|
178
|
+
return e && s({
|
|
179
|
+
view: new DataView(e.buffer, e.byteOffset, e.byteLength),
|
|
180
|
+
offset: 0
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
};
|
|
184
|
+
function m(e, t, n, r) {
|
|
185
|
+
if (t && n.endsWith("_DICTIONARY")) {
|
|
186
|
+
let n = e;
|
|
187
|
+
e instanceof Uint8Array && !(t instanceof Uint8Array) && (n = new t.constructor(e.length));
|
|
188
|
+
for (let r = 0; r < e.length; r++) n[r] = t[e[r]];
|
|
189
|
+
return n;
|
|
190
|
+
} else return h(e, r);
|
|
191
|
+
}
|
|
192
|
+
function h(e, t) {
|
|
193
|
+
let { element: n, parsers: r, utf8: i = !0, schemaPath: a } = t, { type: o, converted_type: s, logical_type: c } = n;
|
|
194
|
+
if (a?.some((e) => e.element.logical_type?.type === "VARIANT") && o === "BYTE_ARRAY" && s !== "UTF8" && c?.type !== "STRING") return e;
|
|
195
|
+
if (s === "DECIMAL") {
|
|
196
|
+
let t = 10 ** -(n.scale || 0), r = Array(e.length);
|
|
197
|
+
for (let n = 0; n < r.length; n++) e[n] instanceof Uint8Array ? r[n] = g(e[n]) * t : r[n] = Number(e[n]) * t;
|
|
198
|
+
return r;
|
|
199
|
+
}
|
|
200
|
+
if (!s && o === "INT96") return Array.from(e).map((e) => r.timestampFromNanoseconds(_(e)));
|
|
201
|
+
if (s === "DATE") return Array.from(e).map((e) => r.dateFromDays(e));
|
|
202
|
+
if (s === "TIMESTAMP_MILLIS") return Array.from(e).map((e) => r.timestampFromMilliseconds(e));
|
|
203
|
+
if (s === "TIMESTAMP_MICROS") return Array.from(e).map((e) => r.timestampFromMicroseconds(e));
|
|
204
|
+
if (s === "JSON") return e.map((e) => JSON.parse(f.decode(e)));
|
|
205
|
+
if (s === "BSON") throw Error("parquet bson not supported");
|
|
206
|
+
if (s === "INTERVAL") throw Error("parquet interval not supported");
|
|
207
|
+
if (c?.type === "GEOMETRY") return e.map((e) => r.geometryFromBytes(e));
|
|
208
|
+
if (c?.type === "GEOGRAPHY") return e.map((e) => r.geographyFromBytes(e));
|
|
209
|
+
if (s === "UTF8" || c?.type === "STRING" || i && o === "BYTE_ARRAY") return e.map((e) => r.stringFromBytes(e));
|
|
210
|
+
if (s === "UINT_64" || c?.type === "INTEGER" && c.bitWidth === 64 && !c.isSigned) {
|
|
211
|
+
if (e instanceof BigInt64Array) return new BigUint64Array(e.buffer, e.byteOffset, e.length);
|
|
212
|
+
let t = new BigUint64Array(e.length);
|
|
213
|
+
for (let n = 0; n < t.length; n++) t[n] = BigInt(e[n]);
|
|
214
|
+
return t;
|
|
215
|
+
}
|
|
216
|
+
if (s === "UINT_32" || c?.type === "INTEGER" && c.bitWidth === 32 && !c.isSigned) {
|
|
217
|
+
if (e instanceof Int32Array) return new Uint32Array(e.buffer, e.byteOffset, e.length);
|
|
218
|
+
let t = new Uint32Array(e.length);
|
|
219
|
+
for (let n = 0; n < t.length; n++) t[n] = e[n];
|
|
220
|
+
return t;
|
|
221
|
+
}
|
|
222
|
+
if (c?.type === "FLOAT16") return Array.from(e).map(v);
|
|
223
|
+
if (c?.type === "TIMESTAMP") {
|
|
224
|
+
let { unit: t } = c, n = r.timestampFromMilliseconds;
|
|
225
|
+
t === "MICROS" && (n = r.timestampFromMicroseconds), t === "NANOS" && (n = r.timestampFromNanoseconds);
|
|
226
|
+
let i = Array(e.length);
|
|
227
|
+
for (let t = 0; t < i.length; t++) i[t] = n(e[t]);
|
|
228
|
+
return i;
|
|
229
|
+
}
|
|
230
|
+
return e;
|
|
231
|
+
}
|
|
232
|
+
function g(e) {
|
|
233
|
+
if (!e.length) return 0;
|
|
234
|
+
let t = 0n;
|
|
235
|
+
for (let n of e) t = t * 256n + BigInt(n);
|
|
236
|
+
let n = e.length * 8;
|
|
237
|
+
return t >= 2n ** BigInt(n - 1) && (t -= 2n ** BigInt(n)), Number(t);
|
|
238
|
+
}
|
|
239
|
+
function _(e) {
|
|
240
|
+
let t = (e >> 64n) - 2440588n, n = e & 18446744073709551615n;
|
|
241
|
+
return t * 86400000000000n + n;
|
|
242
|
+
}
|
|
243
|
+
function v(e) {
|
|
244
|
+
if (!e) return;
|
|
245
|
+
let t = e[1] << 8 | e[0], n = t >> 15 ? -1 : 1, r = t >> 10 & 31, i = t & 1023;
|
|
246
|
+
return r === 0 ? n * 2 ** -14 * (i / 1024) : r === 31 ? i ? NaN : n * Infinity : n * 2 ** (r - 15) * (1 + i / 1024);
|
|
247
|
+
}
|
|
248
|
+
//#endregion
|
|
249
|
+
//#region ../../node_modules/hyparquet/src/schema.js
|
|
250
|
+
function y(e, t, n) {
|
|
251
|
+
let r = e[t], i = [], a = 1;
|
|
252
|
+
if (r.num_children) for (; i.length < r.num_children;) {
|
|
253
|
+
let r = e[t + a], o = y(e, t + a, [...n, r.name]);
|
|
254
|
+
a += o.count, i.push(o);
|
|
255
|
+
}
|
|
256
|
+
return {
|
|
257
|
+
count: a,
|
|
258
|
+
element: r,
|
|
259
|
+
children: i,
|
|
260
|
+
path: n
|
|
261
|
+
};
|
|
262
|
+
}
|
|
263
|
+
function b(e, t) {
|
|
264
|
+
let n = y(e, 0, []), r = [n];
|
|
265
|
+
for (let e of t) {
|
|
266
|
+
let i = n.children.find((t) => t.element.name === e);
|
|
267
|
+
if (!i) throw Error(`parquet schema element not found: ${t}`);
|
|
268
|
+
r.push(i), n = i;
|
|
269
|
+
}
|
|
270
|
+
return r;
|
|
271
|
+
}
|
|
272
|
+
function ee(e) {
|
|
273
|
+
let t = [];
|
|
274
|
+
function n(e) {
|
|
275
|
+
if (e.children.length) for (let t of e.children) n(t);
|
|
276
|
+
else t.push(e.path.join("."));
|
|
277
|
+
}
|
|
278
|
+
return n(e), t;
|
|
279
|
+
}
|
|
280
|
+
function x(e) {
|
|
281
|
+
let t = 0;
|
|
282
|
+
for (let { element: n } of e) n.repetition_type === "REPEATED" && t++;
|
|
283
|
+
return t;
|
|
284
|
+
}
|
|
285
|
+
function S(e) {
|
|
286
|
+
let t = 0;
|
|
287
|
+
for (let { element: n } of e.slice(1)) n.repetition_type !== "REQUIRED" && t++;
|
|
288
|
+
return t;
|
|
289
|
+
}
|
|
290
|
+
function te(e) {
|
|
291
|
+
if (!e || e.element.converted_type !== "LIST" || e.children.length > 1) return !1;
|
|
292
|
+
let t = e.children[0];
|
|
293
|
+
return !(t.children.length > 1 || t.element.repetition_type !== "REPEATED");
|
|
294
|
+
}
|
|
295
|
+
function ne(e) {
|
|
296
|
+
if (!e || e.element.converted_type !== "MAP" || e.children.length > 1) return !1;
|
|
297
|
+
let t = e.children[0];
|
|
298
|
+
return !(t.children.length !== 2 || t.element.repetition_type !== "REPEATED" || t.children.find((e) => e.element.name === "key")?.element.repetition_type === "REPEATED" || t.children.find((e) => e.element.name === "value")?.element.repetition_type === "REPEATED");
|
|
299
|
+
}
|
|
300
|
+
function re(e) {
|
|
301
|
+
if (e.length !== 2) return !1;
|
|
302
|
+
let [, t] = e;
|
|
303
|
+
return !(t.element.repetition_type === "REPEATED" || t.children.length);
|
|
304
|
+
}
|
|
305
|
+
//#endregion
|
|
306
|
+
//#region ../../node_modules/hyparquet/src/thrift.js
|
|
307
|
+
var C = {
|
|
308
|
+
STOP: 0,
|
|
309
|
+
TRUE: 1,
|
|
310
|
+
FALSE: 2,
|
|
311
|
+
BYTE: 3,
|
|
312
|
+
I16: 4,
|
|
313
|
+
I32: 5,
|
|
314
|
+
I64: 6,
|
|
315
|
+
DOUBLE: 7,
|
|
316
|
+
BINARY: 8,
|
|
317
|
+
LIST: 9,
|
|
318
|
+
SET: 10,
|
|
319
|
+
MAP: 11,
|
|
320
|
+
STRUCT: 12,
|
|
321
|
+
UUID: 13
|
|
322
|
+
};
|
|
323
|
+
function w(e) {
|
|
324
|
+
let t = 0, n = {};
|
|
325
|
+
for (; e.offset < e.view.byteLength;) {
|
|
326
|
+
let [r, i, a] = ae(e, t);
|
|
327
|
+
if (t = a, r === C.STOP) break;
|
|
328
|
+
n[`field_${i}`] = T(e, r);
|
|
329
|
+
}
|
|
330
|
+
return n;
|
|
331
|
+
}
|
|
332
|
+
function T(e, t) {
|
|
333
|
+
switch (t) {
|
|
334
|
+
case C.TRUE: return !0;
|
|
335
|
+
case C.FALSE: return !1;
|
|
336
|
+
case C.BYTE: return e.view.getInt8(e.offset++);
|
|
337
|
+
case C.I16:
|
|
338
|
+
case C.I32: return D(e);
|
|
339
|
+
case C.I64: return O(e);
|
|
340
|
+
case C.DOUBLE: {
|
|
341
|
+
let t = e.view.getFloat64(e.offset, !0);
|
|
342
|
+
return e.offset += 8, t;
|
|
343
|
+
}
|
|
344
|
+
case C.BINARY: {
|
|
345
|
+
let t = E(e), n = new Uint8Array(e.view.buffer, e.view.byteOffset + e.offset, t);
|
|
346
|
+
return e.offset += t, n;
|
|
347
|
+
}
|
|
348
|
+
case C.LIST: {
|
|
349
|
+
let t = e.view.getUint8(e.offset++), n = t & 15, r = t >> 4;
|
|
350
|
+
r === 15 && (r = E(e));
|
|
351
|
+
let i = n === C.TRUE || n === C.FALSE, a = Array(r);
|
|
352
|
+
for (let t = 0; t < r; t++) a[t] = i ? T(e, C.BYTE) === 1 : T(e, n);
|
|
353
|
+
return a;
|
|
354
|
+
}
|
|
355
|
+
case C.STRUCT: {
|
|
356
|
+
let t = {}, n = 0;
|
|
357
|
+
for (;;) {
|
|
358
|
+
let [r, i, a] = ae(e, n);
|
|
359
|
+
if (n = a, r === C.STOP) break;
|
|
360
|
+
t[`field_${i}`] = T(e, r);
|
|
361
|
+
}
|
|
362
|
+
return t;
|
|
363
|
+
}
|
|
364
|
+
default: throw Error(`thrift unhandled type: ${t}`);
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
function E(e) {
|
|
368
|
+
let t = 0, n = 0;
|
|
369
|
+
for (;;) {
|
|
370
|
+
let r = e.view.getUint8(e.offset++);
|
|
371
|
+
if (t |= (r & 127) << n, !(r & 128)) return t;
|
|
372
|
+
n += 7;
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
function ie(e) {
|
|
376
|
+
let t = 0n, n = 0n;
|
|
377
|
+
for (;;) {
|
|
378
|
+
let r = e.view.getUint8(e.offset++);
|
|
379
|
+
if (t |= BigInt(r & 127) << n, !(r & 128)) return t;
|
|
380
|
+
n += 7n;
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
function D(e) {
|
|
384
|
+
let t = E(e);
|
|
385
|
+
return t >>> 1 ^ -(t & 1);
|
|
386
|
+
}
|
|
387
|
+
function O(e) {
|
|
388
|
+
let t = ie(e);
|
|
389
|
+
return t >> 1n ^ -(t & 1n);
|
|
390
|
+
}
|
|
391
|
+
function ae(e, t) {
|
|
392
|
+
let n = e.view.getUint8(e.offset++), r = n & 15;
|
|
393
|
+
if (r === C.STOP) return [
|
|
394
|
+
0,
|
|
395
|
+
0,
|
|
396
|
+
t
|
|
397
|
+
];
|
|
398
|
+
let i = n >> 4, a = i ? t + i : D(e);
|
|
399
|
+
return [
|
|
400
|
+
r,
|
|
401
|
+
a,
|
|
402
|
+
a
|
|
403
|
+
];
|
|
404
|
+
}
|
|
405
|
+
//#endregion
|
|
406
|
+
//#region ../../node_modules/hyparquet/src/geoparquet.js
|
|
407
|
+
function oe(e, t) {
|
|
408
|
+
let n = /* @__PURE__ */ new Map(), r = t?.find(({ key: e }) => e === "geo")?.value, i = (r && JSON.parse(r)?.columns) ?? {};
|
|
409
|
+
for (let [e, t] of Object.entries(i)) {
|
|
410
|
+
if (t.encoding !== "WKB") continue;
|
|
411
|
+
let r = t.edges === "spherical" ? "GEOGRAPHY" : "GEOMETRY", i = t.crs?.id ?? t.crs?.ids?.[0], a = i ? `${i.authority}:${i.code.toString()}` : void 0;
|
|
412
|
+
n.set(e, {
|
|
413
|
+
type: r,
|
|
414
|
+
crs: a
|
|
415
|
+
});
|
|
416
|
+
}
|
|
417
|
+
for (let t = 1; t < e.length; t++) {
|
|
418
|
+
let r = e[t], { logical_type: i, name: a, num_children: o, repetition_type: s, type: c } = r;
|
|
419
|
+
if (o) {
|
|
420
|
+
t += o;
|
|
421
|
+
continue;
|
|
422
|
+
}
|
|
423
|
+
c === "BYTE_ARRAY" && i === void 0 && s !== "REPEATED" && (r.logical_type = n.get(a));
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
//#endregion
|
|
427
|
+
//#region ../../node_modules/hyparquet/src/metadata.js
|
|
428
|
+
var se = 1 << 19, ce = new TextDecoder();
|
|
429
|
+
function k(e) {
|
|
430
|
+
return e && ce.decode(e);
|
|
431
|
+
}
|
|
432
|
+
async function le(e, { parsers: t, initialFetchSize: n = se, geoparquet: r = !0 } = {}) {
|
|
433
|
+
if (!e || !(e.byteLength >= 0)) throw Error("parquet expected AsyncBuffer");
|
|
434
|
+
let i = Math.max(0, e.byteLength - n), a = await e.slice(i, e.byteLength), o = new DataView(a);
|
|
435
|
+
if (o.getUint32(a.byteLength - 4, !0) !== 827474256) throw Error("parquet file invalid (footer != PAR1)");
|
|
436
|
+
let s = o.getUint32(a.byteLength - 8, !0);
|
|
437
|
+
if (s > e.byteLength - 8) throw Error(`parquet metadata length ${s} exceeds available buffer ${e.byteLength - 8}`);
|
|
438
|
+
if (s + 8 > n) {
|
|
439
|
+
let n = e.byteLength - s - 8, o = await e.slice(n, i), c = new ArrayBuffer(s + 8), l = new Uint8Array(c);
|
|
440
|
+
return l.set(new Uint8Array(o)), l.set(new Uint8Array(a), i - n), ue(c, {
|
|
441
|
+
parsers: t,
|
|
442
|
+
geoparquet: r
|
|
443
|
+
});
|
|
444
|
+
} else return ue(a, {
|
|
445
|
+
parsers: t,
|
|
446
|
+
geoparquet: r
|
|
447
|
+
});
|
|
448
|
+
}
|
|
449
|
+
function ue(o, { parsers: s, geoparquet: c = !0 } = {}) {
|
|
450
|
+
if (!(o instanceof ArrayBuffer)) throw Error("parquet expected ArrayBuffer");
|
|
451
|
+
let l = new DataView(o);
|
|
452
|
+
if (s = {
|
|
453
|
+
...p,
|
|
454
|
+
...s
|
|
455
|
+
}, l.byteLength < 8) throw Error("parquet file is too short");
|
|
456
|
+
if (l.getUint32(l.byteLength - 4, !0) !== 827474256) throw Error("parquet file invalid (footer != PAR1)");
|
|
457
|
+
let u = l.byteLength - 8, d = l.getUint32(u, !0);
|
|
458
|
+
if (d > l.byteLength - 8) throw Error(`parquet metadata length ${d} exceeds available buffer ${l.byteLength - 8}`);
|
|
459
|
+
let f = w({
|
|
460
|
+
view: l,
|
|
461
|
+
offset: u - d
|
|
462
|
+
}), m = f.field_1, h = f.field_2.map((t) => ({
|
|
463
|
+
type: e[t.field_1],
|
|
464
|
+
type_length: t.field_2,
|
|
465
|
+
repetition_type: n[t.field_3],
|
|
466
|
+
name: k(t.field_4),
|
|
467
|
+
num_children: t.field_5,
|
|
468
|
+
converted_type: r[t.field_6],
|
|
469
|
+
scale: t.field_7,
|
|
470
|
+
precision: t.field_8,
|
|
471
|
+
field_id: t.field_9,
|
|
472
|
+
logical_type: de(t.field_10)
|
|
473
|
+
})), g = h.filter((e) => e.type), _ = f.field_3, v = f.field_4.map((n) => ({
|
|
474
|
+
columns: n.field_1.map((n, r) => ({
|
|
475
|
+
file_path: k(n.field_1),
|
|
476
|
+
file_offset: n.field_2,
|
|
477
|
+
meta_data: n.field_3 && {
|
|
478
|
+
type: e[n.field_3.field_1],
|
|
479
|
+
encodings: n.field_3.field_2?.map((e) => t[e]),
|
|
480
|
+
path_in_schema: n.field_3.field_3.map(k),
|
|
481
|
+
codec: i[n.field_3.field_4],
|
|
482
|
+
num_values: n.field_3.field_5,
|
|
483
|
+
total_uncompressed_size: n.field_3.field_6,
|
|
484
|
+
total_compressed_size: n.field_3.field_7,
|
|
485
|
+
key_value_metadata: n.field_3.field_8?.map((e) => ({
|
|
486
|
+
key: k(e.field_1),
|
|
487
|
+
value: k(e.field_2)
|
|
488
|
+
})),
|
|
489
|
+
data_page_offset: n.field_3.field_9,
|
|
490
|
+
index_page_offset: n.field_3.field_10,
|
|
491
|
+
dictionary_page_offset: n.field_3.field_11,
|
|
492
|
+
statistics: fe(n.field_3.field_12, g[r], s),
|
|
493
|
+
encoding_stats: n.field_3.field_13?.map((e) => ({
|
|
494
|
+
page_type: a[e.field_1],
|
|
495
|
+
encoding: t[e.field_2],
|
|
496
|
+
count: e.field_3
|
|
497
|
+
})),
|
|
498
|
+
bloom_filter_offset: n.field_3.field_14,
|
|
499
|
+
bloom_filter_length: n.field_3.field_15,
|
|
500
|
+
size_statistics: n.field_3.field_16 && {
|
|
501
|
+
unencoded_byte_array_data_bytes: n.field_3.field_16.field_1,
|
|
502
|
+
repetition_level_histogram: n.field_3.field_16.field_2,
|
|
503
|
+
definition_level_histogram: n.field_3.field_16.field_3
|
|
504
|
+
},
|
|
505
|
+
geospatial_statistics: n.field_3.field_17 && {
|
|
506
|
+
bbox: n.field_3.field_17.field_1 && {
|
|
507
|
+
xmin: n.field_3.field_17.field_1.field_1,
|
|
508
|
+
xmax: n.field_3.field_17.field_1.field_2,
|
|
509
|
+
ymin: n.field_3.field_17.field_1.field_3,
|
|
510
|
+
ymax: n.field_3.field_17.field_1.field_4,
|
|
511
|
+
zmin: n.field_3.field_17.field_1.field_5,
|
|
512
|
+
zmax: n.field_3.field_17.field_1.field_6,
|
|
513
|
+
mmin: n.field_3.field_17.field_1.field_7,
|
|
514
|
+
mmax: n.field_3.field_17.field_1.field_8
|
|
515
|
+
},
|
|
516
|
+
geospatial_types: n.field_3.field_17.field_2
|
|
517
|
+
}
|
|
518
|
+
},
|
|
519
|
+
offset_index_offset: n.field_4,
|
|
520
|
+
offset_index_length: n.field_5,
|
|
521
|
+
column_index_offset: n.field_6,
|
|
522
|
+
column_index_length: n.field_7,
|
|
523
|
+
crypto_metadata: n.field_8,
|
|
524
|
+
encrypted_column_metadata: n.field_9
|
|
525
|
+
})),
|
|
526
|
+
total_byte_size: n.field_2,
|
|
527
|
+
num_rows: n.field_3,
|
|
528
|
+
sorting_columns: n.field_4?.map((e) => ({
|
|
529
|
+
column_idx: e.field_1,
|
|
530
|
+
descending: e.field_2,
|
|
531
|
+
nulls_first: e.field_3
|
|
532
|
+
})),
|
|
533
|
+
file_offset: n.field_5,
|
|
534
|
+
total_compressed_size: n.field_6,
|
|
535
|
+
ordinal: n.field_7
|
|
536
|
+
})), y = f.field_5?.map((e) => ({
|
|
537
|
+
key: k(e.field_1),
|
|
538
|
+
value: k(e.field_2)
|
|
539
|
+
})), b = k(f.field_6);
|
|
540
|
+
return c && oe(h, y), {
|
|
541
|
+
version: m,
|
|
542
|
+
schema: h,
|
|
543
|
+
num_rows: _,
|
|
544
|
+
row_groups: v,
|
|
545
|
+
key_value_metadata: y,
|
|
546
|
+
created_by: b,
|
|
547
|
+
metadata_length: d
|
|
548
|
+
};
|
|
549
|
+
}
|
|
550
|
+
function A({ schema: e }) {
|
|
551
|
+
return b(e, [])[0];
|
|
552
|
+
}
|
|
553
|
+
function de(e) {
|
|
554
|
+
return e?.field_1 ? { type: "STRING" } : e?.field_2 ? { type: "MAP" } : e?.field_3 ? { type: "LIST" } : e?.field_4 ? { type: "ENUM" } : e?.field_5 ? {
|
|
555
|
+
type: "DECIMAL",
|
|
556
|
+
scale: e.field_5.field_1,
|
|
557
|
+
precision: e.field_5.field_2
|
|
558
|
+
} : e?.field_6 ? { type: "DATE" } : e?.field_7 ? {
|
|
559
|
+
type: "TIME",
|
|
560
|
+
isAdjustedToUTC: e.field_7.field_1,
|
|
561
|
+
unit: j(e.field_7.field_2)
|
|
562
|
+
} : e?.field_8 ? {
|
|
563
|
+
type: "TIMESTAMP",
|
|
564
|
+
isAdjustedToUTC: e.field_8.field_1,
|
|
565
|
+
unit: j(e.field_8.field_2)
|
|
566
|
+
} : e?.field_10 ? {
|
|
567
|
+
type: "INTEGER",
|
|
568
|
+
bitWidth: e.field_10.field_1,
|
|
569
|
+
isSigned: e.field_10.field_2
|
|
570
|
+
} : e?.field_11 ? { type: "NULL" } : e?.field_12 ? { type: "JSON" } : e?.field_13 ? { type: "BSON" } : e?.field_14 ? { type: "UUID" } : e?.field_15 ? { type: "FLOAT16" } : e?.field_16 ? {
|
|
571
|
+
type: "VARIANT",
|
|
572
|
+
specification_version: e.field_16.field_1
|
|
573
|
+
} : e?.field_17 ? {
|
|
574
|
+
type: "GEOMETRY",
|
|
575
|
+
crs: k(e.field_17.field_1)
|
|
576
|
+
} : e?.field_18 ? {
|
|
577
|
+
type: "GEOGRAPHY",
|
|
578
|
+
crs: k(e.field_18.field_1),
|
|
579
|
+
algorithm: o[e.field_18.field_2]
|
|
580
|
+
} : e;
|
|
581
|
+
}
|
|
582
|
+
function j(e) {
|
|
583
|
+
if (e.field_1) return "MILLIS";
|
|
584
|
+
if (e.field_2) return "MICROS";
|
|
585
|
+
if (e.field_3) return "NANOS";
|
|
586
|
+
throw Error("parquet time unit required");
|
|
587
|
+
}
|
|
588
|
+
function fe(e, t, n) {
|
|
589
|
+
return e && {
|
|
590
|
+
max: M(e.field_1, t, n),
|
|
591
|
+
min: M(e.field_2, t, n),
|
|
592
|
+
null_count: e.field_3,
|
|
593
|
+
distinct_count: e.field_4,
|
|
594
|
+
max_value: M(e.field_5, t, n),
|
|
595
|
+
min_value: M(e.field_6, t, n),
|
|
596
|
+
is_max_value_exact: e.field_7,
|
|
597
|
+
is_min_value_exact: e.field_8
|
|
598
|
+
};
|
|
599
|
+
}
|
|
600
|
+
function M(e, t, n) {
|
|
601
|
+
let { type: r, converted_type: i, logical_type: a } = t;
|
|
602
|
+
if (e === void 0) return e;
|
|
603
|
+
if (r === "BOOLEAN") return e[0] === 1;
|
|
604
|
+
if (r === "BYTE_ARRAY") return n.stringFromBytes(e);
|
|
605
|
+
let o = new DataView(e.buffer, e.byteOffset, e.byteLength);
|
|
606
|
+
return r === "FLOAT" && o.byteLength === 4 ? o.getFloat32(0, !0) : r === "DOUBLE" && o.byteLength === 8 ? o.getFloat64(0, !0) : r === "INT32" && i === "DATE" ? n.dateFromDays(o.getInt32(0, !0)) : r === "INT64" && i === "TIMESTAMP_MILLIS" ? n.timestampFromMilliseconds(o.getBigInt64(0, !0)) : r === "INT64" && i === "TIMESTAMP_MICROS" ? n.timestampFromMicroseconds(o.getBigInt64(0, !0)) : r === "INT64" && a?.type === "TIMESTAMP" && a?.unit === "NANOS" ? n.timestampFromNanoseconds(o.getBigInt64(0, !0)) : r === "INT64" && a?.type === "TIMESTAMP" && a?.unit === "MICROS" ? n.timestampFromMicroseconds(o.getBigInt64(0, !0)) : r === "INT64" && a?.type === "TIMESTAMP" ? n.timestampFromMilliseconds(o.getBigInt64(0, !0)) : r === "INT32" && o.byteLength === 4 ? o.getInt32(0, !0) : r === "INT64" && o.byteLength === 8 ? o.getBigInt64(0, !0) : i === "DECIMAL" ? g(e) * 10 ** -(t.scale || 0) : a?.type === "FLOAT16" ? v(e) : e;
|
|
607
|
+
}
|
|
608
|
+
//#endregion
|
|
609
|
+
//#region ../../node_modules/hyparquet/src/utils.js
|
|
610
|
+
function N(e, t) {
|
|
611
|
+
let n = 1e4;
|
|
612
|
+
for (let r = 0; r < t.length; r += n) e.push(...t.slice(r, r + n));
|
|
613
|
+
}
|
|
614
|
+
function P(e, t, n = !0) {
|
|
615
|
+
if (n ? e === t : e == t) return !0;
|
|
616
|
+
if (e instanceof Uint8Array && t instanceof Uint8Array) return P(Array.from(e), Array.from(t), n);
|
|
617
|
+
if (!e || !t || typeof e != typeof t) return !1;
|
|
618
|
+
if (Array.isArray(e) && Array.isArray(t)) {
|
|
619
|
+
if (e.length !== t.length) return !1;
|
|
620
|
+
for (let r = 0; r < e.length; r++) if (!P(e[r], t[r], n)) return !1;
|
|
621
|
+
return !0;
|
|
622
|
+
}
|
|
623
|
+
if (typeof e != "object") return !1;
|
|
624
|
+
let r = Object.keys(e);
|
|
625
|
+
if (r.length !== Object.keys(t).length) return !1;
|
|
626
|
+
for (let i of r) if (!P(e[i], t[i], n)) return !1;
|
|
627
|
+
return !0;
|
|
628
|
+
}
|
|
629
|
+
function pe(e) {
|
|
630
|
+
if (!e) return [];
|
|
631
|
+
if (e.length === 1) return e[0];
|
|
632
|
+
let t = [];
|
|
633
|
+
for (let n of e) N(t, n);
|
|
634
|
+
return t;
|
|
635
|
+
}
|
|
636
|
+
//#endregion
|
|
637
|
+
//#region ../../node_modules/hyparquet/src/filter.js
|
|
638
|
+
function F({ rowGroup: e, physicalColumns: t, filter: n, strict: r = !0 }) {
|
|
639
|
+
if (!n) return !1;
|
|
640
|
+
if ("$and" in n && Array.isArray(n.$and)) return n.$and.some((n) => F({
|
|
641
|
+
rowGroup: e,
|
|
642
|
+
physicalColumns: t,
|
|
643
|
+
filter: n,
|
|
644
|
+
strict: r
|
|
645
|
+
}));
|
|
646
|
+
if ("$or" in n && Array.isArray(n.$or)) return n.$or.every((n) => F({
|
|
647
|
+
rowGroup: e,
|
|
648
|
+
physicalColumns: t,
|
|
649
|
+
filter: n,
|
|
650
|
+
strict: r
|
|
651
|
+
}));
|
|
652
|
+
if ("$nor" in n && Array.isArray(n.$nor)) return !1;
|
|
653
|
+
for (let [i, a] of Object.entries(n)) {
|
|
654
|
+
let n = t.indexOf(i);
|
|
655
|
+
if (n === -1) continue;
|
|
656
|
+
let o = e.columns[n].meta_data?.statistics;
|
|
657
|
+
if (!o) continue;
|
|
658
|
+
let { min: s, max: c, min_value: l, max_value: u } = o, d = l === void 0 ? s : l, f = u === void 0 ? c : u;
|
|
659
|
+
if (!(d === void 0 || f === void 0)) {
|
|
660
|
+
for (let [e, t] of Object.entries(a || {})) if (e === "$gt" && f <= t || e === "$gte" && f < t || e === "$lt" && d >= t || e === "$lte" && d > t || e === "$eq" && (t < d || t > f) || e === "$ne" && P(d, f, r) && P(d, t, r) || e === "$in" && Array.isArray(t) && t.every((e) => e < d || e > f) || e === "$nin" && Array.isArray(t) && P(d, f, r) && t.includes(d)) return !0;
|
|
661
|
+
}
|
|
662
|
+
}
|
|
663
|
+
return !1;
|
|
664
|
+
}
|
|
665
|
+
//#endregion
|
|
666
|
+
//#region ../../node_modules/hyparquet/src/plan.js
|
|
667
|
+
var me = 1 << 21;
|
|
668
|
+
function he({ metadata: e, rowStart: t = 0, rowEnd: n = Infinity, columns: r, filter: i, filterStrict: a = !0, useOffsetIndex: o = !1 }) {
|
|
669
|
+
if (!e) throw Error("parquetPlan requires metadata");
|
|
670
|
+
let s = [], c = [], l = [], u = ee(A(e)), d = 0;
|
|
671
|
+
for (let f of e.row_groups) {
|
|
672
|
+
let e = Number(f.num_rows), p = d + e;
|
|
673
|
+
if (e > 0 && p > t && d < n && !F({
|
|
674
|
+
rowGroup: f,
|
|
675
|
+
physicalColumns: u,
|
|
676
|
+
filter: i,
|
|
677
|
+
strict: a
|
|
678
|
+
})) {
|
|
679
|
+
let i = [], a = Infinity, u = -Infinity;
|
|
680
|
+
for (let e of f.columns) {
|
|
681
|
+
let t = e.meta_data;
|
|
682
|
+
if (e.file_path) throw Error("parquet file_path not supported");
|
|
683
|
+
if (!t) throw Error("parquet column metadata is undefined");
|
|
684
|
+
if (!r || r.includes(t.path_in_schema[0])) {
|
|
685
|
+
let n = t.dictionary_page_offset || t.data_page_offset, r = Number(n), s = Number(n + t.total_compressed_size);
|
|
686
|
+
if (r < a && (a = r), s > u && (u = s), o && e.offset_index_offset && e.offset_index_length) {
|
|
687
|
+
let n = Number(e.offset_index_offset);
|
|
688
|
+
i.push({
|
|
689
|
+
columnMetadata: t,
|
|
690
|
+
offsetIndex: {
|
|
691
|
+
startByte: n,
|
|
692
|
+
endByte: n + e.offset_index_length
|
|
693
|
+
},
|
|
694
|
+
bounds: {
|
|
695
|
+
startByte: r,
|
|
696
|
+
endByte: s
|
|
697
|
+
}
|
|
698
|
+
});
|
|
699
|
+
} else i.push({
|
|
700
|
+
columnMetadata: t,
|
|
701
|
+
range: {
|
|
702
|
+
startByte: r,
|
|
703
|
+
endByte: s
|
|
704
|
+
}
|
|
705
|
+
});
|
|
706
|
+
}
|
|
707
|
+
}
|
|
708
|
+
let p = Math.max(t - d, 0), m = Math.min(n - d, e);
|
|
709
|
+
s.push({
|
|
710
|
+
chunks: i,
|
|
711
|
+
rowGroup: f,
|
|
712
|
+
groupStart: d,
|
|
713
|
+
groupRows: e,
|
|
714
|
+
selectStart: p,
|
|
715
|
+
selectEnd: m
|
|
716
|
+
});
|
|
717
|
+
let h;
|
|
718
|
+
for (let e of i) if ("offsetIndex" in e) l.push(e.offsetIndex);
|
|
719
|
+
else {
|
|
720
|
+
let { range: t } = e;
|
|
721
|
+
r ? c.push(t) : h && t.endByte - h.startByte <= me ? h.endByte = t.endByte : (h && c.push(h), h = { ...t });
|
|
722
|
+
}
|
|
723
|
+
h && c.push(h);
|
|
724
|
+
}
|
|
725
|
+
d = p;
|
|
726
|
+
}
|
|
727
|
+
return isFinite(n) || (n = d), c.push(...l), {
|
|
728
|
+
metadata: e,
|
|
729
|
+
rowStart: t,
|
|
730
|
+
rowEnd: n,
|
|
731
|
+
columns: r,
|
|
732
|
+
fetches: c,
|
|
733
|
+
groups: s
|
|
734
|
+
};
|
|
735
|
+
}
|
|
736
|
+
function ge(e, { fetches: t }) {
|
|
737
|
+
let n = t.map(({ startByte: t, endByte: n }) => e.slice(t, n));
|
|
738
|
+
return {
|
|
739
|
+
byteLength: e.byteLength,
|
|
740
|
+
slice(r, i = e.byteLength) {
|
|
741
|
+
let a = t.findIndex(({ startByte: e, endByte: t }) => e <= r && i <= t);
|
|
742
|
+
if (a < 0) return e.slice(r, i);
|
|
743
|
+
if (t[a].startByte !== r || t[a].endByte !== i) {
|
|
744
|
+
let e = r - t[a].startByte, o = i - t[a].startByte;
|
|
745
|
+
return n[a] instanceof Promise ? n[a].then((t) => t.slice(e, o)) : n[a].slice(e, o);
|
|
746
|
+
} else return n[a];
|
|
747
|
+
}
|
|
748
|
+
};
|
|
749
|
+
}
|
|
750
|
+
//#endregion
|
|
751
|
+
//#region ../../node_modules/hyparquet/src/variant.js
|
|
752
|
+
var I = new TextDecoder(), L = /* @__PURE__ */ new WeakMap();
|
|
753
|
+
function R(e, t = p) {
|
|
754
|
+
if (Array.isArray(e)) return e.map((e) => R(e, t));
|
|
755
|
+
if (typeof e != "object") return e;
|
|
756
|
+
if ("metadata" in e) {
|
|
757
|
+
let n = _e(e.metadata), r = e.typed_value && z(e.typed_value, n, t), i = e.value && H(B(e.value), n, t);
|
|
758
|
+
return r && i ? {
|
|
759
|
+
...i,
|
|
760
|
+
...r
|
|
761
|
+
} : r ?? i;
|
|
762
|
+
}
|
|
763
|
+
return e;
|
|
764
|
+
}
|
|
765
|
+
function z(e, t, n) {
|
|
766
|
+
if (e && typeof e == "object" && !Array.isArray(e) && !(e instanceof Uint8Array)) {
|
|
767
|
+
if ("typed_value" in e) return z(e.typed_value, t, n);
|
|
768
|
+
if ("value" in e && e.value instanceof Uint8Array) return H(B(e.value), t, n);
|
|
769
|
+
let r = {};
|
|
770
|
+
for (let [i, a] of Object.entries(e)) r[i] = z(a, t, n);
|
|
771
|
+
return r;
|
|
772
|
+
}
|
|
773
|
+
return e instanceof Uint8Array ? H(B(e), t, n) : Array.isArray(e) ? e.map((e) => z(e, t, n)) : e;
|
|
774
|
+
}
|
|
775
|
+
function B(e) {
|
|
776
|
+
return {
|
|
777
|
+
view: new DataView(e.buffer, e.byteOffset, e.byteLength),
|
|
778
|
+
offset: 0
|
|
779
|
+
};
|
|
780
|
+
}
|
|
781
|
+
function _e(e) {
|
|
782
|
+
let t = L.get(e.buffer);
|
|
783
|
+
t || (t = /* @__PURE__ */ new Map(), L.set(e.buffer, t));
|
|
784
|
+
let n = `${e.byteOffset}:${e.byteLength}`, r = t.get(n);
|
|
785
|
+
if (r) return r;
|
|
786
|
+
let i = B(e), a = i.view.getUint8(i.offset++), o = a & 15;
|
|
787
|
+
if (o !== 1) throw Error(`parquet unsupported variant metadata version: ${o}`);
|
|
788
|
+
let s = (a >> 4 & 1) == 1, c = (a >> 6 & 3) + 1, l = V(i, c), u = Array(l + 1);
|
|
789
|
+
for (let e = 0; e < u.length; e++) u[e] = V(i, c);
|
|
790
|
+
let d = i.offset, f = Array(l);
|
|
791
|
+
for (let t = 0; t < l; t++) {
|
|
792
|
+
let n = u[t], r = u[t + 1], i = new Uint8Array(e.buffer, e.byteOffset + d + n, r - n);
|
|
793
|
+
f[t] = I.decode(i);
|
|
794
|
+
}
|
|
795
|
+
let p = {
|
|
796
|
+
dictionary: f,
|
|
797
|
+
sorted: s
|
|
798
|
+
};
|
|
799
|
+
return t.set(n, p), p;
|
|
800
|
+
}
|
|
801
|
+
function V(e, t) {
|
|
802
|
+
let n = 0;
|
|
803
|
+
for (let r = 0; r < t; r++) n |= e.view.getUint8(e.offset + r) << r * 8;
|
|
804
|
+
return e.offset += t, n;
|
|
805
|
+
}
|
|
806
|
+
function H(e, t, n) {
|
|
807
|
+
let r = e.view.getUint8(e.offset++), i = r & 3, a = r >> 2;
|
|
808
|
+
if (i === 0) return ve(e, a, n);
|
|
809
|
+
if (i === 2) return ye(e, a, t, n);
|
|
810
|
+
if (i === 3) return be(e, a, t, n);
|
|
811
|
+
let o = new Uint8Array(e.view.buffer, e.view.byteOffset + e.offset, a);
|
|
812
|
+
return e.offset += a, I.decode(o);
|
|
813
|
+
}
|
|
814
|
+
function ve(e, t, n) {
|
|
815
|
+
switch (t) {
|
|
816
|
+
case 0: return null;
|
|
817
|
+
case 1: return !0;
|
|
818
|
+
case 2: return !1;
|
|
819
|
+
case 3: {
|
|
820
|
+
let t = e.view.getInt8(e.offset);
|
|
821
|
+
return e.offset += 1, t;
|
|
822
|
+
}
|
|
823
|
+
case 4: {
|
|
824
|
+
let t = e.view.getInt16(e.offset, !0);
|
|
825
|
+
return e.offset += 2, t;
|
|
826
|
+
}
|
|
827
|
+
case 5: {
|
|
828
|
+
let t = e.view.getInt32(e.offset, !0);
|
|
829
|
+
return e.offset += 4, t;
|
|
830
|
+
}
|
|
831
|
+
case 6: {
|
|
832
|
+
let t = e.view.getBigInt64(e.offset, !0);
|
|
833
|
+
return e.offset += 8, t;
|
|
834
|
+
}
|
|
835
|
+
case 7: {
|
|
836
|
+
let t = e.view.getFloat64(e.offset, !0);
|
|
837
|
+
return e.offset += 8, t;
|
|
838
|
+
}
|
|
839
|
+
case 8: return U(e, 4);
|
|
840
|
+
case 9: return U(e, 8);
|
|
841
|
+
case 10: return U(e, 16);
|
|
842
|
+
case 11: {
|
|
843
|
+
let t = e.view.getInt32(e.offset, !0);
|
|
844
|
+
return e.offset += 4, n.dateFromDays(t);
|
|
845
|
+
}
|
|
846
|
+
case 12:
|
|
847
|
+
case 13: {
|
|
848
|
+
let t = e.view.getBigInt64(e.offset, !0);
|
|
849
|
+
return e.offset += 8, n.timestampFromMicroseconds(t);
|
|
850
|
+
}
|
|
851
|
+
case 14: {
|
|
852
|
+
let t = e.view.getFloat32(e.offset, !0);
|
|
853
|
+
return e.offset += 4, t;
|
|
854
|
+
}
|
|
855
|
+
case 15: return W(e);
|
|
856
|
+
case 16: {
|
|
857
|
+
let t = W(e);
|
|
858
|
+
return I.decode(t);
|
|
859
|
+
}
|
|
860
|
+
case 17: {
|
|
861
|
+
let t = e.view.getBigInt64(e.offset, !0);
|
|
862
|
+
return e.offset += 8, t;
|
|
863
|
+
}
|
|
864
|
+
case 18:
|
|
865
|
+
case 19: {
|
|
866
|
+
let t = e.view.getBigInt64(e.offset, !0);
|
|
867
|
+
return e.offset += 8, n.timestampFromNanoseconds(t);
|
|
868
|
+
}
|
|
869
|
+
case 20: {
|
|
870
|
+
let t = new Uint8Array(e.view.buffer, e.view.byteOffset + e.offset, 16);
|
|
871
|
+
e.offset += 16;
|
|
872
|
+
let n = Array.from(t, (e) => e.toString(16).padStart(2, "0")).join("");
|
|
873
|
+
return `${n.slice(0, 8)}-${n.slice(8, 12)}-${n.slice(12, 16)}-${n.slice(16, 20)}-${n.slice(20)}`;
|
|
874
|
+
}
|
|
875
|
+
default: throw Error(`parquet unsupported variant primitive type: ${t}`);
|
|
876
|
+
}
|
|
877
|
+
}
|
|
878
|
+
function ye(e, t, n, r) {
|
|
879
|
+
let i = (t & 3) + 1, a = (t >> 2 & 3) + 1, o = t >> 4 & 1 ? V(e, 4) : e.view.getUint8(e.offset++), s = Array(o);
|
|
880
|
+
for (let t = 0; t < o; t++) s[t] = V(e, a);
|
|
881
|
+
let c = Array(o + 1);
|
|
882
|
+
for (let t = 0; t < c.length; t++) c[t] = V(e, i);
|
|
883
|
+
let l = {};
|
|
884
|
+
for (let t = 0; t < o; t++) {
|
|
885
|
+
let i = n.dictionary[s[t]];
|
|
886
|
+
l[i] = H({
|
|
887
|
+
view: e.view,
|
|
888
|
+
offset: e.offset + c[t]
|
|
889
|
+
}, n, r);
|
|
890
|
+
}
|
|
891
|
+
return e.offset += c[c.length - 1], l;
|
|
892
|
+
}
|
|
893
|
+
function be(e, t, n, r) {
|
|
894
|
+
let i = t & 3, a = t >> 2 & 1, o = i + 1, s = V(e, a ? 4 : 1), c = Array(s + 1);
|
|
895
|
+
for (let t = 0; t < c.length; t++) c[t] = V(e, o);
|
|
896
|
+
let l = e.offset, u = Array(s);
|
|
897
|
+
for (let t = 0; t < s; t++) u[t] = H({
|
|
898
|
+
view: e.view,
|
|
899
|
+
offset: l + c[t]
|
|
900
|
+
}, n, r);
|
|
901
|
+
return e.offset = l + c[c.length - 1], u;
|
|
902
|
+
}
|
|
903
|
+
function U(e, t) {
|
|
904
|
+
let n = e.view.getUint8(e.offset);
|
|
905
|
+
e.offset += 1;
|
|
906
|
+
let r;
|
|
907
|
+
if (t === 4) r = BigInt(e.view.getInt32(e.offset, !0)), e.offset += 4;
|
|
908
|
+
else if (t === 8) r = e.view.getBigInt64(e.offset, !0), e.offset += 8;
|
|
909
|
+
else {
|
|
910
|
+
let t = e.view.getBigUint64(e.offset, !0);
|
|
911
|
+
r = e.view.getBigInt64(e.offset + 8, !0) << 64n | t, e.offset += 16;
|
|
912
|
+
}
|
|
913
|
+
return Number(r) * 10 ** -n;
|
|
914
|
+
}
|
|
915
|
+
function W(e) {
|
|
916
|
+
let t = e.view.getUint32(e.offset, !0);
|
|
917
|
+
e.offset += 4;
|
|
918
|
+
let n = new Uint8Array(e.view.buffer, e.view.byteOffset + e.offset, t);
|
|
919
|
+
return e.offset += t, n;
|
|
920
|
+
}
|
|
921
|
+
//#endregion
|
|
922
|
+
//#region ../../node_modules/hyparquet/src/assemble.js
|
|
923
|
+
function G(e, t, n, r, i) {
|
|
924
|
+
let a = S(i);
|
|
925
|
+
if (!t?.length && !n.length) {
|
|
926
|
+
if (!a || !r.length) return r;
|
|
927
|
+
t = Array(r.length).fill(a);
|
|
928
|
+
}
|
|
929
|
+
let o = t?.length || n.length, s = i.map(({ element: e }) => e.repetition_type), c = 0, l = [e], u = e, d = 0, f = 0, p = 0;
|
|
930
|
+
if (n[0]) for (; d < s.length - 2 && p < n[0];) d++, s[d] !== "REQUIRED" && (u = u.at(-1), l.push(u), f++), s[d] === "REPEATED" && p++;
|
|
931
|
+
for (let e = 0; e < o; e++) {
|
|
932
|
+
let i = t?.length ? t[e] : a, o = n[e];
|
|
933
|
+
for (; d && (o < p || s[d] !== "REPEATED");) s[d] !== "REQUIRED" && (l.pop(), f--), s[d] === "REPEATED" && p--, d--;
|
|
934
|
+
for (u = l.at(-1); (d < s.length - 2 || s[d + 1] === "REPEATED") && (f < i || s[d + 1] === "REQUIRED");) {
|
|
935
|
+
if (d++, s[d] !== "REQUIRED") {
|
|
936
|
+
let e = [];
|
|
937
|
+
u.push(e), u = e, l.push(e), f++;
|
|
938
|
+
}
|
|
939
|
+
s[d] === "REPEATED" && p++;
|
|
940
|
+
}
|
|
941
|
+
i === a ? u.push(r[c++]) : d === s.length - 2 ? u.push(null) : u.push([]);
|
|
942
|
+
}
|
|
943
|
+
if (!e.length) for (let e = 0; e < a; e++) {
|
|
944
|
+
let e = [];
|
|
945
|
+
u.push(e), u = e;
|
|
946
|
+
}
|
|
947
|
+
return e;
|
|
948
|
+
}
|
|
949
|
+
function K(e, t, n, r = 0) {
|
|
950
|
+
let i = t.path.join("."), a = t.element.repetition_type === "OPTIONAL", o = a ? r + 1 : r;
|
|
951
|
+
if (te(t)) {
|
|
952
|
+
let s = t.children[0], c = o;
|
|
953
|
+
s.children.length === 1 && (s = s.children[0], c++), K(e, s, n, c);
|
|
954
|
+
let l = s.path.join("."), u = e.get(l);
|
|
955
|
+
if (!u) throw Error("parquet list column missing values");
|
|
956
|
+
a && q(u, r), e.set(i, u), e.delete(l);
|
|
957
|
+
return;
|
|
958
|
+
}
|
|
959
|
+
if (ne(t)) {
|
|
960
|
+
let s = t.children[0].element.name;
|
|
961
|
+
K(e, t.children[0].children[0], n, o + 1), K(e, t.children[0].children[1], n, o + 1);
|
|
962
|
+
let c = e.get(`${i}.${s}.key`), l = e.get(`${i}.${s}.value`);
|
|
963
|
+
if (!c) throw Error("parquet map column missing keys");
|
|
964
|
+
if (!l) throw Error("parquet map column missing values");
|
|
965
|
+
if (c.length !== l.length) throw Error("parquet map column key/value length mismatch");
|
|
966
|
+
let u = xe(c, l, o);
|
|
967
|
+
a && q(u, r), e.delete(`${i}.${s}.key`), e.delete(`${i}.${s}.value`), e.set(i, u);
|
|
968
|
+
return;
|
|
969
|
+
}
|
|
970
|
+
if (t.children.length) {
|
|
971
|
+
let o = t.element.repetition_type === "REQUIRED" ? r : r + 1, s = {};
|
|
972
|
+
for (let r of t.children) {
|
|
973
|
+
K(e, r, n, o);
|
|
974
|
+
let t = e.get(r.path.join("."));
|
|
975
|
+
if (!t) throw Error("parquet struct missing child data");
|
|
976
|
+
s[r.element.name] = t;
|
|
977
|
+
}
|
|
978
|
+
for (let n of t.children) e.delete(n.path.join("."));
|
|
979
|
+
let c = Se(s, o);
|
|
980
|
+
t.element.logical_type?.type === "VARIANT" && (c = R(c, n)), a && q(c, r), e.set(i, c);
|
|
981
|
+
}
|
|
982
|
+
}
|
|
983
|
+
function q(e, t) {
|
|
984
|
+
for (let n = 0; n < e.length; n++) t ? q(e[n], t - 1) : e[n] = e[n][0];
|
|
985
|
+
}
|
|
986
|
+
function xe(e, t, n) {
|
|
987
|
+
let r = [];
|
|
988
|
+
for (let i = 0; i < e.length; i++) if (n) r.push(xe(e[i], t[i], n - 1));
|
|
989
|
+
else if (e[i]) {
|
|
990
|
+
let n = {};
|
|
991
|
+
for (let r = 0; r < e[i].length; r++) {
|
|
992
|
+
let a = t[i][r];
|
|
993
|
+
n[e[i][r]] = a === void 0 ? null : a;
|
|
994
|
+
}
|
|
995
|
+
r.push(n);
|
|
996
|
+
} else r.push(void 0);
|
|
997
|
+
return r;
|
|
998
|
+
}
|
|
999
|
+
function Se(e, t) {
|
|
1000
|
+
let n = Object.keys(e), r = e[n[0]]?.length, i = [];
|
|
1001
|
+
for (let a = 0; a < r; a++) {
|
|
1002
|
+
let o = {};
|
|
1003
|
+
for (let t of n) {
|
|
1004
|
+
if (e[t].length !== r) throw Error("parquet struct parsing error");
|
|
1005
|
+
o[t] = e[t][a];
|
|
1006
|
+
}
|
|
1007
|
+
t ? i.push(Se(o, t - 1)) : i.push(o);
|
|
1008
|
+
}
|
|
1009
|
+
return i;
|
|
1010
|
+
}
|
|
1011
|
+
//#endregion
|
|
1012
|
+
//#region ../../node_modules/hyparquet/src/delta.js
|
|
1013
|
+
function J(e, t, n) {
|
|
1014
|
+
let r = n instanceof Int32Array, i = E(e), a = E(e);
|
|
1015
|
+
E(e);
|
|
1016
|
+
let o = O(e), s = 0;
|
|
1017
|
+
n[s++] = r ? Number(o) : o;
|
|
1018
|
+
let c = i / a;
|
|
1019
|
+
for (; s < t;) {
|
|
1020
|
+
let i = O(e), l = new Uint8Array(a);
|
|
1021
|
+
for (let t = 0; t < a; t++) l[t] = e.view.getUint8(e.offset++);
|
|
1022
|
+
for (let u = 0; u < a && s < t; u++) {
|
|
1023
|
+
let a = BigInt(l[u]);
|
|
1024
|
+
if (a) {
|
|
1025
|
+
let l = 0n, u = c, d = (1n << a) - 1n;
|
|
1026
|
+
for (; u && s < t;) {
|
|
1027
|
+
let t = BigInt(e.view.getUint8(e.offset)) >> l & d;
|
|
1028
|
+
for (l += a; l >= 8;) l -= 8n, e.offset++, l && (t |= BigInt(e.view.getUint8(e.offset)) << a - l & d);
|
|
1029
|
+
let c = i + t;
|
|
1030
|
+
o += c, n[s++] = r ? Number(o) : o, u--;
|
|
1031
|
+
}
|
|
1032
|
+
u && (e.offset += Math.ceil((u * Number(a) + Number(l)) / 8));
|
|
1033
|
+
} else for (let e = 0; e < c && s < t; e++) o += i, n[s++] = r ? Number(o) : o;
|
|
1034
|
+
}
|
|
1035
|
+
}
|
|
1036
|
+
}
|
|
1037
|
+
function Ce(e, t, n) {
|
|
1038
|
+
let r = new Int32Array(t);
|
|
1039
|
+
J(e, t, r);
|
|
1040
|
+
for (let i = 0; i < t; i++) n[i] = new Uint8Array(e.view.buffer, e.view.byteOffset + e.offset, r[i]), e.offset += r[i];
|
|
1041
|
+
}
|
|
1042
|
+
function we(e, t, n) {
|
|
1043
|
+
let r = new Int32Array(t);
|
|
1044
|
+
J(e, t, r);
|
|
1045
|
+
let i = new Int32Array(t);
|
|
1046
|
+
J(e, t, i);
|
|
1047
|
+
for (let a = 0; a < t; a++) {
|
|
1048
|
+
let t = new Uint8Array(e.view.buffer, e.view.byteOffset + e.offset, i[a]);
|
|
1049
|
+
r[a] ? (n[a] = new Uint8Array(r[a] + i[a]), n[a].set(n[a - 1].subarray(0, r[a])), n[a].set(t, r[a])) : n[a] = t, e.offset += i[a];
|
|
1050
|
+
}
|
|
1051
|
+
}
|
|
1052
|
+
//#endregion
|
|
1053
|
+
//#region ../../node_modules/hyparquet/src/encoding.js
|
|
1054
|
+
function Y(e) {
|
|
1055
|
+
return 32 - Math.clz32(e);
|
|
1056
|
+
}
|
|
1057
|
+
function X(e, t, n, r) {
|
|
1058
|
+
r === void 0 && (r = e.view.getUint32(e.offset, !0), e.offset += 4);
|
|
1059
|
+
let i = e.offset, a = 0;
|
|
1060
|
+
for (; a < n.length;) {
|
|
1061
|
+
let r = E(e);
|
|
1062
|
+
if (r & 1) a = Ee(e, r, t, n, a);
|
|
1063
|
+
else {
|
|
1064
|
+
let i = r >>> 1;
|
|
1065
|
+
Te(e, i, t, n, a), a += i;
|
|
1066
|
+
}
|
|
1067
|
+
}
|
|
1068
|
+
e.offset = i + r;
|
|
1069
|
+
}
|
|
1070
|
+
function Te(e, t, n, r, i) {
|
|
1071
|
+
let a = n + 7 >> 3, o = 0;
|
|
1072
|
+
for (let t = 0; t < a; t++) o |= e.view.getUint8(e.offset++) << (t << 3);
|
|
1073
|
+
for (let e = 0; e < t; e++) r[i + e] = o;
|
|
1074
|
+
}
|
|
1075
|
+
function Ee(e, t, n, r, i) {
|
|
1076
|
+
let a = t >> 1 << 3, o = (1 << n) - 1, s = 0;
|
|
1077
|
+
if (e.offset < e.view.byteLength) s = e.view.getUint8(e.offset++);
|
|
1078
|
+
else if (o) throw Error(`parquet bitpack offset ${e.offset} out of range`);
|
|
1079
|
+
let c = 8, l = 0;
|
|
1080
|
+
for (; a;) l > 8 ? (l -= 8, c -= 8, s >>>= 8) : c - l < n ? (s |= e.view.getUint8(e.offset) << c, e.offset++, c += 8) : (i < r.length && (r[i++] = s >> l & o), a--, l += n);
|
|
1081
|
+
return i;
|
|
1082
|
+
}
|
|
1083
|
+
function De(e, t, n, r) {
|
|
1084
|
+
let i = Oe(n, r), a = new Uint8Array(t * i);
|
|
1085
|
+
for (let n = 0; n < i; n++) for (let r = 0; r < t; r++) a[r * i + n] = e.view.getUint8(e.offset++);
|
|
1086
|
+
if (n === "FLOAT") return new Float32Array(a.buffer);
|
|
1087
|
+
if (n === "DOUBLE") return new Float64Array(a.buffer);
|
|
1088
|
+
if (n === "INT32") return new Int32Array(a.buffer);
|
|
1089
|
+
if (n === "INT64") return new BigInt64Array(a.buffer);
|
|
1090
|
+
if (n === "FIXED_LEN_BYTE_ARRAY") {
|
|
1091
|
+
let e = Array(t);
|
|
1092
|
+
for (let n = 0; n < t; n++) e[n] = a.subarray(n * i, (n + 1) * i);
|
|
1093
|
+
return e;
|
|
1094
|
+
}
|
|
1095
|
+
throw Error(`parquet byte_stream_split unsupported type: ${n}`);
|
|
1096
|
+
}
|
|
1097
|
+
function Oe(e, t) {
|
|
1098
|
+
switch (e) {
|
|
1099
|
+
case "INT32":
|
|
1100
|
+
case "FLOAT": return 4;
|
|
1101
|
+
case "INT64":
|
|
1102
|
+
case "DOUBLE": return 8;
|
|
1103
|
+
case "FIXED_LEN_BYTE_ARRAY":
|
|
1104
|
+
if (!t) throw Error("parquet byteWidth missing type_length");
|
|
1105
|
+
return t;
|
|
1106
|
+
default: throw Error(`parquet unsupported type: ${e}`);
|
|
1107
|
+
}
|
|
1108
|
+
}
|
|
1109
|
+
//#endregion
|
|
1110
|
+
//#region ../../node_modules/hyparquet/src/plain.js
|
|
1111
|
+
function Z(e, t, n, r) {
|
|
1112
|
+
if (n === 0) return [];
|
|
1113
|
+
if (t === "BOOLEAN") return ke(e, n);
|
|
1114
|
+
if (t === "INT32") return Ae(e, n);
|
|
1115
|
+
if (t === "INT64") return je(e, n);
|
|
1116
|
+
if (t === "INT96") return Me(e, n);
|
|
1117
|
+
if (t === "FLOAT") return Ne(e, n);
|
|
1118
|
+
if (t === "DOUBLE") return Pe(e, n);
|
|
1119
|
+
if (t === "BYTE_ARRAY") return Fe(e, n);
|
|
1120
|
+
if (t === "FIXED_LEN_BYTE_ARRAY") {
|
|
1121
|
+
if (!r) throw Error("parquet missing fixed length");
|
|
1122
|
+
return Ie(e, n, r);
|
|
1123
|
+
} else throw Error(`parquet unhandled type: ${t}`);
|
|
1124
|
+
}
|
|
1125
|
+
function ke(e, t) {
|
|
1126
|
+
let n = Array(t);
|
|
1127
|
+
for (let r = 0; r < t; r++) {
|
|
1128
|
+
let t = e.offset + (r / 8 | 0), i = r % 8;
|
|
1129
|
+
n[r] = (e.view.getUint8(t) & 1 << i) != 0;
|
|
1130
|
+
}
|
|
1131
|
+
return e.offset += Math.ceil(t / 8), n;
|
|
1132
|
+
}
|
|
1133
|
+
function Ae(e, t) {
|
|
1134
|
+
let n = (e.view.byteOffset + e.offset) % 4 ? new Int32Array(Q(e.view.buffer, e.view.byteOffset + e.offset, t * 4)) : new Int32Array(e.view.buffer, e.view.byteOffset + e.offset, t);
|
|
1135
|
+
return e.offset += t * 4, n;
|
|
1136
|
+
}
|
|
1137
|
+
function je(e, t) {
|
|
1138
|
+
let n = (e.view.byteOffset + e.offset) % 8 ? new BigInt64Array(Q(e.view.buffer, e.view.byteOffset + e.offset, t * 8)) : new BigInt64Array(e.view.buffer, e.view.byteOffset + e.offset, t);
|
|
1139
|
+
return e.offset += t * 8, n;
|
|
1140
|
+
}
|
|
1141
|
+
function Me(e, t) {
|
|
1142
|
+
let n = Array(t);
|
|
1143
|
+
for (let r = 0; r < t; r++) {
|
|
1144
|
+
let t = e.view.getBigInt64(e.offset + r * 12, !0), i = e.view.getInt32(e.offset + r * 12 + 8, !0);
|
|
1145
|
+
n[r] = BigInt(i) << 64n | t;
|
|
1146
|
+
}
|
|
1147
|
+
return e.offset += t * 12, n;
|
|
1148
|
+
}
|
|
1149
|
+
function Ne(e, t) {
|
|
1150
|
+
let n = (e.view.byteOffset + e.offset) % 4 ? new Float32Array(Q(e.view.buffer, e.view.byteOffset + e.offset, t * 4)) : new Float32Array(e.view.buffer, e.view.byteOffset + e.offset, t);
|
|
1151
|
+
return e.offset += t * 4, n;
|
|
1152
|
+
}
|
|
1153
|
+
function Pe(e, t) {
|
|
1154
|
+
let n = (e.view.byteOffset + e.offset) % 8 ? new Float64Array(Q(e.view.buffer, e.view.byteOffset + e.offset, t * 8)) : new Float64Array(e.view.buffer, e.view.byteOffset + e.offset, t);
|
|
1155
|
+
return e.offset += t * 8, n;
|
|
1156
|
+
}
|
|
1157
|
+
function Fe(e, t) {
|
|
1158
|
+
let n = Array(t);
|
|
1159
|
+
for (let r = 0; r < t; r++) {
|
|
1160
|
+
let t = e.view.getUint32(e.offset, !0);
|
|
1161
|
+
e.offset += 4, n[r] = new Uint8Array(e.view.buffer, e.view.byteOffset + e.offset, t), e.offset += t;
|
|
1162
|
+
}
|
|
1163
|
+
return n;
|
|
1164
|
+
}
|
|
1165
|
+
function Ie(e, t, n) {
|
|
1166
|
+
let r = Array(t);
|
|
1167
|
+
for (let i = 0; i < t; i++) r[i] = new Uint8Array(e.view.buffer, e.view.byteOffset + e.offset, n), e.offset += n;
|
|
1168
|
+
return r;
|
|
1169
|
+
}
|
|
1170
|
+
function Q(e, t, n) {
|
|
1171
|
+
let r = new ArrayBuffer(n);
|
|
1172
|
+
return new Uint8Array(r).set(new Uint8Array(e, t, n)), r;
|
|
1173
|
+
}
|
|
1174
|
+
//#endregion
|
|
1175
|
+
//#region ../../node_modules/hyparquet/src/snappy.js
|
|
1176
|
+
var Le = [
|
|
1177
|
+
0,
|
|
1178
|
+
255,
|
|
1179
|
+
65535,
|
|
1180
|
+
16777215,
|
|
1181
|
+
4294967295
|
|
1182
|
+
];
|
|
1183
|
+
function Re(e, t, n, r, i) {
|
|
1184
|
+
for (let a = 0; a < i; a++) n[r + a] = e[t + a];
|
|
1185
|
+
}
|
|
1186
|
+
function ze(e, t) {
|
|
1187
|
+
let n = e.byteLength, r = t.byteLength, i = 0, a = 0;
|
|
1188
|
+
for (; i < n;) {
|
|
1189
|
+
let t = e[i];
|
|
1190
|
+
if (i++, t < 128) break;
|
|
1191
|
+
}
|
|
1192
|
+
if (r && i >= n) throw Error("invalid snappy length header");
|
|
1193
|
+
for (; i < n;) {
|
|
1194
|
+
let r = e[i], o = 0;
|
|
1195
|
+
if (i++, i >= n) throw Error("missing eof marker");
|
|
1196
|
+
if (r & 3) {
|
|
1197
|
+
let s = 0;
|
|
1198
|
+
switch (r & 3) {
|
|
1199
|
+
case 1:
|
|
1200
|
+
o = (r >>> 2 & 7) + 4, s = e[i] + (r >>> 5 << 8), i++;
|
|
1201
|
+
break;
|
|
1202
|
+
case 2:
|
|
1203
|
+
if (n <= i + 1) throw Error("snappy error end of input");
|
|
1204
|
+
o = (r >>> 2) + 1, s = e[i] + (e[i + 1] << 8), i += 2;
|
|
1205
|
+
break;
|
|
1206
|
+
case 3:
|
|
1207
|
+
if (n <= i + 3) throw Error("snappy error end of input");
|
|
1208
|
+
o = (r >>> 2) + 1, s = e[i] + (e[i + 1] << 8) + (e[i + 2] << 16) + (e[i + 3] << 24), i += 4;
|
|
1209
|
+
break;
|
|
1210
|
+
default: break;
|
|
1211
|
+
}
|
|
1212
|
+
if (s === 0 || isNaN(s)) throw Error(`invalid offset ${s} pos ${i} inputLength ${n}`);
|
|
1213
|
+
if (s > a) throw Error("cannot copy from before start of buffer");
|
|
1214
|
+
Re(t, a - s, t, a, o), a += o;
|
|
1215
|
+
} else {
|
|
1216
|
+
let o = (r >>> 2) + 1;
|
|
1217
|
+
if (o > 60) {
|
|
1218
|
+
if (i + 3 >= n) throw Error("snappy error literal pos + 3 >= inputLength");
|
|
1219
|
+
let t = o - 60;
|
|
1220
|
+
o = e[i] + (e[i + 1] << 8) + (e[i + 2] << 16) + (e[i + 3] << 24), o = (o & Le[t]) + 1, i += t;
|
|
1221
|
+
}
|
|
1222
|
+
if (i + o > n) throw Error("snappy error literal exceeds input length");
|
|
1223
|
+
Re(e, i, t, a, o), i += o, a += o;
|
|
1224
|
+
}
|
|
1225
|
+
}
|
|
1226
|
+
if (a !== r) throw Error("premature end of input");
|
|
1227
|
+
}
|
|
1228
|
+
//#endregion
|
|
1229
|
+
//#region ../../node_modules/hyparquet/src/datapage.js
|
|
1230
|
+
function Be(e, t, { type: n, element: r, schemaPath: i }) {
|
|
1231
|
+
let a = new DataView(e.buffer, e.byteOffset, e.byteLength), o = {
|
|
1232
|
+
view: a,
|
|
1233
|
+
offset: 0
|
|
1234
|
+
}, s, c = Ve(o, t, i), { definitionLevels: l, numNulls: u } = He(o, t, i), d = t.num_values - u;
|
|
1235
|
+
if (t.encoding === "PLAIN") s = Z(o, n, d, r.type_length);
|
|
1236
|
+
else if (t.encoding === "PLAIN_DICTIONARY" || t.encoding === "RLE_DICTIONARY" || t.encoding === "RLE") {
|
|
1237
|
+
let e = n === "BOOLEAN" ? 1 : a.getUint8(o.offset++);
|
|
1238
|
+
e ? (s = Array(d), n === "BOOLEAN" ? (X(o, e, s), s = s.map((e) => !!e)) : X(o, e, s, a.byteLength - o.offset)) : s = new Uint8Array(d);
|
|
1239
|
+
} else if (t.encoding === "BYTE_STREAM_SPLIT") s = De(o, d, n, r.type_length);
|
|
1240
|
+
else if (t.encoding === "DELTA_BINARY_PACKED") s = n === "INT32" ? new Int32Array(d) : new BigInt64Array(d), J(o, d, s);
|
|
1241
|
+
else if (t.encoding === "DELTA_LENGTH_BYTE_ARRAY") s = Array(d), Ce(o, d, s);
|
|
1242
|
+
else throw Error(`parquet unsupported encoding: ${t.encoding}`);
|
|
1243
|
+
return {
|
|
1244
|
+
definitionLevels: l,
|
|
1245
|
+
repetitionLevels: c,
|
|
1246
|
+
dataPage: s
|
|
1247
|
+
};
|
|
1248
|
+
}
|
|
1249
|
+
function Ve(e, t, n) {
|
|
1250
|
+
if (n.length > 1) {
|
|
1251
|
+
let r = x(n);
|
|
1252
|
+
if (r) {
|
|
1253
|
+
let n = Array(t.num_values);
|
|
1254
|
+
return X(e, Y(r), n), n;
|
|
1255
|
+
}
|
|
1256
|
+
}
|
|
1257
|
+
return [];
|
|
1258
|
+
}
|
|
1259
|
+
function He(e, t, n) {
|
|
1260
|
+
let r = S(n);
|
|
1261
|
+
if (!r) return {
|
|
1262
|
+
definitionLevels: [],
|
|
1263
|
+
numNulls: 0
|
|
1264
|
+
};
|
|
1265
|
+
let i = Array(t.num_values);
|
|
1266
|
+
X(e, Y(r), i);
|
|
1267
|
+
let a = t.num_values;
|
|
1268
|
+
for (let e of i) e === r && a--;
|
|
1269
|
+
return a === 0 && (i.length = 0), {
|
|
1270
|
+
definitionLevels: i,
|
|
1271
|
+
numNulls: a
|
|
1272
|
+
};
|
|
1273
|
+
}
|
|
1274
|
+
function $(e, t, n, r) {
|
|
1275
|
+
let i, a = r?.[n];
|
|
1276
|
+
if (n === "UNCOMPRESSED") i = e;
|
|
1277
|
+
else if (a) i = a(e, t);
|
|
1278
|
+
else if (n === "SNAPPY") i = new Uint8Array(t), ze(e, i);
|
|
1279
|
+
else throw Error(`parquet unsupported compression codec: ${n}`);
|
|
1280
|
+
if (i?.length !== t) throw Error(`parquet decompressed page length ${i?.length} does not match header ${t}`);
|
|
1281
|
+
return i;
|
|
1282
|
+
}
|
|
1283
|
+
function Ue(e, t, n) {
|
|
1284
|
+
let r = {
|
|
1285
|
+
view: new DataView(e.buffer, e.byteOffset, e.byteLength),
|
|
1286
|
+
offset: 0
|
|
1287
|
+
}, { type: i, element: a, schemaPath: o, codec: s, compressors: c } = n, l = t.data_page_header_v2;
|
|
1288
|
+
if (!l) throw Error("parquet data page header v2 is undefined");
|
|
1289
|
+
let u = We(r, l, o);
|
|
1290
|
+
r.offset = l.repetition_levels_byte_length;
|
|
1291
|
+
let d = Ge(r, l, o), f = t.uncompressed_page_size - l.definition_levels_byte_length - l.repetition_levels_byte_length, p = e.subarray(r.offset);
|
|
1292
|
+
l.is_compressed !== !1 && (p = $(p, f, s, c));
|
|
1293
|
+
let m = new DataView(p.buffer, p.byteOffset, p.byteLength), h = {
|
|
1294
|
+
view: m,
|
|
1295
|
+
offset: 0
|
|
1296
|
+
}, g, _ = l.num_values - l.num_nulls;
|
|
1297
|
+
if (l.encoding === "PLAIN") g = Z(h, i, _, a.type_length);
|
|
1298
|
+
else if (l.encoding === "RLE") g = Array(_), X(h, 1, g), g = g.map((e) => !!e);
|
|
1299
|
+
else if (l.encoding === "PLAIN_DICTIONARY" || l.encoding === "RLE_DICTIONARY") {
|
|
1300
|
+
let e = m.getUint8(h.offset++);
|
|
1301
|
+
g = Array(_), X(h, e, g, f - 1);
|
|
1302
|
+
} else if (l.encoding === "DELTA_BINARY_PACKED") g = i === "INT32" ? new Int32Array(_) : new BigInt64Array(_), J(h, _, g);
|
|
1303
|
+
else if (l.encoding === "DELTA_LENGTH_BYTE_ARRAY") g = Array(_), Ce(h, _, g);
|
|
1304
|
+
else if (l.encoding === "DELTA_BYTE_ARRAY") g = Array(_), we(h, _, g);
|
|
1305
|
+
else if (l.encoding === "BYTE_STREAM_SPLIT") g = De(h, _, i, a.type_length);
|
|
1306
|
+
else throw Error(`parquet unsupported encoding: ${l.encoding}`);
|
|
1307
|
+
return {
|
|
1308
|
+
definitionLevels: d,
|
|
1309
|
+
repetitionLevels: u,
|
|
1310
|
+
dataPage: g
|
|
1311
|
+
};
|
|
1312
|
+
}
|
|
1313
|
+
function We(e, t, n) {
|
|
1314
|
+
let r = x(n);
|
|
1315
|
+
if (!r) return [];
|
|
1316
|
+
let i = Array(t.num_values);
|
|
1317
|
+
return X(e, Y(r), i, t.repetition_levels_byte_length), i;
|
|
1318
|
+
}
|
|
1319
|
+
function Ge(e, t, n) {
|
|
1320
|
+
let r = S(n);
|
|
1321
|
+
if (r) {
|
|
1322
|
+
let n = Array(t.num_values);
|
|
1323
|
+
return X(e, Y(r), n, t.definition_levels_byte_length), n;
|
|
1324
|
+
}
|
|
1325
|
+
}
|
|
1326
|
+
//#endregion
|
|
1327
|
+
//#region ../../node_modules/hyparquet/src/column.js
|
|
1328
|
+
function Ke(e, { groupStart: t, selectStart: n, selectEnd: r }, i, a) {
|
|
1329
|
+
let { pathInSchema: o, schemaPath: s } = i, c = re(s), l = [], u, d, f = 0, p = 0, m = a && (() => {
|
|
1330
|
+
d && a({
|
|
1331
|
+
pathInSchema: o,
|
|
1332
|
+
columnData: d,
|
|
1333
|
+
rowStart: t + f - d.length,
|
|
1334
|
+
rowEnd: t + f
|
|
1335
|
+
});
|
|
1336
|
+
});
|
|
1337
|
+
for (; (c ? f < r : e.offset < e.view.byteLength - 1) && !(e.offset >= e.view.byteLength - 1);) {
|
|
1338
|
+
let t = Je(e);
|
|
1339
|
+
if (t.type === "DICTIONARY_PAGE") {
|
|
1340
|
+
let { data: n } = qe(e, t, i, u, void 0, 0);
|
|
1341
|
+
n && (u = h(n, i));
|
|
1342
|
+
} else {
|
|
1343
|
+
let r = d?.length || 0, a = qe(e, t, i, u, d, n - f);
|
|
1344
|
+
a.skipped ? (l.length || (p += a.skipped), f += a.skipped) : a.data && d === a.data ? f += a.data.length - r : a.data && a.data.length && (m?.(), l.push(a.data), f += a.data.length, d = a.data);
|
|
1345
|
+
}
|
|
1346
|
+
}
|
|
1347
|
+
return m?.(), {
|
|
1348
|
+
data: l,
|
|
1349
|
+
skipped: p
|
|
1350
|
+
};
|
|
1351
|
+
}
|
|
1352
|
+
function qe(e, t, n, r, i, a) {
|
|
1353
|
+
let { type: o, element: s, schemaPath: c, codec: l, compressors: u } = n, d = new Uint8Array(e.view.buffer, e.view.byteOffset + e.offset, t.compressed_page_size);
|
|
1354
|
+
if (e.offset += t.compressed_page_size, t.type === "DATA_PAGE") {
|
|
1355
|
+
let e = t.data_page_header;
|
|
1356
|
+
if (!e) throw Error("parquet data page header is undefined");
|
|
1357
|
+
if (a > e.num_values && re(c)) return { skipped: e.num_values };
|
|
1358
|
+
let { definitionLevels: o, repetitionLevels: s, dataPage: f } = Be($(d, Number(t.uncompressed_page_size), l, u), e, n), p = m(f, r, e.encoding, n);
|
|
1359
|
+
return {
|
|
1360
|
+
skipped: 0,
|
|
1361
|
+
data: G(Array.isArray(i) ? i : [], o, s, p, c)
|
|
1362
|
+
};
|
|
1363
|
+
} else if (t.type === "DATA_PAGE_V2") {
|
|
1364
|
+
let e = t.data_page_header_v2;
|
|
1365
|
+
if (!e) throw Error("parquet data page header v2 is undefined");
|
|
1366
|
+
if (a > e.num_rows) return { skipped: e.num_values };
|
|
1367
|
+
let { definitionLevels: o, repetitionLevels: s, dataPage: l } = Ue(d, t, n), u = m(l, r, e.encoding, n);
|
|
1368
|
+
return {
|
|
1369
|
+
skipped: 0,
|
|
1370
|
+
data: G(Array.isArray(i) ? i : [], o, s, u, c)
|
|
1371
|
+
};
|
|
1372
|
+
} else if (t.type === "DICTIONARY_PAGE") {
|
|
1373
|
+
let e = t.dictionary_page_header;
|
|
1374
|
+
if (!e) throw Error("parquet dictionary page header is undefined");
|
|
1375
|
+
let n = $(d, Number(t.uncompressed_page_size), l, u);
|
|
1376
|
+
return {
|
|
1377
|
+
skipped: 0,
|
|
1378
|
+
data: Z({
|
|
1379
|
+
view: new DataView(n.buffer, n.byteOffset, n.byteLength),
|
|
1380
|
+
offset: 0
|
|
1381
|
+
}, o, e.num_values, s.type_length)
|
|
1382
|
+
};
|
|
1383
|
+
} else throw Error(`parquet unsupported page type: ${t.type}`);
|
|
1384
|
+
}
|
|
1385
|
+
function Je(e) {
|
|
1386
|
+
let n = w(e);
|
|
1387
|
+
return {
|
|
1388
|
+
type: a[n.field_1],
|
|
1389
|
+
uncompressed_page_size: n.field_2,
|
|
1390
|
+
compressed_page_size: n.field_3,
|
|
1391
|
+
crc: n.field_4,
|
|
1392
|
+
data_page_header: n.field_5 && {
|
|
1393
|
+
num_values: n.field_5.field_1,
|
|
1394
|
+
encoding: t[n.field_5.field_2],
|
|
1395
|
+
definition_level_encoding: t[n.field_5.field_3],
|
|
1396
|
+
repetition_level_encoding: t[n.field_5.field_4],
|
|
1397
|
+
statistics: n.field_5.field_5 && {
|
|
1398
|
+
max: n.field_5.field_5.field_1,
|
|
1399
|
+
min: n.field_5.field_5.field_2,
|
|
1400
|
+
null_count: n.field_5.field_5.field_3,
|
|
1401
|
+
distinct_count: n.field_5.field_5.field_4,
|
|
1402
|
+
max_value: n.field_5.field_5.field_5,
|
|
1403
|
+
min_value: n.field_5.field_5.field_6
|
|
1404
|
+
}
|
|
1405
|
+
},
|
|
1406
|
+
index_page_header: n.field_6,
|
|
1407
|
+
dictionary_page_header: n.field_7 && {
|
|
1408
|
+
num_values: n.field_7.field_1,
|
|
1409
|
+
encoding: t[n.field_7.field_2],
|
|
1410
|
+
is_sorted: n.field_7.field_3
|
|
1411
|
+
},
|
|
1412
|
+
data_page_header_v2: n.field_8 && {
|
|
1413
|
+
num_values: n.field_8.field_1,
|
|
1414
|
+
num_nulls: n.field_8.field_2,
|
|
1415
|
+
num_rows: n.field_8.field_3,
|
|
1416
|
+
encoding: t[n.field_8.field_4],
|
|
1417
|
+
definition_levels_byte_length: n.field_8.field_5,
|
|
1418
|
+
repetition_levels_byte_length: n.field_8.field_6,
|
|
1419
|
+
is_compressed: n.field_8.field_7 === void 0 ? !0 : n.field_8.field_7,
|
|
1420
|
+
statistics: n.field_8.field_8
|
|
1421
|
+
}
|
|
1422
|
+
};
|
|
1423
|
+
}
|
|
1424
|
+
//#endregion
|
|
1425
|
+
//#region ../../node_modules/hyparquet/src/indexes.js
|
|
1426
|
+
function Ye(e) {
|
|
1427
|
+
let t = w(e);
|
|
1428
|
+
return {
|
|
1429
|
+
page_locations: t.field_1.map(Xe),
|
|
1430
|
+
unencoded_byte_array_data_bytes: t.field_2
|
|
1431
|
+
};
|
|
1432
|
+
}
|
|
1433
|
+
function Xe(e) {
|
|
1434
|
+
return {
|
|
1435
|
+
offset: e.field_1,
|
|
1436
|
+
compressed_page_size: e.field_2,
|
|
1437
|
+
first_row_index: e.field_3
|
|
1438
|
+
};
|
|
1439
|
+
}
|
|
1440
|
+
//#endregion
|
|
1441
|
+
//#region ../../node_modules/hyparquet/src/rowgroup.js
|
|
1442
|
+
function Ze(e, { metadata: t }, n) {
|
|
1443
|
+
let { file: r, compressors: i, utf8: a } = e, o = [], s = {
|
|
1444
|
+
...p,
|
|
1445
|
+
...e.parsers
|
|
1446
|
+
};
|
|
1447
|
+
for (let c of n.chunks) {
|
|
1448
|
+
let { columnMetadata: l } = c, u = b(t.schema, l.path_in_schema), d = {
|
|
1449
|
+
pathInSchema: l.path_in_schema,
|
|
1450
|
+
type: l.type,
|
|
1451
|
+
element: u[u.length - 1].element,
|
|
1452
|
+
schemaPath: u,
|
|
1453
|
+
codec: l.codec,
|
|
1454
|
+
parsers: s,
|
|
1455
|
+
compressors: i,
|
|
1456
|
+
utf8: a
|
|
1457
|
+
};
|
|
1458
|
+
if (!("offsetIndex" in c)) {
|
|
1459
|
+
o.push({
|
|
1460
|
+
pathInSchema: l.path_in_schema,
|
|
1461
|
+
data: Promise.resolve(r.slice(c.range.startByte, c.range.endByte)).then((t) => Ke({
|
|
1462
|
+
view: new DataView(t),
|
|
1463
|
+
offset: 0
|
|
1464
|
+
}, n, d, e.onPage))
|
|
1465
|
+
});
|
|
1466
|
+
continue;
|
|
1467
|
+
}
|
|
1468
|
+
o.push({
|
|
1469
|
+
pathInSchema: l.path_in_schema,
|
|
1470
|
+
data: Promise.resolve(r.slice(c.offsetIndex.startByte, c.offsetIndex.endByte)).then(async (t) => {
|
|
1471
|
+
let i = Ye({
|
|
1472
|
+
view: new DataView(t),
|
|
1473
|
+
offset: 0
|
|
1474
|
+
}), { selectStart: a, selectEnd: o } = n, s = i.page_locations, c = NaN, l = NaN, u = 0;
|
|
1475
|
+
for (let e = 0; e < s.length; e++) {
|
|
1476
|
+
let t = s[e], r = Number(t.first_row_index), i = e + 1 < s.length ? Number(s[e + 1].first_row_index) : n.groupRows;
|
|
1477
|
+
r < o && i > a && (Number.isNaN(c) && (c = Number(t.offset), u = r), l = Number(t.offset) + t.compressed_page_size);
|
|
1478
|
+
}
|
|
1479
|
+
let f = await r.slice(c, l), { data: p, skipped: m } = Ke({
|
|
1480
|
+
view: new DataView(f),
|
|
1481
|
+
offset: 0
|
|
1482
|
+
}, u ? {
|
|
1483
|
+
...n,
|
|
1484
|
+
groupStart: n.groupStart + u,
|
|
1485
|
+
selectStart: n.selectStart - u,
|
|
1486
|
+
selectEnd: n.selectEnd - u
|
|
1487
|
+
} : n, d, e.onPage);
|
|
1488
|
+
return {
|
|
1489
|
+
data: p,
|
|
1490
|
+
skipped: u + m
|
|
1491
|
+
};
|
|
1492
|
+
})
|
|
1493
|
+
});
|
|
1494
|
+
}
|
|
1495
|
+
return {
|
|
1496
|
+
groupStart: n.groupStart,
|
|
1497
|
+
groupRows: n.groupRows,
|
|
1498
|
+
asyncColumns: o
|
|
1499
|
+
};
|
|
1500
|
+
}
|
|
1501
|
+
function Qe(e, t, n) {
|
|
1502
|
+
let { asyncColumns: r } = e;
|
|
1503
|
+
n = {
|
|
1504
|
+
...p,
|
|
1505
|
+
...n
|
|
1506
|
+
};
|
|
1507
|
+
let i = [];
|
|
1508
|
+
for (let e of t.children) if (e.children.length) {
|
|
1509
|
+
let t = r.filter((t) => t.pathInSchema[0] === e.element.name);
|
|
1510
|
+
if (!t.length) continue;
|
|
1511
|
+
let a = /* @__PURE__ */ new Map(), o = Promise.all(t.map((e) => e.data.then(({ data: t }) => {
|
|
1512
|
+
a.set(e.pathInSchema.join("."), pe(t));
|
|
1513
|
+
}))).then(() => {
|
|
1514
|
+
K(a, e, n);
|
|
1515
|
+
let t = a.get(e.path.join("."));
|
|
1516
|
+
if (!t) throw Error("parquet column data not assembled");
|
|
1517
|
+
return {
|
|
1518
|
+
data: [t],
|
|
1519
|
+
skipped: 0
|
|
1520
|
+
};
|
|
1521
|
+
});
|
|
1522
|
+
i.push({
|
|
1523
|
+
pathInSchema: e.path,
|
|
1524
|
+
data: o
|
|
1525
|
+
});
|
|
1526
|
+
} else {
|
|
1527
|
+
let t = r.find((t) => t.pathInSchema[0] === e.element.name);
|
|
1528
|
+
t && i.push(t);
|
|
1529
|
+
}
|
|
1530
|
+
return {
|
|
1531
|
+
...e,
|
|
1532
|
+
asyncColumns: i
|
|
1533
|
+
};
|
|
1534
|
+
}
|
|
1535
|
+
//#endregion
|
|
1536
|
+
//#region ../core/src/data/formats/parquetRead.js
|
|
1537
|
+
var $e = /* @__PURE__ */ new Map(), et = 200;
|
|
1538
|
+
function tt(e) {
|
|
1539
|
+
if (!e.metadata) throw Error("parquet requires metadata");
|
|
1540
|
+
let t = he(e);
|
|
1541
|
+
return e.file = ge(e.file, t), t.groups.map((n) => Ze(e, t, n));
|
|
1542
|
+
}
|
|
1543
|
+
function nt(e) {
|
|
1544
|
+
if (!e) return [];
|
|
1545
|
+
if (e.length === 1) return e[0];
|
|
1546
|
+
let t = 0;
|
|
1547
|
+
for (let n of e) t += n.length;
|
|
1548
|
+
let n = Array(t), r = 0;
|
|
1549
|
+
for (let t of e) {
|
|
1550
|
+
for (let e = 0; e < t.length; e++) n[r + e] = t[e];
|
|
1551
|
+
r += t.length;
|
|
1552
|
+
}
|
|
1553
|
+
return n;
|
|
1554
|
+
}
|
|
1555
|
+
function rt(e) {
|
|
1556
|
+
let t = e.join(""), n = $e.get(t);
|
|
1557
|
+
if (n) return n;
|
|
1558
|
+
let r = e.map((e, t) => JSON.stringify(e) + ": columnData[" + t + "][row - columnSkipped[" + t + "]]").join(",\n"), i = Function("groupData", "selectStart", "selectCount", "columnData", "columnSkipped", "for (let selectRow = 0; selectRow < selectCount; selectRow++) {\n const row = selectStart + selectRow;\n groupData[selectRow] = {\n" + r + "\n };\n}\nreturn groupData;");
|
|
1559
|
+
return $e.set(t, i), i;
|
|
1560
|
+
}
|
|
1561
|
+
function it(e, t, n, r, i, a) {
|
|
1562
|
+
for (let o = 0; o < n; o++) {
|
|
1563
|
+
let n = t + o, s = {};
|
|
1564
|
+
for (let e = 0; e < r.length; e++) s[r[e]] = i[e][n - a[e]];
|
|
1565
|
+
e[o] = s;
|
|
1566
|
+
}
|
|
1567
|
+
return e;
|
|
1568
|
+
}
|
|
1569
|
+
async function at({ asyncColumns: e }, t, n) {
|
|
1570
|
+
let r = await Promise.all(e.map((e) => e.data)), i = e.length, a = Array(i), o = Array(i), s = Array(i);
|
|
1571
|
+
for (let t = 0; t < i; t++) a[t] = e[t].pathInSchema[0], o[t] = nt(r[t].data), s[t] = r[t].skipped;
|
|
1572
|
+
let c = n - t, l = Array(c);
|
|
1573
|
+
return i > et ? it(l, t, c, a, o, s) : rt(a)(l, t, c, o, s);
|
|
1574
|
+
}
|
|
1575
|
+
async function ot(e) {
|
|
1576
|
+
if ("rowFormat" in e) throw Error("parquetRead supports only object rows; use rowFormat: \"object\" implicitly");
|
|
1577
|
+
if ("filter" in e || "filterStrict" in e) throw Error("parquetRead does not support filtering");
|
|
1578
|
+
e.metadata ??= await le(e.file, e);
|
|
1579
|
+
let { rowStart: t = 0, rowEnd: n, onChunk: r, onComplete: i } = e, a = tt(e);
|
|
1580
|
+
if (!i && !r) {
|
|
1581
|
+
for (let { asyncColumns: e } of a) for (let { data: t } of e) await t;
|
|
1582
|
+
return;
|
|
1583
|
+
}
|
|
1584
|
+
let o = A(e.metadata), s = a.map((t) => Qe(t, o, e.parsers));
|
|
1585
|
+
if (r) for (let e of s) for (let t of e.asyncColumns) t.data.then((n) => {
|
|
1586
|
+
let i = e.groupStart + n.skipped;
|
|
1587
|
+
for (let e of n.data) r({
|
|
1588
|
+
columnName: t.pathInSchema[0],
|
|
1589
|
+
columnData: e,
|
|
1590
|
+
rowStart: i,
|
|
1591
|
+
rowEnd: i + e.length
|
|
1592
|
+
}), i += e.length;
|
|
1593
|
+
});
|
|
1594
|
+
if (i) {
|
|
1595
|
+
let e = [];
|
|
1596
|
+
for (let r of s) N(e, await at(r, Math.max(t - r.groupStart, 0), Math.min((n ?? Infinity) - r.groupStart, r.groupRows)));
|
|
1597
|
+
i(e);
|
|
1598
|
+
} else for (let { asyncColumns: e } of s) for (let { data: t } of e) await t;
|
|
1599
|
+
}
|
|
1600
|
+
function st(e) {
|
|
1601
|
+
return new Promise((t, n) => {
|
|
1602
|
+
ot({
|
|
1603
|
+
...e,
|
|
1604
|
+
onComplete: t
|
|
1605
|
+
}).catch(n);
|
|
1606
|
+
});
|
|
1607
|
+
}
|
|
1608
|
+
//#endregion
|
|
1609
|
+
export { st as parquetReadObjects };
|