@duckdb/duckdb-wasm 1.16.0 → 1.16.1
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/duckdb-browser-blocking.cjs +4 -4
- package/dist/duckdb-browser-blocking.cjs.map +4 -4
- package/dist/duckdb-browser-blocking.mjs +4 -4
- package/dist/duckdb-browser-blocking.mjs.map +4 -4
- package/dist/duckdb-browser-coi.pthread.worker.js +2 -2
- package/dist/duckdb-browser-coi.pthread.worker.js.map +4 -4
- package/dist/duckdb-browser-coi.worker.js +9 -23
- package/dist/duckdb-browser-coi.worker.js.map +4 -4
- package/dist/duckdb-browser-eh.worker.js +8 -22
- package/dist/duckdb-browser-eh.worker.js.map +4 -4
- package/dist/duckdb-browser-mvp.worker.js +8 -22
- package/dist/duckdb-browser-mvp.worker.js.map +4 -4
- package/dist/duckdb-browser.cjs +1 -1
- package/dist/duckdb-browser.cjs.map +3 -3
- package/dist/duckdb-browser.mjs +1 -1
- package/dist/duckdb-browser.mjs.map +3 -3
- package/dist/duckdb-coi.wasm +0 -0
- package/dist/duckdb-eh.wasm +0 -0
- package/dist/duckdb-mvp.wasm +0 -0
- package/dist/duckdb-node-blocking.cjs +4 -4
- package/dist/duckdb-node-blocking.cjs.map +4 -4
- package/dist/duckdb-node-eh.worker.cjs +4 -4
- package/dist/duckdb-node-eh.worker.cjs.map +4 -4
- package/dist/duckdb-node-mvp.worker.cjs +3 -3
- package/dist/duckdb-node-mvp.worker.cjs.map +4 -4
- package/dist/duckdb-node.cjs +1 -1
- package/dist/duckdb-node.cjs.map +3 -3
- package/dist/tests-browser.js +628 -284
- package/dist/tests-browser.js.map +4 -4
- package/dist/tests-node.cjs +542 -240
- package/dist/tests-node.cjs.map +4 -4
- package/package.json +12 -12
package/dist/tests-browser.js
CHANGED
|
@@ -28,7 +28,10 @@ var duckdb = (() => {
|
|
|
28
28
|
}
|
|
29
29
|
return to;
|
|
30
30
|
};
|
|
31
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
31
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
32
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
33
|
+
mod
|
|
34
|
+
));
|
|
32
35
|
|
|
33
36
|
// ../../node_modules/tslib/tslib.js
|
|
34
37
|
var require_tslib = __commonJS({
|
|
@@ -56,6 +59,7 @@ var duckdb = (() => {
|
|
|
56
59
|
var __importDefault2;
|
|
57
60
|
var __classPrivateFieldGet2;
|
|
58
61
|
var __classPrivateFieldSet2;
|
|
62
|
+
var __classPrivateFieldIn2;
|
|
59
63
|
var __createBinding2;
|
|
60
64
|
(function(factory) {
|
|
61
65
|
var root2 = typeof global === "object" ? global : typeof self === "object" ? self : typeof this === "object" ? this : {};
|
|
@@ -248,9 +252,13 @@ var duckdb = (() => {
|
|
|
248
252
|
__createBinding2 = Object.create ? function(o, m, k, k2) {
|
|
249
253
|
if (k2 === void 0)
|
|
250
254
|
k2 = k;
|
|
251
|
-
Object.
|
|
252
|
-
|
|
253
|
-
|
|
255
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
256
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
257
|
+
desc = { enumerable: true, get: function() {
|
|
258
|
+
return m[k];
|
|
259
|
+
} };
|
|
260
|
+
}
|
|
261
|
+
Object.defineProperty(o, k2, desc);
|
|
254
262
|
} : function(o, m, k, k2) {
|
|
255
263
|
if (k2 === void 0)
|
|
256
264
|
k2 = k;
|
|
@@ -431,6 +439,11 @@ var duckdb = (() => {
|
|
|
431
439
|
throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
432
440
|
return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
|
|
433
441
|
};
|
|
442
|
+
__classPrivateFieldIn2 = function(state, receiver) {
|
|
443
|
+
if (receiver === null || typeof receiver !== "object" && typeof receiver !== "function")
|
|
444
|
+
throw new TypeError("Cannot use 'in' operator on non-object");
|
|
445
|
+
return typeof state === "function" ? receiver === state : state.has(receiver);
|
|
446
|
+
};
|
|
434
447
|
exporter("__extends", __extends2);
|
|
435
448
|
exporter("__assign", __assign2);
|
|
436
449
|
exporter("__rest", __rest2);
|
|
@@ -455,6 +468,7 @@ var duckdb = (() => {
|
|
|
455
468
|
exporter("__importDefault", __importDefault2);
|
|
456
469
|
exporter("__classPrivateFieldGet", __classPrivateFieldGet2);
|
|
457
470
|
exporter("__classPrivateFieldSet", __classPrivateFieldSet2);
|
|
471
|
+
exporter("__classPrivateFieldIn", __classPrivateFieldIn2);
|
|
458
472
|
});
|
|
459
473
|
}
|
|
460
474
|
});
|
|
@@ -1013,7 +1027,8 @@ var duckdb = (() => {
|
|
|
1013
1027
|
__importStar,
|
|
1014
1028
|
__importDefault,
|
|
1015
1029
|
__classPrivateFieldGet,
|
|
1016
|
-
__classPrivateFieldSet
|
|
1030
|
+
__classPrivateFieldSet,
|
|
1031
|
+
__classPrivateFieldIn
|
|
1017
1032
|
} = import_tslib.default;
|
|
1018
1033
|
|
|
1019
1034
|
// ../../node_modules/apache-arrow/util/buffer.mjs
|
|
@@ -1296,14 +1311,16 @@ var duckdb = (() => {
|
|
|
1296
1311
|
});
|
|
1297
1312
|
};
|
|
1298
1313
|
const buffers = typeof source === "string" ? wrap(source) : ArrayBuffer.isView(source) ? wrap(source) : source instanceof ArrayBuffer ? wrap(source) : source instanceof SharedArrayBuf ? wrap(source) : isIterable(source) ? emit(source) : !isAsyncIterable(source) ? wrap(source) : source;
|
|
1299
|
-
yield __await(
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1314
|
+
yield __await(
|
|
1315
|
+
yield* __asyncDelegator(__asyncValues(pump(function(it2) {
|
|
1316
|
+
return __asyncGenerator(this, arguments, function* () {
|
|
1317
|
+
let r = null;
|
|
1318
|
+
do {
|
|
1319
|
+
r = yield __await(it2.next(yield yield __await(toArrayBufferView(ArrayCtor, r))));
|
|
1320
|
+
} while (!r.done);
|
|
1321
|
+
});
|
|
1322
|
+
}(buffers[Symbol.asyncIterator]()))))
|
|
1323
|
+
);
|
|
1307
1324
|
return yield __await(new ArrayCtor());
|
|
1308
1325
|
});
|
|
1309
1326
|
}
|
|
@@ -3816,7 +3833,14 @@ var duckdb = (() => {
|
|
|
3816
3833
|
const nullCount = +(this._nullCount === 0) - 1;
|
|
3817
3834
|
const childStride = typeId === 16 ? stride : 1;
|
|
3818
3835
|
const buffers = this._sliceBuffers(offset, length, stride, typeId);
|
|
3819
|
-
return this.clone(
|
|
3836
|
+
return this.clone(
|
|
3837
|
+
this.type,
|
|
3838
|
+
this.offset + offset,
|
|
3839
|
+
length,
|
|
3840
|
+
nullCount,
|
|
3841
|
+
buffers,
|
|
3842
|
+
children.length === 0 || this.valueOffsets ? children : this._sliceChildren(children, childStride * offset, childStride * length)
|
|
3843
|
+
);
|
|
3820
3844
|
}
|
|
3821
3845
|
_changeLengthAndBackfillNullBitmap(newLength) {
|
|
3822
3846
|
if (this.typeId === Type.Null) {
|
|
@@ -4369,7 +4393,7 @@ var duckdb = (() => {
|
|
|
4369
4393
|
constructor(input) {
|
|
4370
4394
|
var _b2, _c2, _d2;
|
|
4371
4395
|
const data = input[0] instanceof Vector ? input.flatMap((x) => x.data) : input;
|
|
4372
|
-
if (data.some((x) => !(x instanceof Data))) {
|
|
4396
|
+
if (data.length === 0 || data.some((x) => !(x instanceof Data))) {
|
|
4373
4397
|
throw new TypeError("Vector constructor expects an Array of Data instances.");
|
|
4374
4398
|
}
|
|
4375
4399
|
const type = (_b2 = data[0]) === null || _b2 === void 0 ? void 0 : _b2.type;
|
|
@@ -8822,7 +8846,10 @@ return true;`);
|
|
|
8822
8846
|
return 0;
|
|
8823
8847
|
}
|
|
8824
8848
|
[Symbol.iterator]() {
|
|
8825
|
-
|
|
8849
|
+
if (this.batches.length > 0) {
|
|
8850
|
+
return instance4.visit(new Vector(this.data));
|
|
8851
|
+
}
|
|
8852
|
+
return new Array(0)[Symbol.iterator]();
|
|
8826
8853
|
}
|
|
8827
8854
|
toArray() {
|
|
8828
8855
|
return [...this];
|
|
@@ -11718,9 +11745,7 @@ return true;`);
|
|
|
11718
11745
|
this._bindings.createScalarFunction(this._conn, name, returns, func);
|
|
11719
11746
|
}
|
|
11720
11747
|
insertArrowTable(table, options) {
|
|
11721
|
-
const
|
|
11722
|
-
writer.writeAll(table);
|
|
11723
|
-
const buffer = writer.toUint8Array(true);
|
|
11748
|
+
const buffer = tableToIPC(table, "stream");
|
|
11724
11749
|
this.insertArrowFromIPCStream(buffer, options);
|
|
11725
11750
|
}
|
|
11726
11751
|
insertArrowFromIPCStream(buffer, options) {
|
|
@@ -11873,7 +11898,10 @@ return true;`);
|
|
|
11873
11898
|
strings.push(null);
|
|
11874
11899
|
continue;
|
|
11875
11900
|
}
|
|
11876
|
-
const subarray = mod.HEAPU8.subarray(
|
|
11901
|
+
const subarray = mod.HEAPU8.subarray(
|
|
11902
|
+
raw[j],
|
|
11903
|
+
raw[j] + stringLengths[j]
|
|
11904
|
+
);
|
|
11877
11905
|
const str = TEXT_DECODER.decode(subarray);
|
|
11878
11906
|
strings.push(str);
|
|
11879
11907
|
}
|
|
@@ -11910,7 +11938,9 @@ return true;`);
|
|
|
11910
11938
|
}
|
|
11911
11939
|
default: {
|
|
11912
11940
|
if (arg.dataBuffer === void 0) {
|
|
11913
|
-
throw new Error(
|
|
11941
|
+
throw new Error(
|
|
11942
|
+
"malformed data view, expected data buffer for argument of type: " + arg.physicalType
|
|
11943
|
+
);
|
|
11914
11944
|
}
|
|
11915
11945
|
const data = ptrToArray(mod, ptrs[arg.dataBuffer], arg.physicalType, desc.rows);
|
|
11916
11946
|
if (validity != null) {
|
|
@@ -12339,12 +12369,20 @@ return true;`);
|
|
|
12339
12369
|
func
|
|
12340
12370
|
};
|
|
12341
12371
|
this._nextUDFId += 1;
|
|
12342
|
-
const [s, d, n] = callSRet(
|
|
12372
|
+
const [s, d, n] = callSRet(
|
|
12373
|
+
this.mod,
|
|
12374
|
+
"duckdb_web_udf_scalar_create",
|
|
12375
|
+
["number", "string"],
|
|
12376
|
+
[conn, JSON.stringify(decl)]
|
|
12377
|
+
);
|
|
12343
12378
|
if (s !== 0 /* SUCCESS */) {
|
|
12344
12379
|
throw new Error(readString(this.mod, d, n));
|
|
12345
12380
|
}
|
|
12346
12381
|
dropResponseBuffers(this.mod);
|
|
12347
|
-
globalThis.DUCKDB_RUNTIME._udfFunctions = (globalThis.DUCKDB_RUNTIME._udfFunctions || /* @__PURE__ */ new Map()).set(
|
|
12382
|
+
globalThis.DUCKDB_RUNTIME._udfFunctions = (globalThis.DUCKDB_RUNTIME._udfFunctions || /* @__PURE__ */ new Map()).set(
|
|
12383
|
+
def.functionId,
|
|
12384
|
+
def
|
|
12385
|
+
);
|
|
12348
12386
|
if (this.pthread) {
|
|
12349
12387
|
for (const worker2 of [...this.pthread.runningWorkers, ...this.pthread.unusedWorkers]) {
|
|
12350
12388
|
worker2.postMessage({
|
|
@@ -12370,7 +12408,12 @@ return true;`);
|
|
|
12370
12408
|
dropResponseBuffers(this.mod);
|
|
12371
12409
|
}
|
|
12372
12410
|
runPrepared(conn, statement, params) {
|
|
12373
|
-
const [s, d, n] = callSRet(
|
|
12411
|
+
const [s, d, n] = callSRet(
|
|
12412
|
+
this.mod,
|
|
12413
|
+
"duckdb_web_prepared_run",
|
|
12414
|
+
["number", "number", "string"],
|
|
12415
|
+
[conn, statement, JSON.stringify(params)]
|
|
12416
|
+
);
|
|
12374
12417
|
if (s !== 0 /* SUCCESS */) {
|
|
12375
12418
|
throw new Error(readString(this.mod, d, n));
|
|
12376
12419
|
}
|
|
@@ -12379,7 +12422,12 @@ return true;`);
|
|
|
12379
12422
|
return res;
|
|
12380
12423
|
}
|
|
12381
12424
|
sendPrepared(conn, statement, params) {
|
|
12382
|
-
const [s, d, n] = callSRet(
|
|
12425
|
+
const [s, d, n] = callSRet(
|
|
12426
|
+
this.mod,
|
|
12427
|
+
"duckdb_web_prepared_send",
|
|
12428
|
+
["number", "number", "string"],
|
|
12429
|
+
[conn, statement, JSON.stringify(params)]
|
|
12430
|
+
);
|
|
12383
12431
|
if (s !== 0 /* SUCCESS */) {
|
|
12384
12432
|
throw new Error(readString(this.mod, d, n));
|
|
12385
12433
|
}
|
|
@@ -12394,7 +12442,12 @@ return true;`);
|
|
|
12394
12442
|
const bufferOfs = this.mod.HEAPU8.subarray(bufferPtr, bufferPtr + buffer.length);
|
|
12395
12443
|
bufferOfs.set(buffer);
|
|
12396
12444
|
const optJSON = options ? JSON.stringify(options) : "";
|
|
12397
|
-
const [s, d, n] = callSRet(
|
|
12445
|
+
const [s, d, n] = callSRet(
|
|
12446
|
+
this.mod,
|
|
12447
|
+
"duckdb_web_insert_arrow_from_ipc_stream",
|
|
12448
|
+
["number", "number", "number", "string"],
|
|
12449
|
+
[conn, bufferPtr, buffer.length, optJSON]
|
|
12450
|
+
);
|
|
12398
12451
|
if (s !== 0 /* SUCCESS */) {
|
|
12399
12452
|
throw new Error(readString(this.mod, d, n));
|
|
12400
12453
|
}
|
|
@@ -12410,7 +12463,12 @@ return true;`);
|
|
|
12410
12463
|
opt.columns = opt.columnsFlat;
|
|
12411
12464
|
delete opt.columnsFlat;
|
|
12412
12465
|
const optJSON = JSON.stringify(opt);
|
|
12413
|
-
const [s, d, n] = callSRet(
|
|
12466
|
+
const [s, d, n] = callSRet(
|
|
12467
|
+
this.mod,
|
|
12468
|
+
"duckdb_web_insert_csv_from_path",
|
|
12469
|
+
["number", "string", "string"],
|
|
12470
|
+
[conn, path, optJSON]
|
|
12471
|
+
);
|
|
12414
12472
|
if (s !== 0 /* SUCCESS */) {
|
|
12415
12473
|
throw new Error(readString(this.mod, d, n));
|
|
12416
12474
|
}
|
|
@@ -12426,7 +12484,12 @@ return true;`);
|
|
|
12426
12484
|
opt.columns = opt.columnsFlat;
|
|
12427
12485
|
delete opt.columnsFlat;
|
|
12428
12486
|
const optJSON = JSON.stringify(opt);
|
|
12429
|
-
const [s, d, n] = callSRet(
|
|
12487
|
+
const [s, d, n] = callSRet(
|
|
12488
|
+
this.mod,
|
|
12489
|
+
"duckdb_web_insert_json_from_path",
|
|
12490
|
+
["number", "string", "string"],
|
|
12491
|
+
[conn, path, optJSON]
|
|
12492
|
+
);
|
|
12430
12493
|
if (s !== 0 /* SUCCESS */) {
|
|
12431
12494
|
throw new Error(readString(this.mod, d, n));
|
|
12432
12495
|
}
|
|
@@ -12448,7 +12511,12 @@ return true;`);
|
|
|
12448
12511
|
if (url === void 0) {
|
|
12449
12512
|
url = name;
|
|
12450
12513
|
}
|
|
12451
|
-
const [s, d, n] = callSRet(
|
|
12514
|
+
const [s, d, n] = callSRet(
|
|
12515
|
+
this.mod,
|
|
12516
|
+
"duckdb_web_fs_register_file_url",
|
|
12517
|
+
["string", "string", "number"],
|
|
12518
|
+
[name, url, -1]
|
|
12519
|
+
);
|
|
12452
12520
|
if (s !== 0 /* SUCCESS */) {
|
|
12453
12521
|
throw new Error(readString(this.mod, d, n));
|
|
12454
12522
|
}
|
|
@@ -12462,14 +12530,24 @@ return true;`);
|
|
|
12462
12530
|
const ptr = this.mod._malloc(buffer.length);
|
|
12463
12531
|
const dst = this.mod.HEAPU8.subarray(ptr, ptr + buffer.length);
|
|
12464
12532
|
dst.set(buffer);
|
|
12465
|
-
const [s, d, n] = callSRet(
|
|
12533
|
+
const [s, d, n] = callSRet(
|
|
12534
|
+
this.mod,
|
|
12535
|
+
"duckdb_web_fs_register_file_buffer",
|
|
12536
|
+
["string", "number", "number"],
|
|
12537
|
+
[name, ptr, buffer.length]
|
|
12538
|
+
);
|
|
12466
12539
|
if (s !== 0 /* SUCCESS */) {
|
|
12467
12540
|
throw new Error(readString(this.mod, d, n));
|
|
12468
12541
|
}
|
|
12469
12542
|
dropResponseBuffers(this.mod);
|
|
12470
12543
|
}
|
|
12471
12544
|
registerFileHandle(name, handle) {
|
|
12472
|
-
const [s, d, n] = callSRet(
|
|
12545
|
+
const [s, d, n] = callSRet(
|
|
12546
|
+
this.mod,
|
|
12547
|
+
"duckdb_web_fs_register_file_url",
|
|
12548
|
+
["string", "string", "number"],
|
|
12549
|
+
[name, name, -1]
|
|
12550
|
+
);
|
|
12473
12551
|
if (s !== 0 /* SUCCESS */) {
|
|
12474
12552
|
throw new Error(readString(this.mod, d, n));
|
|
12475
12553
|
}
|
|
@@ -12757,7 +12835,12 @@ return true;`);
|
|
|
12757
12835
|
getFileInfo(mod, fileId) {
|
|
12758
12836
|
try {
|
|
12759
12837
|
const cached = BROWSER_RUNTIME._fileInfoCache.get(fileId);
|
|
12760
|
-
const [s, d, n] = callSRet(
|
|
12838
|
+
const [s, d, n] = callSRet(
|
|
12839
|
+
mod,
|
|
12840
|
+
"duckdb_web_fs_get_file_info_by_id",
|
|
12841
|
+
["number", "number"],
|
|
12842
|
+
[fileId, cached?.cacheEpoch || 0]
|
|
12843
|
+
);
|
|
12761
12844
|
if (s !== 0 /* SUCCESS */) {
|
|
12762
12845
|
return null;
|
|
12763
12846
|
} else if (n === 0) {
|
|
@@ -12778,7 +12861,12 @@ return true;`);
|
|
|
12778
12861
|
},
|
|
12779
12862
|
getGlobalFileInfo(mod) {
|
|
12780
12863
|
try {
|
|
12781
|
-
const [s, d, n] = callSRet(
|
|
12864
|
+
const [s, d, n] = callSRet(
|
|
12865
|
+
mod,
|
|
12866
|
+
"duckdb_web_get_global_file_info",
|
|
12867
|
+
["number"],
|
|
12868
|
+
[BROWSER_RUNTIME._globalFileInfo?.cacheEpoch || 0]
|
|
12869
|
+
);
|
|
12782
12870
|
if (s !== 0 /* SUCCESS */) {
|
|
12783
12871
|
return null;
|
|
12784
12872
|
} else if (n === 0) {
|
|
@@ -12813,9 +12901,13 @@ return true;`);
|
|
|
12813
12901
|
case 3 /* HTTP */:
|
|
12814
12902
|
case 4 /* S3 */: {
|
|
12815
12903
|
if (flags & 1 /* FILE_FLAGS_READ */ && flags & 2 /* FILE_FLAGS_WRITE */) {
|
|
12816
|
-
throw new Error(
|
|
12904
|
+
throw new Error(
|
|
12905
|
+
`Opening file ${file.fileName} failed: cannot open file with both read and write flags set`
|
|
12906
|
+
);
|
|
12817
12907
|
} else if (flags & 32 /* FILE_FLAGS_APPEND */) {
|
|
12818
|
-
throw new Error(
|
|
12908
|
+
throw new Error(
|
|
12909
|
+
`Opening file ${file.fileName} failed: appending to HTTP/S3 files is not supported`
|
|
12910
|
+
);
|
|
12819
12911
|
} else if (flags & 2 /* FILE_FLAGS_WRITE */) {
|
|
12820
12912
|
const xhr = new XMLHttpRequest();
|
|
12821
12913
|
if (file.dataProtocol == 4 /* S3 */) {
|
|
@@ -12826,9 +12918,13 @@ return true;`);
|
|
|
12826
12918
|
}
|
|
12827
12919
|
xhr.send(null);
|
|
12828
12920
|
if (xhr.status != 200 && xhr.status != 404) {
|
|
12829
|
-
throw new Error(
|
|
12921
|
+
throw new Error(
|
|
12922
|
+
`Opening file ${file.fileName} failed: Unexpected return status from server (${xhr.status})`
|
|
12923
|
+
);
|
|
12830
12924
|
} else if (xhr.status == 404 && !(flags & 8 /* FILE_FLAGS_FILE_CREATE */ || flags & 16 /* FILE_FLAGS_FILE_CREATE_NEW */)) {
|
|
12831
|
-
throw new Error(
|
|
12925
|
+
throw new Error(
|
|
12926
|
+
`Opening file ${file.fileName} failed: Cannot write to non-existent file without FILE_FLAGS_FILE_CREATE or FILE_FLAGS_FILE_CREATE_NEW flag.`
|
|
12927
|
+
);
|
|
12832
12928
|
}
|
|
12833
12929
|
const data = mod._malloc(1);
|
|
12834
12930
|
const src = new Uint8Array();
|
|
@@ -13007,9 +13103,13 @@ return true;`);
|
|
|
13007
13103
|
mod.HEAPU8.set(src, buf);
|
|
13008
13104
|
return src.byteLength;
|
|
13009
13105
|
} else if (xhr.status == 200) {
|
|
13010
|
-
throw new Error(
|
|
13106
|
+
throw new Error(
|
|
13107
|
+
`Range request for ${file.dataUrl} did not return a partial response: ${xhr.status} "${xhr.statusText}"`
|
|
13108
|
+
);
|
|
13011
13109
|
} else {
|
|
13012
|
-
throw new Error(
|
|
13110
|
+
throw new Error(
|
|
13111
|
+
`Range request for ${file.dataUrl} did returned non-success status: ${xhr.status} "${xhr.statusText}"`
|
|
13112
|
+
);
|
|
13013
13113
|
}
|
|
13014
13114
|
} catch (e) {
|
|
13015
13115
|
throw new Error(`Range request for ${file.dataUrl} failed with error: ${e}"`);
|
|
@@ -13334,6 +13434,7 @@ return true;`);
|
|
|
13334
13434
|
}
|
|
13335
13435
|
var UTF8Decoder = typeof TextDecoder != "undefined" ? new TextDecoder("utf8") : void 0;
|
|
13336
13436
|
function UTF8ArrayToString(heapOrArray, idx, maxBytesToRead) {
|
|
13437
|
+
idx >>>= 0;
|
|
13337
13438
|
var endIdx = idx + maxBytesToRead;
|
|
13338
13439
|
var endPtr = idx;
|
|
13339
13440
|
while (heapOrArray[endPtr] && !(endPtr >= endIdx))
|
|
@@ -13370,9 +13471,11 @@ return true;`);
|
|
|
13370
13471
|
return str;
|
|
13371
13472
|
}
|
|
13372
13473
|
function UTF8ToString(ptr, maxBytesToRead) {
|
|
13474
|
+
ptr >>>= 0;
|
|
13373
13475
|
return ptr ? UTF8ArrayToString(HEAPU8, ptr, maxBytesToRead) : "";
|
|
13374
13476
|
}
|
|
13375
13477
|
function stringToUTF8Array(str, heap, outIdx, maxBytesToWrite) {
|
|
13478
|
+
outIdx >>>= 0;
|
|
13376
13479
|
if (!(maxBytesToWrite > 0))
|
|
13377
13480
|
return 0;
|
|
13378
13481
|
var startIdx = outIdx;
|
|
@@ -13386,28 +13489,28 @@ return true;`);
|
|
|
13386
13489
|
if (u <= 127) {
|
|
13387
13490
|
if (outIdx >= endIdx)
|
|
13388
13491
|
break;
|
|
13389
|
-
heap[outIdx++] = u;
|
|
13492
|
+
heap[outIdx++ >>> 0] = u;
|
|
13390
13493
|
} else if (u <= 2047) {
|
|
13391
13494
|
if (outIdx + 1 >= endIdx)
|
|
13392
13495
|
break;
|
|
13393
|
-
heap[outIdx++] = 192 | u >> 6;
|
|
13394
|
-
heap[outIdx++] = 128 | u & 63;
|
|
13496
|
+
heap[outIdx++ >>> 0] = 192 | u >> 6;
|
|
13497
|
+
heap[outIdx++ >>> 0] = 128 | u & 63;
|
|
13395
13498
|
} else if (u <= 65535) {
|
|
13396
13499
|
if (outIdx + 2 >= endIdx)
|
|
13397
13500
|
break;
|
|
13398
|
-
heap[outIdx++] = 224 | u >> 12;
|
|
13399
|
-
heap[outIdx++] = 128 | u >> 6 & 63;
|
|
13400
|
-
heap[outIdx++] = 128 | u & 63;
|
|
13501
|
+
heap[outIdx++ >>> 0] = 224 | u >> 12;
|
|
13502
|
+
heap[outIdx++ >>> 0] = 128 | u >> 6 & 63;
|
|
13503
|
+
heap[outIdx++ >>> 0] = 128 | u & 63;
|
|
13401
13504
|
} else {
|
|
13402
13505
|
if (outIdx + 3 >= endIdx)
|
|
13403
13506
|
break;
|
|
13404
|
-
heap[outIdx++] = 240 | u >> 18;
|
|
13405
|
-
heap[outIdx++] = 128 | u >> 12 & 63;
|
|
13406
|
-
heap[outIdx++] = 128 | u >> 6 & 63;
|
|
13407
|
-
heap[outIdx++] = 128 | u & 63;
|
|
13507
|
+
heap[outIdx++ >>> 0] = 240 | u >> 18;
|
|
13508
|
+
heap[outIdx++ >>> 0] = 128 | u >> 12 & 63;
|
|
13509
|
+
heap[outIdx++ >>> 0] = 128 | u >> 6 & 63;
|
|
13510
|
+
heap[outIdx++ >>> 0] = 128 | u & 63;
|
|
13408
13511
|
}
|
|
13409
13512
|
}
|
|
13410
|
-
heap[outIdx] = 0;
|
|
13513
|
+
heap[outIdx >>> 0] = 0;
|
|
13411
13514
|
return outIdx - startIdx;
|
|
13412
13515
|
}
|
|
13413
13516
|
function stringToUTF8(str, outPtr, maxBytesToWrite) {
|
|
@@ -13431,14 +13534,14 @@ return true;`);
|
|
|
13431
13534
|
return len;
|
|
13432
13535
|
}
|
|
13433
13536
|
function writeArrayToMemory(array, buffer2) {
|
|
13434
|
-
HEAP8.set(array, buffer2);
|
|
13537
|
+
HEAP8.set(array, buffer2 >>> 0);
|
|
13435
13538
|
}
|
|
13436
13539
|
function writeAsciiToMemory(str, buffer2, dontAddNull) {
|
|
13437
13540
|
for (var i = 0; i < str.length; ++i) {
|
|
13438
|
-
HEAP8[buffer2++
|
|
13541
|
+
HEAP8[buffer2++ >>> 0] = str.charCodeAt(i);
|
|
13439
13542
|
}
|
|
13440
13543
|
if (!dontAddNull)
|
|
13441
|
-
HEAP8[buffer2
|
|
13544
|
+
HEAP8[buffer2 >>> 0] = 0;
|
|
13442
13545
|
}
|
|
13443
13546
|
var buffer, HEAP8, HEAPU8, HEAP16, HEAPU16, HEAP32, HEAPU32, HEAPF32, HEAPF64;
|
|
13444
13547
|
function updateGlobalBufferAndViews(buf) {
|
|
@@ -13696,33 +13799,33 @@ return true;`);
|
|
|
13696
13799
|
this.excPtr = excPtr;
|
|
13697
13800
|
this.ptr = excPtr - 24;
|
|
13698
13801
|
this.set_type = function(type) {
|
|
13699
|
-
HEAP32[this.ptr + 4
|
|
13802
|
+
HEAP32[this.ptr + 4 >>> 2] = type;
|
|
13700
13803
|
};
|
|
13701
13804
|
this.get_type = function() {
|
|
13702
|
-
return HEAP32[this.ptr + 4
|
|
13805
|
+
return HEAP32[this.ptr + 4 >>> 2];
|
|
13703
13806
|
};
|
|
13704
13807
|
this.set_destructor = function(destructor) {
|
|
13705
|
-
HEAP32[this.ptr + 8
|
|
13808
|
+
HEAP32[this.ptr + 8 >>> 2] = destructor;
|
|
13706
13809
|
};
|
|
13707
13810
|
this.get_destructor = function() {
|
|
13708
|
-
return HEAP32[this.ptr + 8
|
|
13811
|
+
return HEAP32[this.ptr + 8 >>> 2];
|
|
13709
13812
|
};
|
|
13710
13813
|
this.set_refcount = function(refcount) {
|
|
13711
|
-
HEAP32[this.ptr
|
|
13814
|
+
HEAP32[this.ptr >>> 2] = refcount;
|
|
13712
13815
|
};
|
|
13713
13816
|
this.set_caught = function(caught) {
|
|
13714
13817
|
caught = caught ? 1 : 0;
|
|
13715
|
-
HEAP8[this.ptr + 12
|
|
13818
|
+
HEAP8[this.ptr + 12 >>> 0] = caught;
|
|
13716
13819
|
};
|
|
13717
13820
|
this.get_caught = function() {
|
|
13718
|
-
return HEAP8[this.ptr + 12
|
|
13821
|
+
return HEAP8[this.ptr + 12 >>> 0] != 0;
|
|
13719
13822
|
};
|
|
13720
13823
|
this.set_rethrown = function(rethrown) {
|
|
13721
13824
|
rethrown = rethrown ? 1 : 0;
|
|
13722
|
-
HEAP8[this.ptr + 13
|
|
13825
|
+
HEAP8[this.ptr + 13 >>> 0] = rethrown;
|
|
13723
13826
|
};
|
|
13724
13827
|
this.get_rethrown = function() {
|
|
13725
|
-
return HEAP8[this.ptr + 13
|
|
13828
|
+
return HEAP8[this.ptr + 13 >>> 0] != 0;
|
|
13726
13829
|
};
|
|
13727
13830
|
this.init = function(type, destructor) {
|
|
13728
13831
|
this.set_adjusted_ptr(0);
|
|
@@ -13733,24 +13836,24 @@ return true;`);
|
|
|
13733
13836
|
this.set_rethrown(false);
|
|
13734
13837
|
};
|
|
13735
13838
|
this.add_ref = function() {
|
|
13736
|
-
var value = HEAP32[this.ptr
|
|
13737
|
-
HEAP32[this.ptr
|
|
13839
|
+
var value = HEAP32[this.ptr >>> 2];
|
|
13840
|
+
HEAP32[this.ptr >>> 2] = value + 1;
|
|
13738
13841
|
};
|
|
13739
13842
|
this.release_ref = function() {
|
|
13740
|
-
var prev = HEAP32[this.ptr
|
|
13741
|
-
HEAP32[this.ptr
|
|
13843
|
+
var prev = HEAP32[this.ptr >>> 2];
|
|
13844
|
+
HEAP32[this.ptr >>> 2] = prev - 1;
|
|
13742
13845
|
return prev === 1;
|
|
13743
13846
|
};
|
|
13744
13847
|
this.set_adjusted_ptr = function(adjustedPtr) {
|
|
13745
|
-
HEAP32[this.ptr + 16
|
|
13848
|
+
HEAP32[this.ptr + 16 >>> 2] = adjustedPtr;
|
|
13746
13849
|
};
|
|
13747
13850
|
this.get_adjusted_ptr = function() {
|
|
13748
|
-
return HEAP32[this.ptr + 16
|
|
13851
|
+
return HEAP32[this.ptr + 16 >>> 2];
|
|
13749
13852
|
};
|
|
13750
13853
|
this.get_exception_ptr = function() {
|
|
13751
13854
|
var isPointer = ___cxa_is_pointer_type(this.get_type());
|
|
13752
13855
|
if (isPointer) {
|
|
13753
|
-
return HEAP32[this.excPtr
|
|
13856
|
+
return HEAP32[this.excPtr >>> 2];
|
|
13754
13857
|
}
|
|
13755
13858
|
var adjusted = this.get_adjusted_ptr();
|
|
13756
13859
|
if (adjusted !== 0)
|
|
@@ -13929,7 +14032,7 @@ return true;`);
|
|
|
13929
14032
|
}
|
|
13930
14033
|
}, varargs: void 0, get: function() {
|
|
13931
14034
|
SYSCALLS.varargs += 4;
|
|
13932
|
-
var ret = HEAP32[SYSCALLS.varargs - 4
|
|
14035
|
+
var ret = HEAP32[SYSCALLS.varargs - 4 >>> 2];
|
|
13933
14036
|
return ret;
|
|
13934
14037
|
}, getStr: function(ptr) {
|
|
13935
14038
|
var ret = UTF8ToString(ptr);
|
|
@@ -14018,22 +14121,22 @@ return true;`);
|
|
|
14018
14121
|
return str;
|
|
14019
14122
|
}
|
|
14020
14123
|
function readSockaddr(sa, salen) {
|
|
14021
|
-
var family = HEAP16[sa
|
|
14022
|
-
var port = _ntohs(HEAPU16[sa + 2
|
|
14124
|
+
var family = HEAP16[sa >>> 1];
|
|
14125
|
+
var port = _ntohs(HEAPU16[sa + 2 >>> 1]);
|
|
14023
14126
|
var addr;
|
|
14024
14127
|
switch (family) {
|
|
14025
14128
|
case 2:
|
|
14026
14129
|
if (salen !== 16) {
|
|
14027
14130
|
return { errno: 28 };
|
|
14028
14131
|
}
|
|
14029
|
-
addr = HEAP32[sa + 4
|
|
14132
|
+
addr = HEAP32[sa + 4 >>> 2];
|
|
14030
14133
|
addr = inetNtop4(addr);
|
|
14031
14134
|
break;
|
|
14032
14135
|
case 10:
|
|
14033
14136
|
if (salen !== 28) {
|
|
14034
14137
|
return { errno: 28 };
|
|
14035
14138
|
}
|
|
14036
|
-
addr = [HEAP32[sa + 8
|
|
14139
|
+
addr = [HEAP32[sa + 8 >>> 2], HEAP32[sa + 12 >>> 2], HEAP32[sa + 16 >>> 2], HEAP32[sa + 20 >>> 2]];
|
|
14037
14140
|
addr = inetNtop6(addr);
|
|
14038
14141
|
break;
|
|
14039
14142
|
default:
|
|
@@ -14168,24 +14271,24 @@ return true;`);
|
|
|
14168
14271
|
addr = inetPton4(addr);
|
|
14169
14272
|
zeroMemory(sa, 16);
|
|
14170
14273
|
if (addrlen) {
|
|
14171
|
-
HEAP32[addrlen
|
|
14274
|
+
HEAP32[addrlen >>> 2] = 16;
|
|
14172
14275
|
}
|
|
14173
|
-
HEAP16[sa
|
|
14174
|
-
HEAP32[sa + 4
|
|
14175
|
-
HEAP16[sa + 2
|
|
14276
|
+
HEAP16[sa >>> 1] = family;
|
|
14277
|
+
HEAP32[sa + 4 >>> 2] = addr;
|
|
14278
|
+
HEAP16[sa + 2 >>> 1] = _htons(port);
|
|
14176
14279
|
break;
|
|
14177
14280
|
case 10:
|
|
14178
14281
|
addr = inetPton6(addr);
|
|
14179
14282
|
zeroMemory(sa, 28);
|
|
14180
14283
|
if (addrlen) {
|
|
14181
|
-
HEAP32[addrlen
|
|
14284
|
+
HEAP32[addrlen >>> 2] = 28;
|
|
14182
14285
|
}
|
|
14183
|
-
HEAP32[sa
|
|
14184
|
-
HEAP32[sa + 8
|
|
14185
|
-
HEAP32[sa + 12
|
|
14186
|
-
HEAP32[sa + 16
|
|
14187
|
-
HEAP32[sa + 20
|
|
14188
|
-
HEAP16[sa + 2
|
|
14286
|
+
HEAP32[sa >>> 2] = family;
|
|
14287
|
+
HEAP32[sa + 8 >>> 2] = addr[0];
|
|
14288
|
+
HEAP32[sa + 12 >>> 2] = addr[1];
|
|
14289
|
+
HEAP32[sa + 16 >>> 2] = addr[2];
|
|
14290
|
+
HEAP32[sa + 20 >>> 2] = addr[3];
|
|
14291
|
+
HEAP16[sa + 2 >>> 1] = _htons(port);
|
|
14189
14292
|
break;
|
|
14190
14293
|
default:
|
|
14191
14294
|
return 5;
|
|
@@ -14204,8 +14307,8 @@ return true;`);
|
|
|
14204
14307
|
var sock = getSocketFromFD(fd);
|
|
14205
14308
|
if (level === 1) {
|
|
14206
14309
|
if (optname === 4) {
|
|
14207
|
-
HEAP32[optval
|
|
14208
|
-
HEAP32[optlen
|
|
14310
|
+
HEAP32[optval >>> 2] = sock.error;
|
|
14311
|
+
HEAP32[optlen >>> 2] = 4;
|
|
14209
14312
|
sock.error = null;
|
|
14210
14313
|
return 0;
|
|
14211
14314
|
}
|
|
@@ -14233,7 +14336,7 @@ return true;`);
|
|
|
14233
14336
|
if (addr) {
|
|
14234
14337
|
var errno = writeSockaddr(addr, sock.family, DNS.lookup_name(msg.addr), msg.port, addrlen);
|
|
14235
14338
|
}
|
|
14236
|
-
HEAPU8.set(msg.buffer, buf);
|
|
14339
|
+
HEAPU8.set(msg.buffer, buf >>> 0);
|
|
14237
14340
|
return msg.buffer.byteLength;
|
|
14238
14341
|
}
|
|
14239
14342
|
function ___syscall_renameat(olddirfd, oldpath, newdirfd, newpath) {
|
|
@@ -14313,7 +14416,7 @@ return true;`);
|
|
|
14313
14416
|
return globalThis.DUCKDB_RUNTIME.callScalarUDF(Module, funcId, descPtr, descSize, ptrsPtr, ptrsSize, response);
|
|
14314
14417
|
}
|
|
14315
14418
|
function _emscripten_get_heap_max() {
|
|
14316
|
-
return
|
|
14419
|
+
return 4294901760;
|
|
14317
14420
|
}
|
|
14318
14421
|
var _emscripten_get_now;
|
|
14319
14422
|
if (ENVIRONMENT_IS_NODE) {
|
|
@@ -14324,7 +14427,7 @@ return true;`);
|
|
|
14324
14427
|
} else
|
|
14325
14428
|
_emscripten_get_now = () => performance.now();
|
|
14326
14429
|
function _emscripten_memcpy_big(dest, src, num) {
|
|
14327
|
-
HEAPU8.copyWithin(dest, src, src + num);
|
|
14430
|
+
HEAPU8.copyWithin(dest >>> 0, src >>> 0, src + num >>> 0);
|
|
14328
14431
|
}
|
|
14329
14432
|
function emscripten_realloc_buffer(size) {
|
|
14330
14433
|
try {
|
|
@@ -14379,7 +14482,7 @@ return true;`);
|
|
|
14379
14482
|
var bufSize = 0;
|
|
14380
14483
|
getEnvStrings().forEach(function(string, i) {
|
|
14381
14484
|
var ptr = environ_buf + bufSize;
|
|
14382
|
-
HEAP32[__environ + i * 4
|
|
14485
|
+
HEAP32[__environ + i * 4 >>> 2] = ptr;
|
|
14383
14486
|
writeAsciiToMemory(string, ptr);
|
|
14384
14487
|
bufSize += string.length + 1;
|
|
14385
14488
|
});
|
|
@@ -14387,12 +14490,12 @@ return true;`);
|
|
|
14387
14490
|
}
|
|
14388
14491
|
function _environ_sizes_get(penviron_count, penviron_buf_size) {
|
|
14389
14492
|
var strings = getEnvStrings();
|
|
14390
|
-
HEAP32[penviron_count
|
|
14493
|
+
HEAP32[penviron_count >>> 2] = strings.length;
|
|
14391
14494
|
var bufSize = 0;
|
|
14392
14495
|
strings.forEach(function(string) {
|
|
14393
14496
|
bufSize += string.length + 1;
|
|
14394
14497
|
});
|
|
14395
|
-
HEAP32[penviron_buf_size
|
|
14498
|
+
HEAP32[penviron_buf_size >>> 2] = bufSize;
|
|
14396
14499
|
return 0;
|
|
14397
14500
|
}
|
|
14398
14501
|
function _fd_close(fd) {
|
|
@@ -14401,19 +14504,19 @@ return true;`);
|
|
|
14401
14504
|
function _fd_pread(fd, iov, iovcnt, offset_low, offset_high, pnum) {
|
|
14402
14505
|
var stream = SYSCALLS.getStreamFromFD(fd);
|
|
14403
14506
|
var num = SYSCALLS.doReadv(stream, iov, iovcnt, offset_low);
|
|
14404
|
-
HEAP32[pnum
|
|
14507
|
+
HEAP32[pnum >>> 2] = num;
|
|
14405
14508
|
return 0;
|
|
14406
14509
|
}
|
|
14407
14510
|
function _fd_pwrite(fd, iov, iovcnt, offset_low, offset_high, pnum) {
|
|
14408
14511
|
var stream = SYSCALLS.getStreamFromFD(fd);
|
|
14409
14512
|
var num = SYSCALLS.doWritev(stream, iov, iovcnt, offset_low);
|
|
14410
|
-
HEAP32[pnum
|
|
14513
|
+
HEAP32[pnum >>> 2] = num;
|
|
14411
14514
|
return 0;
|
|
14412
14515
|
}
|
|
14413
14516
|
function _fd_read(fd, iov, iovcnt, pnum) {
|
|
14414
14517
|
var stream = SYSCALLS.getStreamFromFD(fd);
|
|
14415
14518
|
var num = SYSCALLS.doReadv(stream, iov, iovcnt);
|
|
14416
|
-
HEAP32[pnum
|
|
14519
|
+
HEAP32[pnum >>> 2] = num;
|
|
14417
14520
|
return 0;
|
|
14418
14521
|
}
|
|
14419
14522
|
function _fd_seek(fd, offset_low, offset_high, whence, newOffset) {
|
|
@@ -14428,15 +14531,15 @@ return true;`);
|
|
|
14428
14531
|
function _fd_write(fd, iov, iovcnt, pnum) {
|
|
14429
14532
|
var num = 0;
|
|
14430
14533
|
for (var i = 0; i < iovcnt; i++) {
|
|
14431
|
-
var ptr = HEAP32[iov
|
|
14432
|
-
var len = HEAP32[iov + 4
|
|
14534
|
+
var ptr = HEAP32[iov >>> 2];
|
|
14535
|
+
var len = HEAP32[iov + 4 >>> 2];
|
|
14433
14536
|
iov += 8;
|
|
14434
14537
|
for (var j = 0; j < len; j++) {
|
|
14435
|
-
SYSCALLS.printChar(fd, HEAPU8[ptr + j]);
|
|
14538
|
+
SYSCALLS.printChar(fd, HEAPU8[ptr + j >>> 0]);
|
|
14436
14539
|
}
|
|
14437
14540
|
num += len;
|
|
14438
14541
|
}
|
|
14439
|
-
HEAP32[pnum
|
|
14542
|
+
HEAP32[pnum >>> 2] = num;
|
|
14440
14543
|
return 0;
|
|
14441
14544
|
}
|
|
14442
14545
|
function _getTempRet0() {
|
|
@@ -14459,24 +14562,24 @@ return true;`);
|
|
|
14459
14562
|
errno = writeSockaddr(sa, family2, addr2, port2);
|
|
14460
14563
|
assert(!errno);
|
|
14461
14564
|
ai2 = _malloc(32);
|
|
14462
|
-
HEAP32[ai2 + 4
|
|
14463
|
-
HEAP32[ai2 + 8
|
|
14464
|
-
HEAP32[ai2 + 12
|
|
14465
|
-
HEAP32[ai2 + 24
|
|
14466
|
-
HEAP32[ai2 + 20
|
|
14565
|
+
HEAP32[ai2 + 4 >>> 2] = family2;
|
|
14566
|
+
HEAP32[ai2 + 8 >>> 2] = type2;
|
|
14567
|
+
HEAP32[ai2 + 12 >>> 2] = proto2;
|
|
14568
|
+
HEAP32[ai2 + 24 >>> 2] = canon;
|
|
14569
|
+
HEAP32[ai2 + 20 >>> 2] = sa;
|
|
14467
14570
|
if (family2 === 10) {
|
|
14468
|
-
HEAP32[ai2 + 16
|
|
14571
|
+
HEAP32[ai2 + 16 >>> 2] = 28;
|
|
14469
14572
|
} else {
|
|
14470
|
-
HEAP32[ai2 + 16
|
|
14573
|
+
HEAP32[ai2 + 16 >>> 2] = 16;
|
|
14471
14574
|
}
|
|
14472
|
-
HEAP32[ai2 + 28
|
|
14575
|
+
HEAP32[ai2 + 28 >>> 2] = 0;
|
|
14473
14576
|
return ai2;
|
|
14474
14577
|
}
|
|
14475
14578
|
if (hint) {
|
|
14476
|
-
flags = HEAP32[hint
|
|
14477
|
-
family = HEAP32[hint + 4
|
|
14478
|
-
type = HEAP32[hint + 8
|
|
14479
|
-
proto = HEAP32[hint + 12
|
|
14579
|
+
flags = HEAP32[hint >>> 2];
|
|
14580
|
+
family = HEAP32[hint + 4 >>> 2];
|
|
14581
|
+
type = HEAP32[hint + 8 >>> 2];
|
|
14582
|
+
proto = HEAP32[hint + 12 >>> 2];
|
|
14480
14583
|
}
|
|
14481
14584
|
if (type && !proto) {
|
|
14482
14585
|
proto = type === 2 ? 17 : 6;
|
|
@@ -14496,7 +14599,7 @@ return true;`);
|
|
|
14496
14599
|
if (flags & ~(1 | 2 | 4 | 1024 | 8 | 16 | 32)) {
|
|
14497
14600
|
return -1;
|
|
14498
14601
|
}
|
|
14499
|
-
if (hint !== 0 && HEAP32[hint
|
|
14602
|
+
if (hint !== 0 && HEAP32[hint >>> 2] & 2 && !node) {
|
|
14500
14603
|
return -1;
|
|
14501
14604
|
}
|
|
14502
14605
|
if (flags & 32) {
|
|
@@ -14530,7 +14633,7 @@ return true;`);
|
|
|
14530
14633
|
}
|
|
14531
14634
|
}
|
|
14532
14635
|
ai = allocaddrinfo(family, type, proto, null, addr, port);
|
|
14533
|
-
HEAP32[out2
|
|
14636
|
+
HEAP32[out2 >>> 2] = ai;
|
|
14534
14637
|
return 0;
|
|
14535
14638
|
}
|
|
14536
14639
|
node = UTF8ToString(node);
|
|
@@ -14556,7 +14659,7 @@ return true;`);
|
|
|
14556
14659
|
}
|
|
14557
14660
|
if (addr != null) {
|
|
14558
14661
|
ai = allocaddrinfo(family, type, proto, node, addr, port);
|
|
14559
|
-
HEAP32[out2
|
|
14662
|
+
HEAP32[out2 >>> 2] = ai;
|
|
14560
14663
|
return 0;
|
|
14561
14664
|
}
|
|
14562
14665
|
if (flags & 4) {
|
|
@@ -14570,7 +14673,7 @@ return true;`);
|
|
|
14570
14673
|
addr = [0, 0, _htonl(65535), addr];
|
|
14571
14674
|
}
|
|
14572
14675
|
ai = allocaddrinfo(family, type, proto, null, addr, port);
|
|
14573
|
-
HEAP32[out2
|
|
14676
|
+
HEAP32[out2 >>> 2] = ai;
|
|
14574
14677
|
return 0;
|
|
14575
14678
|
}
|
|
14576
14679
|
function getRandomDevice() {
|
|
@@ -14598,7 +14701,7 @@ return true;`);
|
|
|
14598
14701
|
_getentropy.randomDevice = getRandomDevice();
|
|
14599
14702
|
}
|
|
14600
14703
|
for (var i = 0; i < size; i++) {
|
|
14601
|
-
HEAP8[buffer2 + i
|
|
14704
|
+
HEAP8[buffer2 + i >>> 0] = _getentropy.randomDevice();
|
|
14602
14705
|
}
|
|
14603
14706
|
return 0;
|
|
14604
14707
|
}
|
|
@@ -14676,8 +14779,8 @@ return true;`);
|
|
|
14676
14779
|
return newDate;
|
|
14677
14780
|
}
|
|
14678
14781
|
function _strftime(s, maxsize, format, tm) {
|
|
14679
|
-
var tm_zone = HEAP32[tm + 40
|
|
14680
|
-
var date = { tm_sec: HEAP32[tm
|
|
14782
|
+
var tm_zone = HEAP32[tm + 40 >>> 2];
|
|
14783
|
+
var date = { tm_sec: HEAP32[tm >>> 2], tm_min: HEAP32[tm + 4 >>> 2], tm_hour: HEAP32[tm + 8 >>> 2], tm_mday: HEAP32[tm + 12 >>> 2], tm_mon: HEAP32[tm + 16 >>> 2], tm_year: HEAP32[tm + 20 >>> 2], tm_wday: HEAP32[tm + 24 >>> 2], tm_yday: HEAP32[tm + 28 >>> 2], tm_isdst: HEAP32[tm + 32 >>> 2], tm_gmtoff: HEAP32[tm + 36 >>> 2], tm_zone: tm_zone ? UTF8ToString(tm_zone) : "" };
|
|
14681
14784
|
var pattern = UTF8ToString(format);
|
|
14682
14785
|
var EXPANSION_RULES_1 = { "%c": "%a %b %d %H:%M:%S %Y", "%D": "%m/%d/%y", "%F": "%Y-%m-%d", "%h": "%b", "%r": "%I:%M:%S %p", "%R": "%H:%M", "%T": "%H:%M:%S", "%x": "%m/%d/%y", "%X": "%H:%M:%S", "%Ec": "%c", "%EC": "%C", "%Ex": "%m/%d/%y", "%EX": "%H:%M:%S", "%Ey": "%y", "%EY": "%Y", "%Od": "%d", "%Oe": "%e", "%OH": "%H", "%OI": "%I", "%Om": "%m", "%OM": "%M", "%OS": "%S", "%Ou": "%u", "%OU": "%U", "%OV": "%V", "%Ow": "%w", "%OW": "%W", "%Oy": "%y" };
|
|
14683
14786
|
for (var rule in EXPANSION_RULES_1) {
|
|
@@ -18693,6 +18796,7 @@ return true;`);
|
|
|
18693
18796
|
}
|
|
18694
18797
|
var UTF8Decoder = typeof TextDecoder != "undefined" ? new TextDecoder("utf8") : void 0;
|
|
18695
18798
|
function UTF8ArrayToString(heapOrArray, idx, maxBytesToRead) {
|
|
18799
|
+
idx >>>= 0;
|
|
18696
18800
|
var endIdx = idx + maxBytesToRead;
|
|
18697
18801
|
var endPtr = idx;
|
|
18698
18802
|
while (heapOrArray[endPtr] && !(endPtr >= endIdx))
|
|
@@ -18729,9 +18833,11 @@ return true;`);
|
|
|
18729
18833
|
return str;
|
|
18730
18834
|
}
|
|
18731
18835
|
function UTF8ToString(ptr, maxBytesToRead) {
|
|
18836
|
+
ptr >>>= 0;
|
|
18732
18837
|
return ptr ? UTF8ArrayToString(HEAPU8, ptr, maxBytesToRead) : "";
|
|
18733
18838
|
}
|
|
18734
18839
|
function stringToUTF8Array(str, heap, outIdx, maxBytesToWrite) {
|
|
18840
|
+
outIdx >>>= 0;
|
|
18735
18841
|
if (!(maxBytesToWrite > 0))
|
|
18736
18842
|
return 0;
|
|
18737
18843
|
var startIdx = outIdx;
|
|
@@ -18745,28 +18851,28 @@ return true;`);
|
|
|
18745
18851
|
if (u <= 127) {
|
|
18746
18852
|
if (outIdx >= endIdx)
|
|
18747
18853
|
break;
|
|
18748
|
-
heap[outIdx++] = u;
|
|
18854
|
+
heap[outIdx++ >>> 0] = u;
|
|
18749
18855
|
} else if (u <= 2047) {
|
|
18750
18856
|
if (outIdx + 1 >= endIdx)
|
|
18751
18857
|
break;
|
|
18752
|
-
heap[outIdx++] = 192 | u >> 6;
|
|
18753
|
-
heap[outIdx++] = 128 | u & 63;
|
|
18858
|
+
heap[outIdx++ >>> 0] = 192 | u >> 6;
|
|
18859
|
+
heap[outIdx++ >>> 0] = 128 | u & 63;
|
|
18754
18860
|
} else if (u <= 65535) {
|
|
18755
18861
|
if (outIdx + 2 >= endIdx)
|
|
18756
18862
|
break;
|
|
18757
|
-
heap[outIdx++] = 224 | u >> 12;
|
|
18758
|
-
heap[outIdx++] = 128 | u >> 6 & 63;
|
|
18759
|
-
heap[outIdx++] = 128 | u & 63;
|
|
18863
|
+
heap[outIdx++ >>> 0] = 224 | u >> 12;
|
|
18864
|
+
heap[outIdx++ >>> 0] = 128 | u >> 6 & 63;
|
|
18865
|
+
heap[outIdx++ >>> 0] = 128 | u & 63;
|
|
18760
18866
|
} else {
|
|
18761
18867
|
if (outIdx + 3 >= endIdx)
|
|
18762
18868
|
break;
|
|
18763
|
-
heap[outIdx++] = 240 | u >> 18;
|
|
18764
|
-
heap[outIdx++] = 128 | u >> 12 & 63;
|
|
18765
|
-
heap[outIdx++] = 128 | u >> 6 & 63;
|
|
18766
|
-
heap[outIdx++] = 128 | u & 63;
|
|
18869
|
+
heap[outIdx++ >>> 0] = 240 | u >> 18;
|
|
18870
|
+
heap[outIdx++ >>> 0] = 128 | u >> 12 & 63;
|
|
18871
|
+
heap[outIdx++ >>> 0] = 128 | u >> 6 & 63;
|
|
18872
|
+
heap[outIdx++ >>> 0] = 128 | u & 63;
|
|
18767
18873
|
}
|
|
18768
18874
|
}
|
|
18769
|
-
heap[outIdx] = 0;
|
|
18875
|
+
heap[outIdx >>> 0] = 0;
|
|
18770
18876
|
return outIdx - startIdx;
|
|
18771
18877
|
}
|
|
18772
18878
|
function stringToUTF8(str, outPtr, maxBytesToWrite) {
|
|
@@ -18790,14 +18896,14 @@ return true;`);
|
|
|
18790
18896
|
return len;
|
|
18791
18897
|
}
|
|
18792
18898
|
function writeArrayToMemory(array, buffer2) {
|
|
18793
|
-
HEAP8.set(array, buffer2);
|
|
18899
|
+
HEAP8.set(array, buffer2 >>> 0);
|
|
18794
18900
|
}
|
|
18795
18901
|
function writeAsciiToMemory(str, buffer2, dontAddNull) {
|
|
18796
18902
|
for (var i = 0; i < str.length; ++i) {
|
|
18797
|
-
HEAP8[buffer2++
|
|
18903
|
+
HEAP8[buffer2++ >>> 0] = str.charCodeAt(i);
|
|
18798
18904
|
}
|
|
18799
18905
|
if (!dontAddNull)
|
|
18800
|
-
HEAP8[buffer2
|
|
18906
|
+
HEAP8[buffer2 >>> 0] = 0;
|
|
18801
18907
|
}
|
|
18802
18908
|
var buffer, HEAP8, HEAPU8, HEAP16, HEAPU16, HEAP32, HEAPU32, HEAPF32, HEAPF64;
|
|
18803
18909
|
function updateGlobalBufferAndViews(buf) {
|
|
@@ -19041,7 +19147,7 @@ return true;`);
|
|
|
19041
19147
|
}
|
|
19042
19148
|
}, varargs: void 0, get: function() {
|
|
19043
19149
|
SYSCALLS.varargs += 4;
|
|
19044
|
-
var ret = HEAP32[SYSCALLS.varargs - 4
|
|
19150
|
+
var ret = HEAP32[SYSCALLS.varargs - 4 >>> 2];
|
|
19045
19151
|
return ret;
|
|
19046
19152
|
}, getStr: function(ptr) {
|
|
19047
19153
|
var ret = UTF8ToString(ptr);
|
|
@@ -19130,22 +19236,22 @@ return true;`);
|
|
|
19130
19236
|
return str;
|
|
19131
19237
|
}
|
|
19132
19238
|
function readSockaddr(sa, salen) {
|
|
19133
|
-
var family = HEAP16[sa
|
|
19134
|
-
var port = _ntohs(HEAPU16[sa + 2
|
|
19239
|
+
var family = HEAP16[sa >>> 1];
|
|
19240
|
+
var port = _ntohs(HEAPU16[sa + 2 >>> 1]);
|
|
19135
19241
|
var addr;
|
|
19136
19242
|
switch (family) {
|
|
19137
19243
|
case 2:
|
|
19138
19244
|
if (salen !== 16) {
|
|
19139
19245
|
return { errno: 28 };
|
|
19140
19246
|
}
|
|
19141
|
-
addr = HEAP32[sa + 4
|
|
19247
|
+
addr = HEAP32[sa + 4 >>> 2];
|
|
19142
19248
|
addr = inetNtop4(addr);
|
|
19143
19249
|
break;
|
|
19144
19250
|
case 10:
|
|
19145
19251
|
if (salen !== 28) {
|
|
19146
19252
|
return { errno: 28 };
|
|
19147
19253
|
}
|
|
19148
|
-
addr = [HEAP32[sa + 8
|
|
19254
|
+
addr = [HEAP32[sa + 8 >>> 2], HEAP32[sa + 12 >>> 2], HEAP32[sa + 16 >>> 2], HEAP32[sa + 20 >>> 2]];
|
|
19149
19255
|
addr = inetNtop6(addr);
|
|
19150
19256
|
break;
|
|
19151
19257
|
default:
|
|
@@ -19280,24 +19386,24 @@ return true;`);
|
|
|
19280
19386
|
addr = inetPton4(addr);
|
|
19281
19387
|
zeroMemory(sa, 16);
|
|
19282
19388
|
if (addrlen) {
|
|
19283
|
-
HEAP32[addrlen
|
|
19389
|
+
HEAP32[addrlen >>> 2] = 16;
|
|
19284
19390
|
}
|
|
19285
|
-
HEAP16[sa
|
|
19286
|
-
HEAP32[sa + 4
|
|
19287
|
-
HEAP16[sa + 2
|
|
19391
|
+
HEAP16[sa >>> 1] = family;
|
|
19392
|
+
HEAP32[sa + 4 >>> 2] = addr;
|
|
19393
|
+
HEAP16[sa + 2 >>> 1] = _htons(port);
|
|
19288
19394
|
break;
|
|
19289
19395
|
case 10:
|
|
19290
19396
|
addr = inetPton6(addr);
|
|
19291
19397
|
zeroMemory(sa, 28);
|
|
19292
19398
|
if (addrlen) {
|
|
19293
|
-
HEAP32[addrlen
|
|
19399
|
+
HEAP32[addrlen >>> 2] = 28;
|
|
19294
19400
|
}
|
|
19295
|
-
HEAP32[sa
|
|
19296
|
-
HEAP32[sa + 8
|
|
19297
|
-
HEAP32[sa + 12
|
|
19298
|
-
HEAP32[sa + 16
|
|
19299
|
-
HEAP32[sa + 20
|
|
19300
|
-
HEAP16[sa + 2
|
|
19401
|
+
HEAP32[sa >>> 2] = family;
|
|
19402
|
+
HEAP32[sa + 8 >>> 2] = addr[0];
|
|
19403
|
+
HEAP32[sa + 12 >>> 2] = addr[1];
|
|
19404
|
+
HEAP32[sa + 16 >>> 2] = addr[2];
|
|
19405
|
+
HEAP32[sa + 20 >>> 2] = addr[3];
|
|
19406
|
+
HEAP16[sa + 2 >>> 1] = _htons(port);
|
|
19301
19407
|
break;
|
|
19302
19408
|
default:
|
|
19303
19409
|
return 5;
|
|
@@ -19316,8 +19422,8 @@ return true;`);
|
|
|
19316
19422
|
var sock = getSocketFromFD(fd);
|
|
19317
19423
|
if (level === 1) {
|
|
19318
19424
|
if (optname === 4) {
|
|
19319
|
-
HEAP32[optval
|
|
19320
|
-
HEAP32[optlen
|
|
19425
|
+
HEAP32[optval >>> 2] = sock.error;
|
|
19426
|
+
HEAP32[optlen >>> 2] = 4;
|
|
19321
19427
|
sock.error = null;
|
|
19322
19428
|
return 0;
|
|
19323
19429
|
}
|
|
@@ -19345,7 +19451,7 @@ return true;`);
|
|
|
19345
19451
|
if (addr) {
|
|
19346
19452
|
var errno = writeSockaddr(addr, sock.family, DNS.lookup_name(msg.addr), msg.port, addrlen);
|
|
19347
19453
|
}
|
|
19348
|
-
HEAPU8.set(msg.buffer, buf);
|
|
19454
|
+
HEAPU8.set(msg.buffer, buf >>> 0);
|
|
19349
19455
|
return msg.buffer.byteLength;
|
|
19350
19456
|
}
|
|
19351
19457
|
function ___syscall_renameat(olddirfd, oldpath, newdirfd, newpath) {
|
|
@@ -19425,7 +19531,7 @@ return true;`);
|
|
|
19425
19531
|
return globalThis.DUCKDB_RUNTIME.callScalarUDF(Module, funcId, descPtr, descSize, ptrsPtr, ptrsSize, response);
|
|
19426
19532
|
}
|
|
19427
19533
|
function _emscripten_get_heap_max() {
|
|
19428
|
-
return
|
|
19534
|
+
return 4294901760;
|
|
19429
19535
|
}
|
|
19430
19536
|
var _emscripten_get_now;
|
|
19431
19537
|
if (ENVIRONMENT_IS_NODE) {
|
|
@@ -19436,7 +19542,7 @@ return true;`);
|
|
|
19436
19542
|
} else
|
|
19437
19543
|
_emscripten_get_now = () => performance.now();
|
|
19438
19544
|
function _emscripten_memcpy_big(dest, src, num) {
|
|
19439
|
-
HEAPU8.copyWithin(dest, src, src + num);
|
|
19545
|
+
HEAPU8.copyWithin(dest >>> 0, src >>> 0, src + num >>> 0);
|
|
19440
19546
|
}
|
|
19441
19547
|
function emscripten_realloc_buffer(size) {
|
|
19442
19548
|
try {
|
|
@@ -19491,7 +19597,7 @@ return true;`);
|
|
|
19491
19597
|
var bufSize = 0;
|
|
19492
19598
|
getEnvStrings().forEach(function(string, i) {
|
|
19493
19599
|
var ptr = environ_buf + bufSize;
|
|
19494
|
-
HEAP32[__environ + i * 4
|
|
19600
|
+
HEAP32[__environ + i * 4 >>> 2] = ptr;
|
|
19495
19601
|
writeAsciiToMemory(string, ptr);
|
|
19496
19602
|
bufSize += string.length + 1;
|
|
19497
19603
|
});
|
|
@@ -19499,12 +19605,12 @@ return true;`);
|
|
|
19499
19605
|
}
|
|
19500
19606
|
function _environ_sizes_get(penviron_count, penviron_buf_size) {
|
|
19501
19607
|
var strings = getEnvStrings();
|
|
19502
|
-
HEAP32[penviron_count
|
|
19608
|
+
HEAP32[penviron_count >>> 2] = strings.length;
|
|
19503
19609
|
var bufSize = 0;
|
|
19504
19610
|
strings.forEach(function(string) {
|
|
19505
19611
|
bufSize += string.length + 1;
|
|
19506
19612
|
});
|
|
19507
|
-
HEAP32[penviron_buf_size
|
|
19613
|
+
HEAP32[penviron_buf_size >>> 2] = bufSize;
|
|
19508
19614
|
return 0;
|
|
19509
19615
|
}
|
|
19510
19616
|
function _fd_close(fd) {
|
|
@@ -19513,19 +19619,19 @@ return true;`);
|
|
|
19513
19619
|
function _fd_pread(fd, iov, iovcnt, offset_low, offset_high, pnum) {
|
|
19514
19620
|
var stream = SYSCALLS.getStreamFromFD(fd);
|
|
19515
19621
|
var num = SYSCALLS.doReadv(stream, iov, iovcnt, offset_low);
|
|
19516
|
-
HEAP32[pnum
|
|
19622
|
+
HEAP32[pnum >>> 2] = num;
|
|
19517
19623
|
return 0;
|
|
19518
19624
|
}
|
|
19519
19625
|
function _fd_pwrite(fd, iov, iovcnt, offset_low, offset_high, pnum) {
|
|
19520
19626
|
var stream = SYSCALLS.getStreamFromFD(fd);
|
|
19521
19627
|
var num = SYSCALLS.doWritev(stream, iov, iovcnt, offset_low);
|
|
19522
|
-
HEAP32[pnum
|
|
19628
|
+
HEAP32[pnum >>> 2] = num;
|
|
19523
19629
|
return 0;
|
|
19524
19630
|
}
|
|
19525
19631
|
function _fd_read(fd, iov, iovcnt, pnum) {
|
|
19526
19632
|
var stream = SYSCALLS.getStreamFromFD(fd);
|
|
19527
19633
|
var num = SYSCALLS.doReadv(stream, iov, iovcnt);
|
|
19528
|
-
HEAP32[pnum
|
|
19634
|
+
HEAP32[pnum >>> 2] = num;
|
|
19529
19635
|
return 0;
|
|
19530
19636
|
}
|
|
19531
19637
|
function _fd_seek(fd, offset_low, offset_high, whence, newOffset) {
|
|
@@ -19540,15 +19646,15 @@ return true;`);
|
|
|
19540
19646
|
function _fd_write(fd, iov, iovcnt, pnum) {
|
|
19541
19647
|
var num = 0;
|
|
19542
19648
|
for (var i = 0; i < iovcnt; i++) {
|
|
19543
|
-
var ptr = HEAP32[iov
|
|
19544
|
-
var len = HEAP32[iov + 4
|
|
19649
|
+
var ptr = HEAP32[iov >>> 2];
|
|
19650
|
+
var len = HEAP32[iov + 4 >>> 2];
|
|
19545
19651
|
iov += 8;
|
|
19546
19652
|
for (var j = 0; j < len; j++) {
|
|
19547
|
-
SYSCALLS.printChar(fd, HEAPU8[ptr + j]);
|
|
19653
|
+
SYSCALLS.printChar(fd, HEAPU8[ptr + j >>> 0]);
|
|
19548
19654
|
}
|
|
19549
19655
|
num += len;
|
|
19550
19656
|
}
|
|
19551
|
-
HEAP32[pnum
|
|
19657
|
+
HEAP32[pnum >>> 2] = num;
|
|
19552
19658
|
return 0;
|
|
19553
19659
|
}
|
|
19554
19660
|
function _getaddrinfo(node, service, hint, out2) {
|
|
@@ -19568,24 +19674,24 @@ return true;`);
|
|
|
19568
19674
|
errno = writeSockaddr(sa, family2, addr2, port2);
|
|
19569
19675
|
assert(!errno);
|
|
19570
19676
|
ai2 = _malloc(32);
|
|
19571
|
-
HEAP32[ai2 + 4
|
|
19572
|
-
HEAP32[ai2 + 8
|
|
19573
|
-
HEAP32[ai2 + 12
|
|
19574
|
-
HEAP32[ai2 + 24
|
|
19575
|
-
HEAP32[ai2 + 20
|
|
19677
|
+
HEAP32[ai2 + 4 >>> 2] = family2;
|
|
19678
|
+
HEAP32[ai2 + 8 >>> 2] = type2;
|
|
19679
|
+
HEAP32[ai2 + 12 >>> 2] = proto2;
|
|
19680
|
+
HEAP32[ai2 + 24 >>> 2] = canon;
|
|
19681
|
+
HEAP32[ai2 + 20 >>> 2] = sa;
|
|
19576
19682
|
if (family2 === 10) {
|
|
19577
|
-
HEAP32[ai2 + 16
|
|
19683
|
+
HEAP32[ai2 + 16 >>> 2] = 28;
|
|
19578
19684
|
} else {
|
|
19579
|
-
HEAP32[ai2 + 16
|
|
19685
|
+
HEAP32[ai2 + 16 >>> 2] = 16;
|
|
19580
19686
|
}
|
|
19581
|
-
HEAP32[ai2 + 28
|
|
19687
|
+
HEAP32[ai2 + 28 >>> 2] = 0;
|
|
19582
19688
|
return ai2;
|
|
19583
19689
|
}
|
|
19584
19690
|
if (hint) {
|
|
19585
|
-
flags = HEAP32[hint
|
|
19586
|
-
family = HEAP32[hint + 4
|
|
19587
|
-
type = HEAP32[hint + 8
|
|
19588
|
-
proto = HEAP32[hint + 12
|
|
19691
|
+
flags = HEAP32[hint >>> 2];
|
|
19692
|
+
family = HEAP32[hint + 4 >>> 2];
|
|
19693
|
+
type = HEAP32[hint + 8 >>> 2];
|
|
19694
|
+
proto = HEAP32[hint + 12 >>> 2];
|
|
19589
19695
|
}
|
|
19590
19696
|
if (type && !proto) {
|
|
19591
19697
|
proto = type === 2 ? 17 : 6;
|
|
@@ -19605,7 +19711,7 @@ return true;`);
|
|
|
19605
19711
|
if (flags & ~(1 | 2 | 4 | 1024 | 8 | 16 | 32)) {
|
|
19606
19712
|
return -1;
|
|
19607
19713
|
}
|
|
19608
|
-
if (hint !== 0 && HEAP32[hint
|
|
19714
|
+
if (hint !== 0 && HEAP32[hint >>> 2] & 2 && !node) {
|
|
19609
19715
|
return -1;
|
|
19610
19716
|
}
|
|
19611
19717
|
if (flags & 32) {
|
|
@@ -19639,7 +19745,7 @@ return true;`);
|
|
|
19639
19745
|
}
|
|
19640
19746
|
}
|
|
19641
19747
|
ai = allocaddrinfo(family, type, proto, null, addr, port);
|
|
19642
|
-
HEAP32[out2
|
|
19748
|
+
HEAP32[out2 >>> 2] = ai;
|
|
19643
19749
|
return 0;
|
|
19644
19750
|
}
|
|
19645
19751
|
node = UTF8ToString(node);
|
|
@@ -19665,7 +19771,7 @@ return true;`);
|
|
|
19665
19771
|
}
|
|
19666
19772
|
if (addr != null) {
|
|
19667
19773
|
ai = allocaddrinfo(family, type, proto, node, addr, port);
|
|
19668
|
-
HEAP32[out2
|
|
19774
|
+
HEAP32[out2 >>> 2] = ai;
|
|
19669
19775
|
return 0;
|
|
19670
19776
|
}
|
|
19671
19777
|
if (flags & 4) {
|
|
@@ -19679,7 +19785,7 @@ return true;`);
|
|
|
19679
19785
|
addr = [0, 0, _htonl(65535), addr];
|
|
19680
19786
|
}
|
|
19681
19787
|
ai = allocaddrinfo(family, type, proto, null, addr, port);
|
|
19682
|
-
HEAP32[out2
|
|
19788
|
+
HEAP32[out2 >>> 2] = ai;
|
|
19683
19789
|
return 0;
|
|
19684
19790
|
}
|
|
19685
19791
|
function getRandomDevice() {
|
|
@@ -19707,7 +19813,7 @@ return true;`);
|
|
|
19707
19813
|
_getentropy.randomDevice = getRandomDevice();
|
|
19708
19814
|
}
|
|
19709
19815
|
for (var i = 0; i < size; i++) {
|
|
19710
|
-
HEAP8[buffer2 + i
|
|
19816
|
+
HEAP8[buffer2 + i >>> 0] = _getentropy.randomDevice();
|
|
19711
19817
|
}
|
|
19712
19818
|
return 0;
|
|
19713
19819
|
}
|
|
@@ -19779,8 +19885,8 @@ return true;`);
|
|
|
19779
19885
|
return newDate;
|
|
19780
19886
|
}
|
|
19781
19887
|
function _strftime(s, maxsize, format, tm) {
|
|
19782
|
-
var tm_zone = HEAP32[tm + 40
|
|
19783
|
-
var date = { tm_sec: HEAP32[tm
|
|
19888
|
+
var tm_zone = HEAP32[tm + 40 >>> 2];
|
|
19889
|
+
var date = { tm_sec: HEAP32[tm >>> 2], tm_min: HEAP32[tm + 4 >>> 2], tm_hour: HEAP32[tm + 8 >>> 2], tm_mday: HEAP32[tm + 12 >>> 2], tm_mon: HEAP32[tm + 16 >>> 2], tm_year: HEAP32[tm + 20 >>> 2], tm_wday: HEAP32[tm + 24 >>> 2], tm_yday: HEAP32[tm + 28 >>> 2], tm_isdst: HEAP32[tm + 32 >>> 2], tm_gmtoff: HEAP32[tm + 36 >>> 2], tm_zone: tm_zone ? UTF8ToString(tm_zone) : "" };
|
|
19784
19890
|
var pattern = UTF8ToString(format);
|
|
19785
19891
|
var EXPANSION_RULES_1 = { "%c": "%a %b %d %H:%M:%S %Y", "%D": "%m/%d/%y", "%F": "%Y-%m-%d", "%h": "%b", "%r": "%I:%M:%S %p", "%R": "%H:%M", "%T": "%H:%M:%S", "%x": "%m/%d/%y", "%X": "%H:%M:%S", "%Ec": "%c", "%EC": "%C", "%Ex": "%m/%d/%y", "%EX": "%H:%M:%S", "%Ey": "%y", "%EY": "%Y", "%Od": "%d", "%Oe": "%e", "%OH": "%H", "%OI": "%I", "%Om": "%m", "%OM": "%M", "%OS": "%S", "%Ou": "%u", "%OU": "%U", "%OV": "%V", "%Ow": "%w", "%OW": "%W", "%Oy": "%y" };
|
|
19786
19892
|
for (var rule in EXPANSION_RULES_1) {
|
|
@@ -20371,10 +20477,12 @@ return true;`);
|
|
|
20371
20477
|
};
|
|
20372
20478
|
this.type = type;
|
|
20373
20479
|
this.data = data;
|
|
20374
|
-
this.promise = new Promise(
|
|
20375
|
-
|
|
20376
|
-
|
|
20377
|
-
|
|
20480
|
+
this.promise = new Promise(
|
|
20481
|
+
(resolve, reject) => {
|
|
20482
|
+
this.promiseResolver = resolve;
|
|
20483
|
+
this.promiseRejecter = reject;
|
|
20484
|
+
}
|
|
20485
|
+
);
|
|
20378
20486
|
}
|
|
20379
20487
|
};
|
|
20380
20488
|
|
|
@@ -20404,9 +20512,11 @@ return true;`);
|
|
|
20404
20512
|
this._worker.addEventListener("message", this._onMessageHandler);
|
|
20405
20513
|
this._worker.addEventListener("error", this._onErrorHandler);
|
|
20406
20514
|
this._worker.addEventListener("close", this._onCloseHandler);
|
|
20407
|
-
this._workerShutdownPromise = new Promise(
|
|
20408
|
-
|
|
20409
|
-
|
|
20515
|
+
this._workerShutdownPromise = new Promise(
|
|
20516
|
+
(resolve, _reject) => {
|
|
20517
|
+
this._workerShutdownResolver = resolve;
|
|
20518
|
+
}
|
|
20519
|
+
);
|
|
20410
20520
|
}
|
|
20411
20521
|
detach() {
|
|
20412
20522
|
if (!this._worker)
|
|
@@ -20436,11 +20546,14 @@ return true;`);
|
|
|
20436
20546
|
}
|
|
20437
20547
|
const mid = this._nextMessageId++;
|
|
20438
20548
|
this._pendingRequests.set(mid, task);
|
|
20439
|
-
this._worker.postMessage(
|
|
20440
|
-
|
|
20441
|
-
|
|
20442
|
-
|
|
20443
|
-
|
|
20549
|
+
this._worker.postMessage(
|
|
20550
|
+
{
|
|
20551
|
+
messageId: mid,
|
|
20552
|
+
type: task.type,
|
|
20553
|
+
data: task.data
|
|
20554
|
+
},
|
|
20555
|
+
transfer
|
|
20556
|
+
);
|
|
20444
20557
|
return await task.promise;
|
|
20445
20558
|
}
|
|
20446
20559
|
onMessage(event) {
|
|
@@ -20630,7 +20743,10 @@ return true;`);
|
|
|
20630
20743
|
async instantiate(mainModuleURL, pthreadWorkerURL = null, progress = (_p2) => {
|
|
20631
20744
|
}) {
|
|
20632
20745
|
this._onInstantiationProgress.push(progress);
|
|
20633
|
-
const task = new WorkerTask(
|
|
20746
|
+
const task = new WorkerTask(
|
|
20747
|
+
"INSTANTIATE" /* INSTANTIATE */,
|
|
20748
|
+
[mainModuleURL, pthreadWorkerURL]
|
|
20749
|
+
);
|
|
20634
20750
|
return await this.postTask(task);
|
|
20635
20751
|
}
|
|
20636
20752
|
async getVersion() {
|
|
@@ -20639,7 +20755,10 @@ return true;`);
|
|
|
20639
20755
|
return version;
|
|
20640
20756
|
}
|
|
20641
20757
|
async getFeatureFlags() {
|
|
20642
|
-
const task = new WorkerTask(
|
|
20758
|
+
const task = new WorkerTask(
|
|
20759
|
+
"GET_FEATURE_FLAGS" /* GET_FEATURE_FLAGS */,
|
|
20760
|
+
null
|
|
20761
|
+
);
|
|
20643
20762
|
const feature = await this.postTask(task);
|
|
20644
20763
|
return feature;
|
|
20645
20764
|
}
|
|
@@ -20661,51 +20780,87 @@ return true;`);
|
|
|
20661
20780
|
return new AsyncDuckDBConnection(this, cid);
|
|
20662
20781
|
}
|
|
20663
20782
|
async disconnect(conn) {
|
|
20664
|
-
const task = new WorkerTask(
|
|
20783
|
+
const task = new WorkerTask(
|
|
20784
|
+
"DISCONNECT" /* DISCONNECT */,
|
|
20785
|
+
conn
|
|
20786
|
+
);
|
|
20665
20787
|
await this.postTask(task);
|
|
20666
20788
|
}
|
|
20667
20789
|
async runQuery(conn, text) {
|
|
20668
|
-
const task = new WorkerTask(
|
|
20790
|
+
const task = new WorkerTask(
|
|
20791
|
+
"RUN_QUERY" /* RUN_QUERY */,
|
|
20792
|
+
[conn, text]
|
|
20793
|
+
);
|
|
20669
20794
|
return await this.postTask(task);
|
|
20670
20795
|
}
|
|
20671
20796
|
async startPendingQuery(conn, text) {
|
|
20672
|
-
const task = new WorkerTask(
|
|
20797
|
+
const task = new WorkerTask(
|
|
20798
|
+
"START_PENDING_QUERY" /* START_PENDING_QUERY */,
|
|
20799
|
+
[conn, text]
|
|
20800
|
+
);
|
|
20673
20801
|
return await this.postTask(task);
|
|
20674
20802
|
}
|
|
20675
20803
|
async pollPendingQuery(conn) {
|
|
20676
|
-
const task = new WorkerTask(
|
|
20804
|
+
const task = new WorkerTask(
|
|
20805
|
+
"POLL_PENDING_QUERY" /* POLL_PENDING_QUERY */,
|
|
20806
|
+
conn
|
|
20807
|
+
);
|
|
20677
20808
|
return await this.postTask(task);
|
|
20678
20809
|
}
|
|
20679
20810
|
async cancelPendingQuery(conn) {
|
|
20680
|
-
const task = new WorkerTask(
|
|
20811
|
+
const task = new WorkerTask(
|
|
20812
|
+
"CANCEL_PENDING_QUERY" /* CANCEL_PENDING_QUERY */,
|
|
20813
|
+
conn
|
|
20814
|
+
);
|
|
20681
20815
|
return await this.postTask(task);
|
|
20682
20816
|
}
|
|
20683
20817
|
async fetchQueryResults(conn) {
|
|
20684
|
-
const task = new WorkerTask(
|
|
20818
|
+
const task = new WorkerTask(
|
|
20819
|
+
"FETCH_QUERY_RESULTS" /* FETCH_QUERY_RESULTS */,
|
|
20820
|
+
conn
|
|
20821
|
+
);
|
|
20685
20822
|
return await this.postTask(task);
|
|
20686
20823
|
}
|
|
20687
20824
|
async getTableNames(conn, text) {
|
|
20688
|
-
const task = new WorkerTask(
|
|
20825
|
+
const task = new WorkerTask(
|
|
20826
|
+
"GET_TABLE_NAMES" /* GET_TABLE_NAMES */,
|
|
20827
|
+
[conn, text]
|
|
20828
|
+
);
|
|
20689
20829
|
return await this.postTask(task);
|
|
20690
20830
|
}
|
|
20691
20831
|
async createPrepared(conn, text) {
|
|
20692
|
-
const task = new WorkerTask(
|
|
20832
|
+
const task = new WorkerTask(
|
|
20833
|
+
"CREATE_PREPARED" /* CREATE_PREPARED */,
|
|
20834
|
+
[conn, text]
|
|
20835
|
+
);
|
|
20693
20836
|
return await this.postTask(task);
|
|
20694
20837
|
}
|
|
20695
20838
|
async closePrepared(conn, statement) {
|
|
20696
|
-
const task = new WorkerTask(
|
|
20839
|
+
const task = new WorkerTask(
|
|
20840
|
+
"CLOSE_PREPARED" /* CLOSE_PREPARED */,
|
|
20841
|
+
[conn, statement]
|
|
20842
|
+
);
|
|
20697
20843
|
await this.postTask(task);
|
|
20698
20844
|
}
|
|
20699
20845
|
async runPrepared(conn, statement, params) {
|
|
20700
|
-
const task = new WorkerTask(
|
|
20846
|
+
const task = new WorkerTask(
|
|
20847
|
+
"RUN_PREPARED" /* RUN_PREPARED */,
|
|
20848
|
+
[conn, statement, params]
|
|
20849
|
+
);
|
|
20701
20850
|
return await this.postTask(task);
|
|
20702
20851
|
}
|
|
20703
20852
|
async sendPrepared(conn, statement, params) {
|
|
20704
|
-
const task = new WorkerTask(
|
|
20853
|
+
const task = new WorkerTask(
|
|
20854
|
+
"SEND_PREPARED" /* SEND_PREPARED */,
|
|
20855
|
+
[conn, statement, params]
|
|
20856
|
+
);
|
|
20705
20857
|
return await this.postTask(task);
|
|
20706
20858
|
}
|
|
20707
20859
|
async globFiles(path) {
|
|
20708
|
-
const task = new WorkerTask(
|
|
20860
|
+
const task = new WorkerTask(
|
|
20861
|
+
"GLOB_FILE_INFOS" /* GLOB_FILE_INFOS */,
|
|
20862
|
+
path
|
|
20863
|
+
);
|
|
20709
20864
|
return await this.postTask(task);
|
|
20710
20865
|
}
|
|
20711
20866
|
async registerFileText(name, text) {
|
|
@@ -20716,35 +20871,59 @@ return true;`);
|
|
|
20716
20871
|
if (url === void 0) {
|
|
20717
20872
|
url = name;
|
|
20718
20873
|
}
|
|
20719
|
-
const task = new WorkerTask(
|
|
20874
|
+
const task = new WorkerTask(
|
|
20875
|
+
"REGISTER_FILE_URL" /* REGISTER_FILE_URL */,
|
|
20876
|
+
[name, url]
|
|
20877
|
+
);
|
|
20720
20878
|
await this.postTask(task);
|
|
20721
20879
|
}
|
|
20722
20880
|
async registerEmptyFileBuffer(name) {
|
|
20723
|
-
const task = new WorkerTask(
|
|
20881
|
+
const task = new WorkerTask(
|
|
20882
|
+
"REGISTER_FILE_BUFFER" /* REGISTER_FILE_BUFFER */,
|
|
20883
|
+
[name, new Uint8Array()]
|
|
20884
|
+
);
|
|
20724
20885
|
await this.postTask(task);
|
|
20725
20886
|
}
|
|
20726
20887
|
async registerFileBuffer(name, buffer) {
|
|
20727
|
-
const task = new WorkerTask(
|
|
20888
|
+
const task = new WorkerTask(
|
|
20889
|
+
"REGISTER_FILE_BUFFER" /* REGISTER_FILE_BUFFER */,
|
|
20890
|
+
[name, buffer]
|
|
20891
|
+
);
|
|
20728
20892
|
await this.postTask(task, [buffer.buffer]);
|
|
20729
20893
|
}
|
|
20730
20894
|
async registerFileHandle(name, handle) {
|
|
20731
|
-
const task = new WorkerTask(
|
|
20895
|
+
const task = new WorkerTask(
|
|
20896
|
+
"REGISTER_FILE_HANDLE" /* REGISTER_FILE_HANDLE */,
|
|
20897
|
+
[name, handle]
|
|
20898
|
+
);
|
|
20732
20899
|
await this.postTask(task, []);
|
|
20733
20900
|
}
|
|
20734
20901
|
async collectFileStatistics(name, enable) {
|
|
20735
|
-
const task = new WorkerTask(
|
|
20902
|
+
const task = new WorkerTask(
|
|
20903
|
+
"COLLECT_FILE_STATISTICS" /* COLLECT_FILE_STATISTICS */,
|
|
20904
|
+
[name, enable]
|
|
20905
|
+
);
|
|
20736
20906
|
await this.postTask(task, []);
|
|
20737
20907
|
}
|
|
20738
20908
|
async exportFileStatistics(name) {
|
|
20739
|
-
const task = new WorkerTask(
|
|
20909
|
+
const task = new WorkerTask(
|
|
20910
|
+
"EXPORT_FILE_STATISTICS" /* EXPORT_FILE_STATISTICS */,
|
|
20911
|
+
name
|
|
20912
|
+
);
|
|
20740
20913
|
return await this.postTask(task, []);
|
|
20741
20914
|
}
|
|
20742
20915
|
async copyFileToBuffer(name) {
|
|
20743
|
-
const task = new WorkerTask(
|
|
20916
|
+
const task = new WorkerTask(
|
|
20917
|
+
"COPY_FILE_TO_BUFFER" /* COPY_FILE_TO_BUFFER */,
|
|
20918
|
+
name
|
|
20919
|
+
);
|
|
20744
20920
|
return await this.postTask(task);
|
|
20745
20921
|
}
|
|
20746
20922
|
async copyFileToPath(name, path) {
|
|
20747
|
-
const task = new WorkerTask(
|
|
20923
|
+
const task = new WorkerTask(
|
|
20924
|
+
"COPY_FILE_TO_PATH" /* COPY_FILE_TO_PATH */,
|
|
20925
|
+
[name, path]
|
|
20926
|
+
);
|
|
20748
20927
|
await this.postTask(task);
|
|
20749
20928
|
}
|
|
20750
20929
|
async insertArrowFromIPCStream(conn, buffer, options) {
|
|
@@ -20763,7 +20942,10 @@ return true;`);
|
|
|
20763
20942
|
options.columnsFlat = out;
|
|
20764
20943
|
delete options.columns;
|
|
20765
20944
|
}
|
|
20766
|
-
const task = new WorkerTask(
|
|
20945
|
+
const task = new WorkerTask(
|
|
20946
|
+
"IMPORT_CSV_FROM_PATH" /* INSERT_CSV_FROM_PATH */,
|
|
20947
|
+
[conn, path, options]
|
|
20948
|
+
);
|
|
20767
20949
|
await this.postTask(task);
|
|
20768
20950
|
}
|
|
20769
20951
|
async insertJSONFromPath(conn, path, options) {
|
|
@@ -20776,7 +20958,10 @@ return true;`);
|
|
|
20776
20958
|
options.columnsFlat = out;
|
|
20777
20959
|
delete options.columns;
|
|
20778
20960
|
}
|
|
20779
|
-
const task = new WorkerTask(
|
|
20961
|
+
const task = new WorkerTask(
|
|
20962
|
+
"IMPORT_JSON_FROM_PATH" /* INSERT_JSON_FROM_PATH */,
|
|
20963
|
+
[conn, path, options]
|
|
20964
|
+
);
|
|
20780
20965
|
await this.postTask(task);
|
|
20781
20966
|
}
|
|
20782
20967
|
};
|
|
@@ -21115,7 +21300,11 @@ return true;`);
|
|
|
21115
21300
|
expect(params.sessionToken).toEqual("ANICESESSIONTOKEN");
|
|
21116
21301
|
conn.query("SET s3_endpoint='http://localhost:1337';");
|
|
21117
21302
|
const globalFileInfoFullHttpEndpoint = runtime_browser_default.getGlobalFileInfo(module2);
|
|
21118
|
-
const paramsFullHttpEndpoint = getS3Params(
|
|
21303
|
+
const paramsFullHttpEndpoint = getS3Params(
|
|
21304
|
+
globalFileInfoFullHttpEndpoint?.s3Config,
|
|
21305
|
+
"s3://test-bucket/testfile.txt",
|
|
21306
|
+
"GET"
|
|
21307
|
+
);
|
|
21119
21308
|
expect(paramsFullHttpEndpoint.host).toEqual("localhost:1337");
|
|
21120
21309
|
await reset();
|
|
21121
21310
|
const globalFileInfoCleared = runtime_browser_default.getGlobalFileInfo(module2);
|
|
@@ -21163,7 +21352,9 @@ return true;`);
|
|
|
21163
21352
|
datetimeNow: "20150915T124500Z"
|
|
21164
21353
|
};
|
|
21165
21354
|
const result = createS3Headers(testParams1).get("Authorization");
|
|
21166
|
-
expect(result).toEqual(
|
|
21355
|
+
expect(result).toEqual(
|
|
21356
|
+
"AWS4-HMAC-SHA256 Credential=AKIAIOSFODNN7EXAMPLE/20150915/us-east-1/s3/aws4_request, SignedHeaders=host;x-amz-content-sha256;x-amz-date, Signature=182072eb53d85c36b2d791a1fa46a12d23454ec1e921b02075c23aee40166d5a"
|
|
21357
|
+
);
|
|
21167
21358
|
const canonical_query_string = "delimiter=%2F&encoding-type=url&list-type=2&prefix=";
|
|
21168
21359
|
const testParams2 = {
|
|
21169
21360
|
url: "/",
|
|
@@ -21179,7 +21370,9 @@ return true;`);
|
|
|
21179
21370
|
datetimeNow: "20210904T121746Z"
|
|
21180
21371
|
};
|
|
21181
21372
|
const result2 = createS3Headers(testParams2).get("Authorization");
|
|
21182
|
-
expect(result2).toEqual(
|
|
21373
|
+
expect(result2).toEqual(
|
|
21374
|
+
"AWS4-HMAC-SHA256 Credential=ASIAYSPIOYDTHTBIITVC/20210904/eu-west-1/s3/aws4_request, SignedHeaders=host;x-amz-content-sha256;x-amz-date;x-amz-security-token, Signature=4d9d6b59d7836b6485f6ad822de97be40287da30347d83042ea7fbed530dc4c0"
|
|
21375
|
+
);
|
|
21183
21376
|
const testParams3 = {
|
|
21184
21377
|
url: "/correct_auth_test.csv",
|
|
21185
21378
|
query: "",
|
|
@@ -21198,10 +21391,16 @@ return true;`);
|
|
|
21198
21391
|
contentType: "text/data;charset=utf-8"
|
|
21199
21392
|
};
|
|
21200
21393
|
const result3 = createS3Headers(testParams3, test3PayloadParams).get("Authorization");
|
|
21201
|
-
expect(result3).toEqual(
|
|
21394
|
+
expect(result3).toEqual(
|
|
21395
|
+
"AWS4-HMAC-SHA256 Credential=S3RVER/20220121/eu-west-1/s3/aws4_request, SignedHeaders=content-type;host;x-amz-content-sha256;x-amz-date, Signature=5d9a6cbfaa78a6d0f2ab7df0445e2f1cc9c80cd3655ac7de9e7219c036f23f02"
|
|
21396
|
+
);
|
|
21202
21397
|
expect(uriEncode("/category=Books/")).toEqual("/category%3DBooks/");
|
|
21203
|
-
expect(uriEncode("/?category=Books&title=Ducks Retreat/")).toEqual(
|
|
21204
|
-
|
|
21398
|
+
expect(uriEncode("/?category=Books&title=Ducks Retreat/")).toEqual(
|
|
21399
|
+
"/%3Fcategory%3DBooks%26title%3DDucks%20Retreat/"
|
|
21400
|
+
);
|
|
21401
|
+
expect(uriEncode("/?category=Books&title=Ducks Retreat/", true)).toEqual(
|
|
21402
|
+
"%2F%3Fcategory%3DBooks%26title%3DDucks%20Retreat%2F"
|
|
21403
|
+
);
|
|
21205
21404
|
});
|
|
21206
21405
|
});
|
|
21207
21406
|
}
|
|
@@ -21231,7 +21430,9 @@ return true;`);
|
|
|
21231
21430
|
afterEach(async () => await reset());
|
|
21232
21431
|
describe("HTTPFS Async", () => {
|
|
21233
21432
|
it("can fetch https file", async () => {
|
|
21234
|
-
const results = await conn.query(
|
|
21433
|
+
const results = await conn.query(
|
|
21434
|
+
`select * from "https://raw.githubusercontent.com/duckdb/duckdb-wasm/master/data/test.csv";`
|
|
21435
|
+
);
|
|
21235
21436
|
expect(results.getChildAt(2)?.get(2)).toEqual(9);
|
|
21236
21437
|
});
|
|
21237
21438
|
it("can read and write csv file from S3 with correct auth credentials", async () => {
|
|
@@ -21246,7 +21447,9 @@ return true;`);
|
|
|
21246
21447
|
let data = await resolveData2("/uni/studenten.parquet");
|
|
21247
21448
|
await putTestFileToS3("correct_auth_test", "parquet", data);
|
|
21248
21449
|
await setAwsConfig(conn);
|
|
21249
|
-
const results_with_auth = await conn.query(
|
|
21450
|
+
const results_with_auth = await conn.query(
|
|
21451
|
+
`select * from "s3://${BUCKET_NAME}/correct_auth_test.parquet";`
|
|
21452
|
+
);
|
|
21250
21453
|
data = await resolveData2("/uni/studenten.parquet");
|
|
21251
21454
|
assertTestFileResultCorrect(results_with_auth, data);
|
|
21252
21455
|
});
|
|
@@ -21254,23 +21457,35 @@ return true;`);
|
|
|
21254
21457
|
const data = await resolveData2("/uni/studenten.parquet");
|
|
21255
21458
|
await putTestFileToS3("incorrect_auth_test", "parquet", data);
|
|
21256
21459
|
await setAwsConfig(conn, 2 /* INVALID */);
|
|
21257
|
-
await expectAsync(
|
|
21460
|
+
await expectAsync(
|
|
21461
|
+
conn.query(`select * from "s3://${BUCKET_NAME}/incorrect_auth_test.csv";`)
|
|
21462
|
+
).toBeRejected();
|
|
21258
21463
|
});
|
|
21259
21464
|
it("properly invalidates file caches on settings update.", async () => {
|
|
21260
21465
|
const data = await resolveData2("/tpch/0_01/parquet/lineitem.parquet");
|
|
21261
21466
|
await putTestFileToS3("file_cache_invalidation_test", "parquet", data);
|
|
21262
21467
|
await setAwsConfig(conn);
|
|
21263
|
-
const results_correct = await conn.query(
|
|
21468
|
+
const results_correct = await conn.query(
|
|
21469
|
+
`select l_partkey from "s3://${BUCKET_NAME}/file_cache_invalidation_test.parquet" limit 1;`
|
|
21470
|
+
);
|
|
21264
21471
|
expect(results_correct.getChildAt(0)?.get(0)).toEqual(1552);
|
|
21265
21472
|
await setAwsConfig(conn, 2 /* INVALID */);
|
|
21266
|
-
await expectAsync(
|
|
21473
|
+
await expectAsync(
|
|
21474
|
+
conn.query(`select avg(l_partkey) from "s3://${BUCKET_NAME}/lineitem.parquet";`)
|
|
21475
|
+
).toBeRejected();
|
|
21267
21476
|
});
|
|
21268
21477
|
it("write after read throws incorrect flag error without dropping files", async () => {
|
|
21269
21478
|
await setAwsConfig(conn);
|
|
21270
|
-
await conn.query(
|
|
21479
|
+
await conn.query(
|
|
21480
|
+
`COPY (SELECT * FROM range(1000,1010) tbl(i)) TO 's3://${BUCKET_NAME}/test_written.csv' (FORMAT 'csv');`
|
|
21481
|
+
);
|
|
21271
21482
|
const result = await conn.query(`SELECT * FROM "s3://${BUCKET_NAME}/test_written.csv";`);
|
|
21272
21483
|
expect(result.getChildAt(0)?.get(6)).toEqual(1006);
|
|
21273
|
-
await expectAsync(
|
|
21484
|
+
await expectAsync(
|
|
21485
|
+
conn.query(
|
|
21486
|
+
`COPY (SELECT * FROM range(2000,2010) tbl(i)) TO 's3://${BUCKET_NAME}/test_written.csv' (FORMAT 'csv');`
|
|
21487
|
+
)
|
|
21488
|
+
).toBeRejectedWithError("File is not opened in write mode");
|
|
21274
21489
|
});
|
|
21275
21490
|
});
|
|
21276
21491
|
}
|
|
@@ -21344,11 +21559,61 @@ return true;`);
|
|
|
21344
21559
|
i VARCHAR(11) DEFAULT NULL
|
|
21345
21560
|
)`);
|
|
21346
21561
|
const stmt = conn.prepare("INSERT INTO typecheck VALUES(?,?,?,?,?,?,?,?,?)");
|
|
21347
|
-
expect(
|
|
21348
|
-
|
|
21349
|
-
|
|
21350
|
-
expect(
|
|
21351
|
-
|
|
21562
|
+
expect(
|
|
21563
|
+
() => stmt.query(true, 100, 1e4, 1e6, 5e9, 0.5, Math.PI, "hello world", "hi")
|
|
21564
|
+
).not.toThrow();
|
|
21565
|
+
expect(
|
|
21566
|
+
() => stmt.query(
|
|
21567
|
+
"test",
|
|
21568
|
+
100,
|
|
21569
|
+
1e4,
|
|
21570
|
+
1e6,
|
|
21571
|
+
5e9,
|
|
21572
|
+
0.5,
|
|
21573
|
+
Math.PI,
|
|
21574
|
+
"hello world",
|
|
21575
|
+
"hi"
|
|
21576
|
+
)
|
|
21577
|
+
).toThrow();
|
|
21578
|
+
expect(
|
|
21579
|
+
() => stmt.query(
|
|
21580
|
+
true,
|
|
21581
|
+
1e4,
|
|
21582
|
+
1e4,
|
|
21583
|
+
1e6,
|
|
21584
|
+
5e9,
|
|
21585
|
+
0.5,
|
|
21586
|
+
Math.PI,
|
|
21587
|
+
"hello world",
|
|
21588
|
+
"hi"
|
|
21589
|
+
)
|
|
21590
|
+
).toThrow();
|
|
21591
|
+
expect(
|
|
21592
|
+
() => stmt.query(
|
|
21593
|
+
true,
|
|
21594
|
+
100,
|
|
21595
|
+
1e6,
|
|
21596
|
+
1e6,
|
|
21597
|
+
5e9,
|
|
21598
|
+
0.5,
|
|
21599
|
+
Math.PI,
|
|
21600
|
+
"hello world",
|
|
21601
|
+
"hi"
|
|
21602
|
+
)
|
|
21603
|
+
).toThrow();
|
|
21604
|
+
expect(
|
|
21605
|
+
() => stmt.query(
|
|
21606
|
+
true,
|
|
21607
|
+
100,
|
|
21608
|
+
1e4,
|
|
21609
|
+
5e9,
|
|
21610
|
+
5e9,
|
|
21611
|
+
0.5,
|
|
21612
|
+
Math.PI,
|
|
21613
|
+
"hello world",
|
|
21614
|
+
"hi"
|
|
21615
|
+
)
|
|
21616
|
+
).toThrow();
|
|
21352
21617
|
conn.close();
|
|
21353
21618
|
});
|
|
21354
21619
|
});
|
|
@@ -21447,16 +21712,56 @@ return true;`);
|
|
|
21447
21712
|
expect(throwed).toBe(true);
|
|
21448
21713
|
};
|
|
21449
21714
|
expectToThrow(async () => {
|
|
21450
|
-
await stmt.query(
|
|
21715
|
+
await stmt.query(
|
|
21716
|
+
"test",
|
|
21717
|
+
100,
|
|
21718
|
+
1e4,
|
|
21719
|
+
1e6,
|
|
21720
|
+
5e9,
|
|
21721
|
+
0.5,
|
|
21722
|
+
Math.PI,
|
|
21723
|
+
"hello world",
|
|
21724
|
+
"hi"
|
|
21725
|
+
);
|
|
21451
21726
|
});
|
|
21452
21727
|
expectToThrow(async () => {
|
|
21453
|
-
await stmt.query(
|
|
21728
|
+
await stmt.query(
|
|
21729
|
+
true,
|
|
21730
|
+
1e4,
|
|
21731
|
+
1e4,
|
|
21732
|
+
1e6,
|
|
21733
|
+
5e9,
|
|
21734
|
+
0.5,
|
|
21735
|
+
Math.PI,
|
|
21736
|
+
"hello world",
|
|
21737
|
+
"hi"
|
|
21738
|
+
);
|
|
21454
21739
|
});
|
|
21455
21740
|
expectToThrow(async () => {
|
|
21456
|
-
await stmt.query(
|
|
21741
|
+
await stmt.query(
|
|
21742
|
+
true,
|
|
21743
|
+
100,
|
|
21744
|
+
1e6,
|
|
21745
|
+
1e6,
|
|
21746
|
+
5e9,
|
|
21747
|
+
0.5,
|
|
21748
|
+
Math.PI,
|
|
21749
|
+
"hello world",
|
|
21750
|
+
"hi"
|
|
21751
|
+
);
|
|
21457
21752
|
});
|
|
21458
21753
|
expectToThrow(async () => {
|
|
21459
|
-
await stmt.query(
|
|
21754
|
+
await stmt.query(
|
|
21755
|
+
true,
|
|
21756
|
+
100,
|
|
21757
|
+
1e4,
|
|
21758
|
+
5e9,
|
|
21759
|
+
5e9,
|
|
21760
|
+
0.5,
|
|
21761
|
+
Math.PI,
|
|
21762
|
+
"hello world",
|
|
21763
|
+
"hi"
|
|
21764
|
+
);
|
|
21460
21765
|
});
|
|
21461
21766
|
await conn.close();
|
|
21462
21767
|
});
|
|
@@ -21470,7 +21775,7 @@ return true;`);
|
|
|
21470
21775
|
}
|
|
21471
21776
|
});
|
|
21472
21777
|
const conn = await adb2().connect();
|
|
21473
|
-
const result = await conn.useUnsafe((db2, id) => db2.startPendingQuery(id, "
|
|
21778
|
+
const result = await conn.useUnsafe((db2, id) => db2.startPendingQuery(id, "SELECT SUM(i) FROM range(1000000) tbl(i);"));
|
|
21474
21779
|
expect(result).toBeNull();
|
|
21475
21780
|
const cancelOK = await conn.useUnsafe((db2, id) => db2.cancelPendingQuery(id));
|
|
21476
21781
|
expect(cancelOK).toBeTrue();
|
|
@@ -21486,6 +21791,8 @@ return true;`);
|
|
|
21486
21791
|
expect(polledError.toString()).toEqual("Error: query was canceled");
|
|
21487
21792
|
const canceledAgain = await conn.useUnsafe((db2, id) => db2.cancelPendingQuery(id));
|
|
21488
21793
|
expect(canceledAgain).toBeFalse();
|
|
21794
|
+
const table = await conn.query("select 42::integer;");
|
|
21795
|
+
expect(table.schema.fields.length).toEqual(1);
|
|
21489
21796
|
});
|
|
21490
21797
|
it("noop cancel", async () => {
|
|
21491
21798
|
await adb2().open({
|
|
@@ -21495,7 +21802,7 @@ return true;`);
|
|
|
21495
21802
|
}
|
|
21496
21803
|
});
|
|
21497
21804
|
const conn = await adb2().connect();
|
|
21498
|
-
const result = await conn.useUnsafe((db2, id) => db2.startPendingQuery(id, "
|
|
21805
|
+
const result = await conn.useUnsafe((db2, id) => db2.startPendingQuery(id, "SELECT SUM(i) FROM range(1000000) tbl(i);"));
|
|
21499
21806
|
expect(result).toBeNull();
|
|
21500
21807
|
let polledHeader = null;
|
|
21501
21808
|
let polledError = null;
|
|
@@ -22077,7 +22384,9 @@ return true;`);
|
|
|
22077
22384
|
batches.push(batch);
|
|
22078
22385
|
}
|
|
22079
22386
|
const table = await new Table(batches);
|
|
22080
|
-
expect(table.getChildAt(0)?.toArray()).toEqual(
|
|
22387
|
+
expect(table.getChildAt(0)?.toArray()).toEqual(
|
|
22388
|
+
new Int32Array([24002, 25403, 26120, 26830, 27550, 28106, 29120, 29555])
|
|
22389
|
+
);
|
|
22081
22390
|
};
|
|
22082
22391
|
it("File buffer used once", async () => {
|
|
22083
22392
|
const students = await resolveData2("/uni/studenten.parquet");
|
|
@@ -22114,7 +22423,9 @@ return true;`);
|
|
|
22114
22423
|
batches.push(batch);
|
|
22115
22424
|
}
|
|
22116
22425
|
const table = await new Table(batches);
|
|
22117
|
-
expect(table.getChildAt(0)?.toArray()).toEqual(
|
|
22426
|
+
expect(table.getChildAt(0)?.toArray()).toEqual(
|
|
22427
|
+
new Int32Array([24002, 25403, 26120, 26830, 27550, 28106, 29120, 29555])
|
|
22428
|
+
);
|
|
22118
22429
|
});
|
|
22119
22430
|
it("simple join", async () => {
|
|
22120
22431
|
const students = await resolveData2("/uni/studenten.parquet");
|
|
@@ -22210,7 +22521,9 @@ return true;`);
|
|
|
22210
22521
|
batches.push(batch);
|
|
22211
22522
|
}
|
|
22212
22523
|
const table = await new Table(batches);
|
|
22213
|
-
expect(table.getChildAt(0)?.toArray()).toEqual(
|
|
22524
|
+
expect(table.getChildAt(0)?.toArray()).toEqual(
|
|
22525
|
+
new Int32Array([24002, 25403, 26120, 26830, 27550, 28106, 29120, 29555])
|
|
22526
|
+
);
|
|
22214
22527
|
});
|
|
22215
22528
|
});
|
|
22216
22529
|
describe("File access", () => {
|
|
@@ -22222,7 +22535,9 @@ return true;`);
|
|
|
22222
22535
|
batches.push(batch);
|
|
22223
22536
|
}
|
|
22224
22537
|
const table = await new Table(batches);
|
|
22225
|
-
expect(table.getChildAt(0)?.toArray()).toEqual(
|
|
22538
|
+
expect(table.getChildAt(0)?.toArray()).toEqual(
|
|
22539
|
+
new Int32Array([24002, 25403, 26120, 26830, 27550, 28106, 29120, 29555])
|
|
22540
|
+
);
|
|
22226
22541
|
});
|
|
22227
22542
|
it("Large Parquet file", async () => {
|
|
22228
22543
|
await db2().registerFileURL("lineitem.parquet", `${baseDir}/tpch/0_01/parquet/lineitem.parquet`);
|
|
@@ -22257,7 +22572,9 @@ return true;`);
|
|
|
22257
22572
|
const load_script = decoder2.decode(load_script_utf8);
|
|
22258
22573
|
const schema_script = decoder2.decode(schema_script_utf8);
|
|
22259
22574
|
const csv_buffer = decoder2.decode(csv_buffer_utf8);
|
|
22260
|
-
expect(load_script.trim()).toEqual(
|
|
22575
|
+
expect(load_script.trim()).toEqual(
|
|
22576
|
+
`COPY foo FROM '/tmp/duckdbexportcsv/foo.csv' (FORMAT 'csv', quote '"', delimiter ',', header 0);`
|
|
22577
|
+
);
|
|
22261
22578
|
expect(schema_script.trim()).toEqual(`CREATE TABLE foo(v BIGINT);`);
|
|
22262
22579
|
expect(csv_buffer.trim()).toEqual(`1
|
|
22263
22580
|
2
|
|
@@ -22283,7 +22600,9 @@ return true;`);
|
|
|
22283
22600
|
expect(load_script_utf8.length).not.toEqual(0);
|
|
22284
22601
|
expect(schema_script_utf8.length).not.toEqual(0);
|
|
22285
22602
|
expect(parquet_buffer.length).not.toEqual(0);
|
|
22286
|
-
const content = await conn.query(
|
|
22603
|
+
const content = await conn.query(
|
|
22604
|
+
`SELECT v::integer FROM parquet_scan('/tmp/duckdbexportparquet/foo.parquet')`
|
|
22605
|
+
);
|
|
22287
22606
|
expect(content.nullCount).toEqual(0);
|
|
22288
22607
|
expect(content.numRows).toEqual(5);
|
|
22289
22608
|
expect(content.getChildAt(0)?.toArray()).toEqual(new Int32Array([1, 2, 3, 4, 5]));
|
|
@@ -22291,7 +22610,9 @@ return true;`);
|
|
|
22291
22610
|
});
|
|
22292
22611
|
describe("Copy", () => {
|
|
22293
22612
|
it("Generate Series as Parquet", async () => {
|
|
22294
|
-
await conn.query(
|
|
22613
|
+
await conn.query(
|
|
22614
|
+
`COPY (SELECT * FROM generate_series(1, 5) t(v)) TO '/tmp/duckdbcopytest.parquet' (FORMAT 'parquet')`
|
|
22615
|
+
);
|
|
22295
22616
|
const results = await db2().globFiles("/tmp/duckdbcopytest*");
|
|
22296
22617
|
expect(results).not.toEqual([]);
|
|
22297
22618
|
expect(results.length).toEqual(1);
|
|
@@ -23003,7 +23324,9 @@ return true;`);
|
|
|
23003
23324
|
});
|
|
23004
23325
|
describe("GitHub issues", () => {
|
|
23005
23326
|
it("332", async () => {
|
|
23006
|
-
await db2().registerFileText(
|
|
23327
|
+
await db2().registerFileText(
|
|
23328
|
+
"Products.csv",
|
|
23329
|
+
`ProductGroup,Product,Year,Quarter,Revenue,Units,Count,Product Key,Reseller,Product Info,QuarterAsNumber
|
|
23007
23330
|
Electronics,Phone,2018,Q1,103,7,1,2018-Q1,Sony,Format=XML; <Properties>\u2026,1
|
|
23008
23331
|
Electronics,Phone,2018,Q1,102,4,1,2018-Q1,Sony,Format=XML; <Properties>\u2026,1
|
|
23009
23332
|
Electronics,Phone,2019,Q1,98,12,1,2019-Q1,Sony,Format=XML; <Properties>\u2026,1
|
|
@@ -23049,7 +23372,8 @@ Electronics,Computer,2020,Q4,104,3,1,2020-Q4,LG,Format=XML; <Properties>\u2026,4
|
|
|
23049
23372
|
Electronics,Computer,2020,Q1,83,7,1,2020-Q1,Sony,Format=XML; <Properties>\u2026,1
|
|
23050
23373
|
Media,Theater,2020,Q1,17,4,1,2020-Q1,Microsoft,Format=XML; <Properties>\u2026,1
|
|
23051
23374
|
Media,Theater,2020,Q1,20,7,1,2020-Q1,Sony,Format=XML; <Properties>\u2026,1
|
|
23052
|
-
`
|
|
23375
|
+
`
|
|
23376
|
+
);
|
|
23053
23377
|
await conn.query("CREATE TABLE products AS SELECT * FROM 'Products.csv'");
|
|
23054
23378
|
const all = await conn.query("SELECT * FROM products");
|
|
23055
23379
|
expect(all.schema.fields.length).toBe(11);
|
|
@@ -23086,10 +23410,13 @@ Media,Theater,2020,Q1,20,7,1,2020-Q1,Sony,Format=XML; <Properties>\u2026,1
|
|
|
23086
23410
|
await adb2().dropFile("data.csv");
|
|
23087
23411
|
});
|
|
23088
23412
|
it("JSON row insert", async () => {
|
|
23089
|
-
await adb2().registerFileText(
|
|
23413
|
+
await adb2().registerFileText(
|
|
23414
|
+
"rows.json",
|
|
23415
|
+
`[
|
|
23090
23416
|
{ "col1": 1, "col2": "foo" },
|
|
23091
23417
|
{ "col1": 2, "col2": "bar" },
|
|
23092
|
-
]`
|
|
23418
|
+
]`
|
|
23419
|
+
);
|
|
23093
23420
|
const conn = await adb2().connect();
|
|
23094
23421
|
await conn.insertJSONFromPath("rows.json", { name: "rows" });
|
|
23095
23422
|
await conn.query("DROP TABLE IF EXISTS rows");
|
|
@@ -23097,10 +23424,13 @@ Media,Theater,2020,Q1,20,7,1,2020-Q1,Sony,Format=XML; <Properties>\u2026,1
|
|
|
23097
23424
|
await adb2().dropFile("rows.json");
|
|
23098
23425
|
});
|
|
23099
23426
|
it("JSON column insert", async () => {
|
|
23100
|
-
await adb2().registerFileText(
|
|
23427
|
+
await adb2().registerFileText(
|
|
23428
|
+
"columns.json",
|
|
23429
|
+
`{
|
|
23101
23430
|
"col1": [1, 2],
|
|
23102
23431
|
"col2": ["foo", "bar"]
|
|
23103
|
-
}`
|
|
23432
|
+
}`
|
|
23433
|
+
);
|
|
23104
23434
|
const conn = await adb2().connect();
|
|
23105
23435
|
await conn.insertJSONFromPath("columns.json", { name: "columns" });
|
|
23106
23436
|
await conn.query("DROP TABLE IF EXISTS columns");
|
|
@@ -23322,7 +23652,9 @@ Media,Theater,2020,Q1,20,7,1,2020-Q1,Sony,Format=XML; <Properties>\u2026,1
|
|
|
23322
23652
|
describe("UDF", () => {
|
|
23323
23653
|
it("simple", async () => {
|
|
23324
23654
|
conn.createScalarFunction("jsudf", new Int32(), (a) => a);
|
|
23325
|
-
const result = conn.query(
|
|
23655
|
+
const result = conn.query(
|
|
23656
|
+
"SELECT max(jsudf(v::INTEGER))::INTEGER as foo FROM generate_series(1, 10000) as t(v)"
|
|
23657
|
+
);
|
|
23326
23658
|
expect(result.numRows).toEqual(1);
|
|
23327
23659
|
expect(result.numCols).toEqual(1);
|
|
23328
23660
|
expect(result.getChildAt(0)?.length).toEqual(1);
|
|
@@ -23330,7 +23662,9 @@ Media,Theater,2020,Q1,20,7,1,2020-Q1,Sony,Format=XML; <Properties>\u2026,1
|
|
|
23330
23662
|
});
|
|
23331
23663
|
it("double", async () => {
|
|
23332
23664
|
conn.createScalarFunction("jsudf2", new Float64(), (a) => a);
|
|
23333
|
-
const result = conn.query(
|
|
23665
|
+
const result = conn.query(
|
|
23666
|
+
"SELECT max(jsudf2(v::DOUBLE))::DOUBLE as foo FROM generate_series(1, 10000) as t(v)"
|
|
23667
|
+
);
|
|
23334
23668
|
expect(result.numRows).toEqual(1);
|
|
23335
23669
|
expect(result.numCols).toEqual(1);
|
|
23336
23670
|
expect(result.getChildAt(0)?.length).toEqual(1);
|
|
@@ -23338,7 +23672,9 @@ Media,Theater,2020,Q1,20,7,1,2020-Q1,Sony,Format=XML; <Properties>\u2026,1
|
|
|
23338
23672
|
});
|
|
23339
23673
|
it("2 args", async () => {
|
|
23340
23674
|
conn.createScalarFunction("jsudf3", new Int32(), (a, b) => a + b);
|
|
23341
|
-
const result = conn.query(
|
|
23675
|
+
const result = conn.query(
|
|
23676
|
+
"SELECT max(jsudf3(v::INTEGER, v::INTEGER))::INTEGER as foo FROM generate_series(1, 10000) as t(v)"
|
|
23677
|
+
);
|
|
23342
23678
|
expect(result.numRows).toEqual(1);
|
|
23343
23679
|
expect(result.numCols).toEqual(1);
|
|
23344
23680
|
expect(result.getChildAt(0)?.length).toEqual(1);
|
|
@@ -23346,7 +23682,9 @@ Media,Theater,2020,Q1,20,7,1,2020-Q1,Sony,Format=XML; <Properties>\u2026,1
|
|
|
23346
23682
|
});
|
|
23347
23683
|
it("3 args", async () => {
|
|
23348
23684
|
conn.createScalarFunction("jsudf3args", new Int32(), (a, b, c) => a + b + c);
|
|
23349
|
-
const result = conn.query(
|
|
23685
|
+
const result = conn.query(
|
|
23686
|
+
"SELECT max(jsudf3args(v::INTEGER, v::INTEGER, v::INTEGER))::INTEGER as foo FROM generate_series(1, 10000) as t(v)"
|
|
23687
|
+
);
|
|
23350
23688
|
expect(result.numRows).toEqual(1);
|
|
23351
23689
|
expect(result.numCols).toEqual(1);
|
|
23352
23690
|
expect(result.getChildAt(0)?.length).toEqual(1);
|
|
@@ -23354,7 +23692,9 @@ Media,Theater,2020,Q1,20,7,1,2020-Q1,Sony,Format=XML; <Properties>\u2026,1
|
|
|
23354
23692
|
});
|
|
23355
23693
|
it("4 args", async () => {
|
|
23356
23694
|
conn.createScalarFunction("jsudf4args", new Int32(), (a, b, c, d) => a + b + c + d);
|
|
23357
|
-
const result = conn.query(
|
|
23695
|
+
const result = conn.query(
|
|
23696
|
+
"SELECT max(jsudf4args(v::INTEGER, v::INTEGER, v::INTEGER, v::INTEGER))::INTEGER as foo FROM generate_series(1, 10000) as t(v)"
|
|
23697
|
+
);
|
|
23358
23698
|
expect(result.numRows).toEqual(1);
|
|
23359
23699
|
expect(result.numCols).toEqual(1);
|
|
23360
23700
|
expect(result.getChildAt(0)?.length).toEqual(1);
|
|
@@ -23370,7 +23710,9 @@ Media,Theater,2020,Q1,20,7,1,2020-Q1,Sony,Format=XML; <Properties>\u2026,1
|
|
|
23370
23710
|
});
|
|
23371
23711
|
it("withnulls", async () => {
|
|
23372
23712
|
conn.createScalarFunction("jsudf5", new Int32(), (a) => a == null ? -100 : a);
|
|
23373
|
-
const result = conn.query(
|
|
23713
|
+
const result = conn.query(
|
|
23714
|
+
"SELECT min(jsudf5((case when v % 2 = 0 then v else null end)::INTEGER))::INTEGER as foo FROM generate_series(1, 10000) as t(v)"
|
|
23715
|
+
);
|
|
23374
23716
|
expect(result.numRows).toEqual(1);
|
|
23375
23717
|
expect(result.numCols).toEqual(1);
|
|
23376
23718
|
expect(result.getChildAt(0)?.length).toEqual(1);
|
|
@@ -23381,7 +23723,9 @@ Media,Theater,2020,Q1,20,7,1,2020-Q1,Sony,Format=XML; <Properties>\u2026,1
|
|
|
23381
23723
|
return s.length;
|
|
23382
23724
|
}
|
|
23383
23725
|
conn.createScalarFunction("jsudf6", new Int32(), jsudf6);
|
|
23384
|
-
const result = conn.query(
|
|
23726
|
+
const result = conn.query(
|
|
23727
|
+
"SELECT max(jsudf6('str_' || v))::INTEGER as foo FROM generate_series(1, 10000) as t(v)"
|
|
23728
|
+
);
|
|
23385
23729
|
expect(result.numRows).toEqual(1);
|
|
23386
23730
|
expect(result.numCols).toEqual(1);
|
|
23387
23731
|
expect(result.getChildAt(0)?.length).toEqual(1);
|
|
@@ -23396,7 +23740,9 @@ Media,Theater,2020,Q1,20,7,1,2020-Q1,Sony,Format=XML; <Properties>\u2026,1
|
|
|
23396
23740
|
}
|
|
23397
23741
|
}
|
|
23398
23742
|
conn.createScalarFunction("jsudf7", new Int32(), jsudf7);
|
|
23399
|
-
const result = conn.query(
|
|
23743
|
+
const result = conn.query(
|
|
23744
|
+
"SELECT max(jsudf7((case when v % 2 = 0 then 'str_' || v else null end)::VARCHAR))::INTEGER as foo FROM generate_series(1, 10000) as t(v)"
|
|
23745
|
+
);
|
|
23400
23746
|
expect(result.numRows).toEqual(1);
|
|
23401
23747
|
expect(result.numCols).toEqual(1);
|
|
23402
23748
|
expect(result.getChildAt(0)?.length).toEqual(1);
|
|
@@ -23404,7 +23750,9 @@ Media,Theater,2020,Q1,20,7,1,2020-Q1,Sony,Format=XML; <Properties>\u2026,1
|
|
|
23404
23750
|
});
|
|
23405
23751
|
it("nullintreturn", async () => {
|
|
23406
23752
|
conn.createScalarFunction("jsudf8", new Int32(), (a) => void 0);
|
|
23407
|
-
const result = conn.query(
|
|
23753
|
+
const result = conn.query(
|
|
23754
|
+
"SELECT max(COALESCE(jsudf8(v::INTEGER), 42))::INTEGER as foo FROM generate_series(1, 10000) as t(v)"
|
|
23755
|
+
);
|
|
23408
23756
|
expect(result.numRows).toEqual(1);
|
|
23409
23757
|
expect(result.numCols).toEqual(1);
|
|
23410
23758
|
expect(result.getChildAt(0)?.length).toEqual(1);
|
|
@@ -23412,7 +23760,9 @@ Media,Theater,2020,Q1,20,7,1,2020-Q1,Sony,Format=XML; <Properties>\u2026,1
|
|
|
23412
23760
|
});
|
|
23413
23761
|
it("stringreturn", async () => {
|
|
23414
23762
|
conn.createScalarFunction("jsudf9", new Utf8(), (a) => "Hello " + a);
|
|
23415
|
-
const result = conn.query(
|
|
23763
|
+
const result = conn.query(
|
|
23764
|
+
"SELECT max(LENGTH(jsudf9(v::INTEGER)))::INTEGER as foo FROM generate_series(1, 10000) as t(v)"
|
|
23765
|
+
);
|
|
23416
23766
|
expect(result.numRows).toEqual(1);
|
|
23417
23767
|
expect(result.numCols).toEqual(1);
|
|
23418
23768
|
expect(result.getChildAt(0)?.length).toEqual(1);
|
|
@@ -23420,7 +23770,9 @@ Media,Theater,2020,Q1,20,7,1,2020-Q1,Sony,Format=XML; <Properties>\u2026,1
|
|
|
23420
23770
|
});
|
|
23421
23771
|
it("nullstringreturn", async () => {
|
|
23422
23772
|
conn.createScalarFunction("jsudf10", new Utf8(), (a) => a % 2 == 0 ? "Hello" : void 0);
|
|
23423
|
-
const result = conn.query(
|
|
23773
|
+
const result = conn.query(
|
|
23774
|
+
"SELECT COUNT(jsudf10(v::INTEGER))::INTEGER as foo FROM generate_series(1, 10000) as t(v)"
|
|
23775
|
+
);
|
|
23424
23776
|
expect(result.numRows).toEqual(1);
|
|
23425
23777
|
expect(result.numCols).toEqual(1);
|
|
23426
23778
|
expect(result.getChildAt(0)?.length).toEqual(1);
|
|
@@ -23428,7 +23780,9 @@ Media,Theater,2020,Q1,20,7,1,2020-Q1,Sony,Format=XML; <Properties>\u2026,1
|
|
|
23428
23780
|
});
|
|
23429
23781
|
it("struct", async () => {
|
|
23430
23782
|
conn.createScalarFunction("jsudf11", new Int32(), (a) => a.x == null ? -100 : a.x);
|
|
23431
|
-
const result = conn.query(
|
|
23783
|
+
const result = conn.query(
|
|
23784
|
+
`SELECT min(jsudf11({'x': (case when v % 2 = 0 then v else null end)::INTEGER, 'y': 42}))::INTEGER as foo FROM generate_series(1, 10000) as t(v)`
|
|
23785
|
+
);
|
|
23432
23786
|
expect(result.numRows).toEqual(1);
|
|
23433
23787
|
expect(result.numCols).toEqual(1);
|
|
23434
23788
|
expect(result.getChildAt(0)?.length).toEqual(1);
|
|
@@ -23436,7 +23790,9 @@ Media,Theater,2020,Q1,20,7,1,2020-Q1,Sony,Format=XML; <Properties>\u2026,1
|
|
|
23436
23790
|
});
|
|
23437
23791
|
it("structnested", async () => {
|
|
23438
23792
|
conn.createScalarFunction("jsudf12", new Int32(), (a) => a.x.y == null ? -100 : a.x.y);
|
|
23439
|
-
const result = conn.query(
|
|
23793
|
+
const result = conn.query(
|
|
23794
|
+
`SELECT min(jsudf12({'x': {'y': (case when v % 2 = 0 then v else null end)::INTEGER }, 'z': 42}))::INTEGER as foo FROM generate_series(1, 10000) as t(v)`
|
|
23795
|
+
);
|
|
23440
23796
|
expect(result.numRows).toEqual(1);
|
|
23441
23797
|
expect(result.numCols).toEqual(1);
|
|
23442
23798
|
expect(result.getChildAt(0)?.length).toEqual(1);
|
|
@@ -23444,7 +23800,9 @@ Media,Theater,2020,Q1,20,7,1,2020-Q1,Sony,Format=XML; <Properties>\u2026,1
|
|
|
23444
23800
|
});
|
|
23445
23801
|
it("structnestednull", async () => {
|
|
23446
23802
|
conn.createScalarFunction("jsudf13", new Int32(), (a) => a.x?.y == null ? -100 : a.x.y);
|
|
23447
|
-
const result = conn.query(
|
|
23803
|
+
const result = conn.query(
|
|
23804
|
+
`SELECT min(jsudf13({'x': (case when v % 2 = 0 then {'y': v::INTEGER } else null end), 'z': 42}))::INTEGER as foo FROM generate_series(1, 10000) as t(v)`
|
|
23805
|
+
);
|
|
23448
23806
|
expect(result.numRows).toEqual(1);
|
|
23449
23807
|
expect(result.numCols).toEqual(1);
|
|
23450
23808
|
expect(result.getChildAt(0)?.length).toEqual(1);
|
|
@@ -23555,20 +23913,6 @@ Media,Theater,2020,Q1,20,7,1,2020-Q1,Sony,Format=XML; <Properties>\u2026,1
|
|
|
23555
23913
|
testTokenization(() => db);
|
|
23556
23914
|
testTokenizationAsync(() => adb);
|
|
23557
23915
|
})();
|
|
23558
|
-
/*! *****************************************************************************
|
|
23559
|
-
Copyright (c) Microsoft Corporation.
|
|
23560
|
-
|
|
23561
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
23562
|
-
purpose with or without fee is hereby granted.
|
|
23563
|
-
|
|
23564
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
23565
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
23566
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
23567
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
23568
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
23569
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
23570
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
23571
|
-
***************************************************************************** */
|
|
23572
23916
|
/**
|
|
23573
23917
|
* [js-sha256]{@link https://github.com/emn178/js-sha256}
|
|
23574
23918
|
*
|