@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-node.cjs
CHANGED
|
@@ -16,7 +16,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
16
|
}
|
|
17
17
|
return to;
|
|
18
18
|
};
|
|
19
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
21
|
+
mod
|
|
22
|
+
));
|
|
20
23
|
|
|
21
24
|
// ../../node_modules/wasm-feature-detect/dist/cjs/index.js
|
|
22
25
|
var require_cjs = __commonJS({
|
|
@@ -5333,9 +5336,7 @@ var DuckDBConnection = class {
|
|
|
5333
5336
|
this._bindings.createScalarFunction(this._conn, name, returns, func);
|
|
5334
5337
|
}
|
|
5335
5338
|
insertArrowTable(table, options) {
|
|
5336
|
-
const
|
|
5337
|
-
writer.writeAll(table);
|
|
5338
|
-
const buffer = writer.toUint8Array(true);
|
|
5339
|
+
const buffer = arrow.tableToIPC(table, "stream");
|
|
5339
5340
|
this.insertArrowFromIPCStream(buffer, options);
|
|
5340
5341
|
}
|
|
5341
5342
|
insertArrowFromIPCStream(buffer, options) {
|
|
@@ -5489,7 +5490,10 @@ function callScalarUDF(runtime, mod, response, funcId, descPtr, descSize, ptrsPt
|
|
|
5489
5490
|
strings.push(null);
|
|
5490
5491
|
continue;
|
|
5491
5492
|
}
|
|
5492
|
-
const subarray = mod.HEAPU8.subarray(
|
|
5493
|
+
const subarray = mod.HEAPU8.subarray(
|
|
5494
|
+
raw[j],
|
|
5495
|
+
raw[j] + stringLengths[j]
|
|
5496
|
+
);
|
|
5493
5497
|
const str = TEXT_DECODER.decode(subarray);
|
|
5494
5498
|
strings.push(str);
|
|
5495
5499
|
}
|
|
@@ -5526,7 +5530,9 @@ function callScalarUDF(runtime, mod, response, funcId, descPtr, descSize, ptrsPt
|
|
|
5526
5530
|
}
|
|
5527
5531
|
default: {
|
|
5528
5532
|
if (arg.dataBuffer === void 0) {
|
|
5529
|
-
throw new Error(
|
|
5533
|
+
throw new Error(
|
|
5534
|
+
"malformed data view, expected data buffer for argument of type: " + arg.physicalType
|
|
5535
|
+
);
|
|
5530
5536
|
}
|
|
5531
5537
|
const data = ptrToArray(mod, ptrs[arg.dataBuffer], arg.physicalType, desc.rows);
|
|
5532
5538
|
if (validity != null) {
|
|
@@ -5956,12 +5962,20 @@ var DuckDBBindingsBase = class {
|
|
|
5956
5962
|
func
|
|
5957
5963
|
};
|
|
5958
5964
|
this._nextUDFId += 1;
|
|
5959
|
-
const [s, d, n] = callSRet(
|
|
5965
|
+
const [s, d, n] = callSRet(
|
|
5966
|
+
this.mod,
|
|
5967
|
+
"duckdb_web_udf_scalar_create",
|
|
5968
|
+
["number", "string"],
|
|
5969
|
+
[conn, JSON.stringify(decl)]
|
|
5970
|
+
);
|
|
5960
5971
|
if (s !== 0 /* SUCCESS */) {
|
|
5961
5972
|
throw new Error(readString(this.mod, d, n));
|
|
5962
5973
|
}
|
|
5963
5974
|
dropResponseBuffers(this.mod);
|
|
5964
|
-
globalThis.DUCKDB_RUNTIME._udfFunctions = (globalThis.DUCKDB_RUNTIME._udfFunctions || /* @__PURE__ */ new Map()).set(
|
|
5975
|
+
globalThis.DUCKDB_RUNTIME._udfFunctions = (globalThis.DUCKDB_RUNTIME._udfFunctions || /* @__PURE__ */ new Map()).set(
|
|
5976
|
+
def.functionId,
|
|
5977
|
+
def
|
|
5978
|
+
);
|
|
5965
5979
|
if (this.pthread) {
|
|
5966
5980
|
for (const worker2 of [...this.pthread.runningWorkers, ...this.pthread.unusedWorkers]) {
|
|
5967
5981
|
worker2.postMessage({
|
|
@@ -5987,7 +6001,12 @@ var DuckDBBindingsBase = class {
|
|
|
5987
6001
|
dropResponseBuffers(this.mod);
|
|
5988
6002
|
}
|
|
5989
6003
|
runPrepared(conn, statement, params) {
|
|
5990
|
-
const [s, d, n] = callSRet(
|
|
6004
|
+
const [s, d, n] = callSRet(
|
|
6005
|
+
this.mod,
|
|
6006
|
+
"duckdb_web_prepared_run",
|
|
6007
|
+
["number", "number", "string"],
|
|
6008
|
+
[conn, statement, JSON.stringify(params)]
|
|
6009
|
+
);
|
|
5991
6010
|
if (s !== 0 /* SUCCESS */) {
|
|
5992
6011
|
throw new Error(readString(this.mod, d, n));
|
|
5993
6012
|
}
|
|
@@ -5996,7 +6015,12 @@ var DuckDBBindingsBase = class {
|
|
|
5996
6015
|
return res;
|
|
5997
6016
|
}
|
|
5998
6017
|
sendPrepared(conn, statement, params) {
|
|
5999
|
-
const [s, d, n] = callSRet(
|
|
6018
|
+
const [s, d, n] = callSRet(
|
|
6019
|
+
this.mod,
|
|
6020
|
+
"duckdb_web_prepared_send",
|
|
6021
|
+
["number", "number", "string"],
|
|
6022
|
+
[conn, statement, JSON.stringify(params)]
|
|
6023
|
+
);
|
|
6000
6024
|
if (s !== 0 /* SUCCESS */) {
|
|
6001
6025
|
throw new Error(readString(this.mod, d, n));
|
|
6002
6026
|
}
|
|
@@ -6011,7 +6035,12 @@ var DuckDBBindingsBase = class {
|
|
|
6011
6035
|
const bufferOfs = this.mod.HEAPU8.subarray(bufferPtr, bufferPtr + buffer.length);
|
|
6012
6036
|
bufferOfs.set(buffer);
|
|
6013
6037
|
const optJSON = options ? JSON.stringify(options) : "";
|
|
6014
|
-
const [s, d, n] = callSRet(
|
|
6038
|
+
const [s, d, n] = callSRet(
|
|
6039
|
+
this.mod,
|
|
6040
|
+
"duckdb_web_insert_arrow_from_ipc_stream",
|
|
6041
|
+
["number", "number", "number", "string"],
|
|
6042
|
+
[conn, bufferPtr, buffer.length, optJSON]
|
|
6043
|
+
);
|
|
6015
6044
|
if (s !== 0 /* SUCCESS */) {
|
|
6016
6045
|
throw new Error(readString(this.mod, d, n));
|
|
6017
6046
|
}
|
|
@@ -6027,7 +6056,12 @@ var DuckDBBindingsBase = class {
|
|
|
6027
6056
|
opt.columns = opt.columnsFlat;
|
|
6028
6057
|
delete opt.columnsFlat;
|
|
6029
6058
|
const optJSON = JSON.stringify(opt);
|
|
6030
|
-
const [s, d, n] = callSRet(
|
|
6059
|
+
const [s, d, n] = callSRet(
|
|
6060
|
+
this.mod,
|
|
6061
|
+
"duckdb_web_insert_csv_from_path",
|
|
6062
|
+
["number", "string", "string"],
|
|
6063
|
+
[conn, path2, optJSON]
|
|
6064
|
+
);
|
|
6031
6065
|
if (s !== 0 /* SUCCESS */) {
|
|
6032
6066
|
throw new Error(readString(this.mod, d, n));
|
|
6033
6067
|
}
|
|
@@ -6043,7 +6077,12 @@ var DuckDBBindingsBase = class {
|
|
|
6043
6077
|
opt.columns = opt.columnsFlat;
|
|
6044
6078
|
delete opt.columnsFlat;
|
|
6045
6079
|
const optJSON = JSON.stringify(opt);
|
|
6046
|
-
const [s, d, n] = callSRet(
|
|
6080
|
+
const [s, d, n] = callSRet(
|
|
6081
|
+
this.mod,
|
|
6082
|
+
"duckdb_web_insert_json_from_path",
|
|
6083
|
+
["number", "string", "string"],
|
|
6084
|
+
[conn, path2, optJSON]
|
|
6085
|
+
);
|
|
6047
6086
|
if (s !== 0 /* SUCCESS */) {
|
|
6048
6087
|
throw new Error(readString(this.mod, d, n));
|
|
6049
6088
|
}
|
|
@@ -6065,7 +6104,12 @@ var DuckDBBindingsBase = class {
|
|
|
6065
6104
|
if (url === void 0) {
|
|
6066
6105
|
url = name;
|
|
6067
6106
|
}
|
|
6068
|
-
const [s, d, n] = callSRet(
|
|
6107
|
+
const [s, d, n] = callSRet(
|
|
6108
|
+
this.mod,
|
|
6109
|
+
"duckdb_web_fs_register_file_url",
|
|
6110
|
+
["string", "string", "number"],
|
|
6111
|
+
[name, url, -1]
|
|
6112
|
+
);
|
|
6069
6113
|
if (s !== 0 /* SUCCESS */) {
|
|
6070
6114
|
throw new Error(readString(this.mod, d, n));
|
|
6071
6115
|
}
|
|
@@ -6079,14 +6123,24 @@ var DuckDBBindingsBase = class {
|
|
|
6079
6123
|
const ptr = this.mod._malloc(buffer.length);
|
|
6080
6124
|
const dst = this.mod.HEAPU8.subarray(ptr, ptr + buffer.length);
|
|
6081
6125
|
dst.set(buffer);
|
|
6082
|
-
const [s, d, n] = callSRet(
|
|
6126
|
+
const [s, d, n] = callSRet(
|
|
6127
|
+
this.mod,
|
|
6128
|
+
"duckdb_web_fs_register_file_buffer",
|
|
6129
|
+
["string", "number", "number"],
|
|
6130
|
+
[name, ptr, buffer.length]
|
|
6131
|
+
);
|
|
6083
6132
|
if (s !== 0 /* SUCCESS */) {
|
|
6084
6133
|
throw new Error(readString(this.mod, d, n));
|
|
6085
6134
|
}
|
|
6086
6135
|
dropResponseBuffers(this.mod);
|
|
6087
6136
|
}
|
|
6088
6137
|
registerFileHandle(name, handle) {
|
|
6089
|
-
const [s, d, n] = callSRet(
|
|
6138
|
+
const [s, d, n] = callSRet(
|
|
6139
|
+
this.mod,
|
|
6140
|
+
"duckdb_web_fs_register_file_url",
|
|
6141
|
+
["string", "string", "number"],
|
|
6142
|
+
[name, name, -1]
|
|
6143
|
+
);
|
|
6090
6144
|
if (s !== 0 /* SUCCESS */) {
|
|
6091
6145
|
throw new Error(readString(this.mod, d, n));
|
|
6092
6146
|
}
|
|
@@ -6232,7 +6286,12 @@ var NODE_RUNTIME = {
|
|
|
6232
6286
|
resolveFileInfo(mod, fileId) {
|
|
6233
6287
|
try {
|
|
6234
6288
|
const cached = NODE_RUNTIME._fileInfoCache.get(fileId);
|
|
6235
|
-
const [s, d, n] = callSRet(
|
|
6289
|
+
const [s, d, n] = callSRet(
|
|
6290
|
+
mod,
|
|
6291
|
+
"duckdb_web_fs_get_file_info_by_id",
|
|
6292
|
+
["number", "number"],
|
|
6293
|
+
[fileId, (cached == null ? void 0 : cached.cacheEpoch) || 0]
|
|
6294
|
+
);
|
|
6236
6295
|
if (s !== 0 /* SUCCESS */) {
|
|
6237
6296
|
failWith(mod, readString(mod, d, n));
|
|
6238
6297
|
return null;
|
|
@@ -6266,8 +6325,17 @@ var NODE_RUNTIME = {
|
|
|
6266
6325
|
const file = NODE_RUNTIME.resolveFileInfo(mod, fileId);
|
|
6267
6326
|
switch (file == null ? void 0 : file.dataProtocol) {
|
|
6268
6327
|
case 1 /* NATIVE */: {
|
|
6269
|
-
file.dataNativeFd = import_fs.default.openSync(
|
|
6270
|
-
|
|
6328
|
+
file.dataNativeFd = import_fs.default.openSync(
|
|
6329
|
+
file.dataUrl,
|
|
6330
|
+
import_fs.default.constants.O_CREAT | import_fs.default.constants.O_RDWR,
|
|
6331
|
+
import_fs.default.constants.S_IRUSR | import_fs.default.constants.S_IWUSR
|
|
6332
|
+
);
|
|
6333
|
+
const [s, d, n] = callSRet(
|
|
6334
|
+
mod,
|
|
6335
|
+
"duckdb_web_fs_set_file_descriptor",
|
|
6336
|
+
["number", "number"],
|
|
6337
|
+
[fileId, file.dataNativeFd]
|
|
6338
|
+
);
|
|
6271
6339
|
if (s !== 0 /* SUCCESS */) {
|
|
6272
6340
|
failWith(mod, readString(mod, d, n));
|
|
6273
6341
|
}
|
|
@@ -6697,6 +6765,7 @@ var DuckDB = (() => {
|
|
|
6697
6765
|
}
|
|
6698
6766
|
var UTF8Decoder = typeof TextDecoder != "undefined" ? new TextDecoder("utf8") : void 0;
|
|
6699
6767
|
function UTF8ArrayToString(heapOrArray, idx, maxBytesToRead) {
|
|
6768
|
+
idx >>>= 0;
|
|
6700
6769
|
var endIdx = idx + maxBytesToRead;
|
|
6701
6770
|
var endPtr = idx;
|
|
6702
6771
|
while (heapOrArray[endPtr] && !(endPtr >= endIdx))
|
|
@@ -6733,9 +6802,11 @@ var DuckDB = (() => {
|
|
|
6733
6802
|
return str;
|
|
6734
6803
|
}
|
|
6735
6804
|
function UTF8ToString(ptr, maxBytesToRead) {
|
|
6805
|
+
ptr >>>= 0;
|
|
6736
6806
|
return ptr ? UTF8ArrayToString(HEAPU8, ptr, maxBytesToRead) : "";
|
|
6737
6807
|
}
|
|
6738
6808
|
function stringToUTF8Array(str, heap, outIdx, maxBytesToWrite) {
|
|
6809
|
+
outIdx >>>= 0;
|
|
6739
6810
|
if (!(maxBytesToWrite > 0))
|
|
6740
6811
|
return 0;
|
|
6741
6812
|
var startIdx = outIdx;
|
|
@@ -6749,28 +6820,28 @@ var DuckDB = (() => {
|
|
|
6749
6820
|
if (u <= 127) {
|
|
6750
6821
|
if (outIdx >= endIdx)
|
|
6751
6822
|
break;
|
|
6752
|
-
heap[outIdx++] = u;
|
|
6823
|
+
heap[outIdx++ >>> 0] = u;
|
|
6753
6824
|
} else if (u <= 2047) {
|
|
6754
6825
|
if (outIdx + 1 >= endIdx)
|
|
6755
6826
|
break;
|
|
6756
|
-
heap[outIdx++] = 192 | u >> 6;
|
|
6757
|
-
heap[outIdx++] = 128 | u & 63;
|
|
6827
|
+
heap[outIdx++ >>> 0] = 192 | u >> 6;
|
|
6828
|
+
heap[outIdx++ >>> 0] = 128 | u & 63;
|
|
6758
6829
|
} else if (u <= 65535) {
|
|
6759
6830
|
if (outIdx + 2 >= endIdx)
|
|
6760
6831
|
break;
|
|
6761
|
-
heap[outIdx++] = 224 | u >> 12;
|
|
6762
|
-
heap[outIdx++] = 128 | u >> 6 & 63;
|
|
6763
|
-
heap[outIdx++] = 128 | u & 63;
|
|
6832
|
+
heap[outIdx++ >>> 0] = 224 | u >> 12;
|
|
6833
|
+
heap[outIdx++ >>> 0] = 128 | u >> 6 & 63;
|
|
6834
|
+
heap[outIdx++ >>> 0] = 128 | u & 63;
|
|
6764
6835
|
} else {
|
|
6765
6836
|
if (outIdx + 3 >= endIdx)
|
|
6766
6837
|
break;
|
|
6767
|
-
heap[outIdx++] = 240 | u >> 18;
|
|
6768
|
-
heap[outIdx++] = 128 | u >> 12 & 63;
|
|
6769
|
-
heap[outIdx++] = 128 | u >> 6 & 63;
|
|
6770
|
-
heap[outIdx++] = 128 | u & 63;
|
|
6838
|
+
heap[outIdx++ >>> 0] = 240 | u >> 18;
|
|
6839
|
+
heap[outIdx++ >>> 0] = 128 | u >> 12 & 63;
|
|
6840
|
+
heap[outIdx++ >>> 0] = 128 | u >> 6 & 63;
|
|
6841
|
+
heap[outIdx++ >>> 0] = 128 | u & 63;
|
|
6771
6842
|
}
|
|
6772
6843
|
}
|
|
6773
|
-
heap[outIdx] = 0;
|
|
6844
|
+
heap[outIdx >>> 0] = 0;
|
|
6774
6845
|
return outIdx - startIdx;
|
|
6775
6846
|
}
|
|
6776
6847
|
function stringToUTF8(str, outPtr, maxBytesToWrite) {
|
|
@@ -6794,14 +6865,14 @@ var DuckDB = (() => {
|
|
|
6794
6865
|
return len;
|
|
6795
6866
|
}
|
|
6796
6867
|
function writeArrayToMemory(array, buffer2) {
|
|
6797
|
-
HEAP8.set(array, buffer2);
|
|
6868
|
+
HEAP8.set(array, buffer2 >>> 0);
|
|
6798
6869
|
}
|
|
6799
6870
|
function writeAsciiToMemory(str, buffer2, dontAddNull) {
|
|
6800
6871
|
for (var i = 0; i < str.length; ++i) {
|
|
6801
|
-
HEAP8[buffer2++
|
|
6872
|
+
HEAP8[buffer2++ >>> 0] = str.charCodeAt(i);
|
|
6802
6873
|
}
|
|
6803
6874
|
if (!dontAddNull)
|
|
6804
|
-
HEAP8[buffer2
|
|
6875
|
+
HEAP8[buffer2 >>> 0] = 0;
|
|
6805
6876
|
}
|
|
6806
6877
|
var buffer, HEAP8, HEAPU8, HEAP16, HEAPU16, HEAP32, HEAPU32, HEAPF32, HEAPF64;
|
|
6807
6878
|
function updateGlobalBufferAndViews(buf) {
|
|
@@ -7059,33 +7130,33 @@ var DuckDB = (() => {
|
|
|
7059
7130
|
this.excPtr = excPtr;
|
|
7060
7131
|
this.ptr = excPtr - 24;
|
|
7061
7132
|
this.set_type = function(type) {
|
|
7062
|
-
HEAP32[this.ptr + 4
|
|
7133
|
+
HEAP32[this.ptr + 4 >>> 2] = type;
|
|
7063
7134
|
};
|
|
7064
7135
|
this.get_type = function() {
|
|
7065
|
-
return HEAP32[this.ptr + 4
|
|
7136
|
+
return HEAP32[this.ptr + 4 >>> 2];
|
|
7066
7137
|
};
|
|
7067
7138
|
this.set_destructor = function(destructor) {
|
|
7068
|
-
HEAP32[this.ptr + 8
|
|
7139
|
+
HEAP32[this.ptr + 8 >>> 2] = destructor;
|
|
7069
7140
|
};
|
|
7070
7141
|
this.get_destructor = function() {
|
|
7071
|
-
return HEAP32[this.ptr + 8
|
|
7142
|
+
return HEAP32[this.ptr + 8 >>> 2];
|
|
7072
7143
|
};
|
|
7073
7144
|
this.set_refcount = function(refcount) {
|
|
7074
|
-
HEAP32[this.ptr
|
|
7145
|
+
HEAP32[this.ptr >>> 2] = refcount;
|
|
7075
7146
|
};
|
|
7076
7147
|
this.set_caught = function(caught) {
|
|
7077
7148
|
caught = caught ? 1 : 0;
|
|
7078
|
-
HEAP8[this.ptr + 12
|
|
7149
|
+
HEAP8[this.ptr + 12 >>> 0] = caught;
|
|
7079
7150
|
};
|
|
7080
7151
|
this.get_caught = function() {
|
|
7081
|
-
return HEAP8[this.ptr + 12
|
|
7152
|
+
return HEAP8[this.ptr + 12 >>> 0] != 0;
|
|
7082
7153
|
};
|
|
7083
7154
|
this.set_rethrown = function(rethrown) {
|
|
7084
7155
|
rethrown = rethrown ? 1 : 0;
|
|
7085
|
-
HEAP8[this.ptr + 13
|
|
7156
|
+
HEAP8[this.ptr + 13 >>> 0] = rethrown;
|
|
7086
7157
|
};
|
|
7087
7158
|
this.get_rethrown = function() {
|
|
7088
|
-
return HEAP8[this.ptr + 13
|
|
7159
|
+
return HEAP8[this.ptr + 13 >>> 0] != 0;
|
|
7089
7160
|
};
|
|
7090
7161
|
this.init = function(type, destructor) {
|
|
7091
7162
|
this.set_adjusted_ptr(0);
|
|
@@ -7096,24 +7167,24 @@ var DuckDB = (() => {
|
|
|
7096
7167
|
this.set_rethrown(false);
|
|
7097
7168
|
};
|
|
7098
7169
|
this.add_ref = function() {
|
|
7099
|
-
var value = HEAP32[this.ptr
|
|
7100
|
-
HEAP32[this.ptr
|
|
7170
|
+
var value = HEAP32[this.ptr >>> 2];
|
|
7171
|
+
HEAP32[this.ptr >>> 2] = value + 1;
|
|
7101
7172
|
};
|
|
7102
7173
|
this.release_ref = function() {
|
|
7103
|
-
var prev = HEAP32[this.ptr
|
|
7104
|
-
HEAP32[this.ptr
|
|
7174
|
+
var prev = HEAP32[this.ptr >>> 2];
|
|
7175
|
+
HEAP32[this.ptr >>> 2] = prev - 1;
|
|
7105
7176
|
return prev === 1;
|
|
7106
7177
|
};
|
|
7107
7178
|
this.set_adjusted_ptr = function(adjustedPtr) {
|
|
7108
|
-
HEAP32[this.ptr + 16
|
|
7179
|
+
HEAP32[this.ptr + 16 >>> 2] = adjustedPtr;
|
|
7109
7180
|
};
|
|
7110
7181
|
this.get_adjusted_ptr = function() {
|
|
7111
|
-
return HEAP32[this.ptr + 16
|
|
7182
|
+
return HEAP32[this.ptr + 16 >>> 2];
|
|
7112
7183
|
};
|
|
7113
7184
|
this.get_exception_ptr = function() {
|
|
7114
7185
|
var isPointer = ___cxa_is_pointer_type(this.get_type());
|
|
7115
7186
|
if (isPointer) {
|
|
7116
|
-
return HEAP32[this.excPtr
|
|
7187
|
+
return HEAP32[this.excPtr >>> 2];
|
|
7117
7188
|
}
|
|
7118
7189
|
var adjusted = this.get_adjusted_ptr();
|
|
7119
7190
|
if (adjusted !== 0)
|
|
@@ -7292,7 +7363,7 @@ var DuckDB = (() => {
|
|
|
7292
7363
|
}
|
|
7293
7364
|
}, varargs: void 0, get: function() {
|
|
7294
7365
|
SYSCALLS.varargs += 4;
|
|
7295
|
-
var ret = HEAP32[SYSCALLS.varargs - 4
|
|
7366
|
+
var ret = HEAP32[SYSCALLS.varargs - 4 >>> 2];
|
|
7296
7367
|
return ret;
|
|
7297
7368
|
}, getStr: function(ptr) {
|
|
7298
7369
|
var ret = UTF8ToString(ptr);
|
|
@@ -7381,22 +7452,22 @@ var DuckDB = (() => {
|
|
|
7381
7452
|
return str;
|
|
7382
7453
|
}
|
|
7383
7454
|
function readSockaddr(sa, salen) {
|
|
7384
|
-
var family = HEAP16[sa
|
|
7385
|
-
var port = _ntohs(HEAPU16[sa + 2
|
|
7455
|
+
var family = HEAP16[sa >>> 1];
|
|
7456
|
+
var port = _ntohs(HEAPU16[sa + 2 >>> 1]);
|
|
7386
7457
|
var addr;
|
|
7387
7458
|
switch (family) {
|
|
7388
7459
|
case 2:
|
|
7389
7460
|
if (salen !== 16) {
|
|
7390
7461
|
return { errno: 28 };
|
|
7391
7462
|
}
|
|
7392
|
-
addr = HEAP32[sa + 4
|
|
7463
|
+
addr = HEAP32[sa + 4 >>> 2];
|
|
7393
7464
|
addr = inetNtop4(addr);
|
|
7394
7465
|
break;
|
|
7395
7466
|
case 10:
|
|
7396
7467
|
if (salen !== 28) {
|
|
7397
7468
|
return { errno: 28 };
|
|
7398
7469
|
}
|
|
7399
|
-
addr = [HEAP32[sa + 8
|
|
7470
|
+
addr = [HEAP32[sa + 8 >>> 2], HEAP32[sa + 12 >>> 2], HEAP32[sa + 16 >>> 2], HEAP32[sa + 20 >>> 2]];
|
|
7400
7471
|
addr = inetNtop6(addr);
|
|
7401
7472
|
break;
|
|
7402
7473
|
default:
|
|
@@ -7531,24 +7602,24 @@ var DuckDB = (() => {
|
|
|
7531
7602
|
addr = inetPton4(addr);
|
|
7532
7603
|
zeroMemory(sa, 16);
|
|
7533
7604
|
if (addrlen) {
|
|
7534
|
-
HEAP32[addrlen
|
|
7605
|
+
HEAP32[addrlen >>> 2] = 16;
|
|
7535
7606
|
}
|
|
7536
|
-
HEAP16[sa
|
|
7537
|
-
HEAP32[sa + 4
|
|
7538
|
-
HEAP16[sa + 2
|
|
7607
|
+
HEAP16[sa >>> 1] = family;
|
|
7608
|
+
HEAP32[sa + 4 >>> 2] = addr;
|
|
7609
|
+
HEAP16[sa + 2 >>> 1] = _htons(port);
|
|
7539
7610
|
break;
|
|
7540
7611
|
case 10:
|
|
7541
7612
|
addr = inetPton6(addr);
|
|
7542
7613
|
zeroMemory(sa, 28);
|
|
7543
7614
|
if (addrlen) {
|
|
7544
|
-
HEAP32[addrlen
|
|
7615
|
+
HEAP32[addrlen >>> 2] = 28;
|
|
7545
7616
|
}
|
|
7546
|
-
HEAP32[sa
|
|
7547
|
-
HEAP32[sa + 8
|
|
7548
|
-
HEAP32[sa + 12
|
|
7549
|
-
HEAP32[sa + 16
|
|
7550
|
-
HEAP32[sa + 20
|
|
7551
|
-
HEAP16[sa + 2
|
|
7617
|
+
HEAP32[sa >>> 2] = family;
|
|
7618
|
+
HEAP32[sa + 8 >>> 2] = addr[0];
|
|
7619
|
+
HEAP32[sa + 12 >>> 2] = addr[1];
|
|
7620
|
+
HEAP32[sa + 16 >>> 2] = addr[2];
|
|
7621
|
+
HEAP32[sa + 20 >>> 2] = addr[3];
|
|
7622
|
+
HEAP16[sa + 2 >>> 1] = _htons(port);
|
|
7552
7623
|
break;
|
|
7553
7624
|
default:
|
|
7554
7625
|
return 5;
|
|
@@ -7567,8 +7638,8 @@ var DuckDB = (() => {
|
|
|
7567
7638
|
var sock = getSocketFromFD(fd);
|
|
7568
7639
|
if (level === 1) {
|
|
7569
7640
|
if (optname === 4) {
|
|
7570
|
-
HEAP32[optval
|
|
7571
|
-
HEAP32[optlen
|
|
7641
|
+
HEAP32[optval >>> 2] = sock.error;
|
|
7642
|
+
HEAP32[optlen >>> 2] = 4;
|
|
7572
7643
|
sock.error = null;
|
|
7573
7644
|
return 0;
|
|
7574
7645
|
}
|
|
@@ -7596,7 +7667,7 @@ var DuckDB = (() => {
|
|
|
7596
7667
|
if (addr) {
|
|
7597
7668
|
var errno = writeSockaddr(addr, sock.family, DNS.lookup_name(msg.addr), msg.port, addrlen);
|
|
7598
7669
|
}
|
|
7599
|
-
HEAPU8.set(msg.buffer, buf);
|
|
7670
|
+
HEAPU8.set(msg.buffer, buf >>> 0);
|
|
7600
7671
|
return msg.buffer.byteLength;
|
|
7601
7672
|
}
|
|
7602
7673
|
function ___syscall_renameat(olddirfd, oldpath, newdirfd, newpath) {
|
|
@@ -7676,7 +7747,7 @@ var DuckDB = (() => {
|
|
|
7676
7747
|
return globalThis.DUCKDB_RUNTIME.callScalarUDF(Module, funcId, descPtr, descSize, ptrsPtr, ptrsSize, response);
|
|
7677
7748
|
}
|
|
7678
7749
|
function _emscripten_get_heap_max() {
|
|
7679
|
-
return
|
|
7750
|
+
return 4294901760;
|
|
7680
7751
|
}
|
|
7681
7752
|
var _emscripten_get_now;
|
|
7682
7753
|
if (ENVIRONMENT_IS_NODE) {
|
|
@@ -7687,7 +7758,7 @@ var DuckDB = (() => {
|
|
|
7687
7758
|
} else
|
|
7688
7759
|
_emscripten_get_now = () => performance.now();
|
|
7689
7760
|
function _emscripten_memcpy_big(dest, src, num) {
|
|
7690
|
-
HEAPU8.copyWithin(dest, src, src + num);
|
|
7761
|
+
HEAPU8.copyWithin(dest >>> 0, src >>> 0, src + num >>> 0);
|
|
7691
7762
|
}
|
|
7692
7763
|
function emscripten_realloc_buffer(size) {
|
|
7693
7764
|
try {
|
|
@@ -7742,7 +7813,7 @@ var DuckDB = (() => {
|
|
|
7742
7813
|
var bufSize = 0;
|
|
7743
7814
|
getEnvStrings().forEach(function(string, i) {
|
|
7744
7815
|
var ptr = environ_buf + bufSize;
|
|
7745
|
-
HEAP32[__environ + i * 4
|
|
7816
|
+
HEAP32[__environ + i * 4 >>> 2] = ptr;
|
|
7746
7817
|
writeAsciiToMemory(string, ptr);
|
|
7747
7818
|
bufSize += string.length + 1;
|
|
7748
7819
|
});
|
|
@@ -7750,12 +7821,12 @@ var DuckDB = (() => {
|
|
|
7750
7821
|
}
|
|
7751
7822
|
function _environ_sizes_get(penviron_count, penviron_buf_size) {
|
|
7752
7823
|
var strings = getEnvStrings();
|
|
7753
|
-
HEAP32[penviron_count
|
|
7824
|
+
HEAP32[penviron_count >>> 2] = strings.length;
|
|
7754
7825
|
var bufSize = 0;
|
|
7755
7826
|
strings.forEach(function(string) {
|
|
7756
7827
|
bufSize += string.length + 1;
|
|
7757
7828
|
});
|
|
7758
|
-
HEAP32[penviron_buf_size
|
|
7829
|
+
HEAP32[penviron_buf_size >>> 2] = bufSize;
|
|
7759
7830
|
return 0;
|
|
7760
7831
|
}
|
|
7761
7832
|
function _fd_close(fd) {
|
|
@@ -7764,19 +7835,19 @@ var DuckDB = (() => {
|
|
|
7764
7835
|
function _fd_pread(fd, iov, iovcnt, offset_low, offset_high, pnum) {
|
|
7765
7836
|
var stream = SYSCALLS.getStreamFromFD(fd);
|
|
7766
7837
|
var num = SYSCALLS.doReadv(stream, iov, iovcnt, offset_low);
|
|
7767
|
-
HEAP32[pnum
|
|
7838
|
+
HEAP32[pnum >>> 2] = num;
|
|
7768
7839
|
return 0;
|
|
7769
7840
|
}
|
|
7770
7841
|
function _fd_pwrite(fd, iov, iovcnt, offset_low, offset_high, pnum) {
|
|
7771
7842
|
var stream = SYSCALLS.getStreamFromFD(fd);
|
|
7772
7843
|
var num = SYSCALLS.doWritev(stream, iov, iovcnt, offset_low);
|
|
7773
|
-
HEAP32[pnum
|
|
7844
|
+
HEAP32[pnum >>> 2] = num;
|
|
7774
7845
|
return 0;
|
|
7775
7846
|
}
|
|
7776
7847
|
function _fd_read(fd, iov, iovcnt, pnum) {
|
|
7777
7848
|
var stream = SYSCALLS.getStreamFromFD(fd);
|
|
7778
7849
|
var num = SYSCALLS.doReadv(stream, iov, iovcnt);
|
|
7779
|
-
HEAP32[pnum
|
|
7850
|
+
HEAP32[pnum >>> 2] = num;
|
|
7780
7851
|
return 0;
|
|
7781
7852
|
}
|
|
7782
7853
|
function _fd_seek(fd, offset_low, offset_high, whence, newOffset) {
|
|
@@ -7791,15 +7862,15 @@ var DuckDB = (() => {
|
|
|
7791
7862
|
function _fd_write(fd, iov, iovcnt, pnum) {
|
|
7792
7863
|
var num = 0;
|
|
7793
7864
|
for (var i = 0; i < iovcnt; i++) {
|
|
7794
|
-
var ptr = HEAP32[iov
|
|
7795
|
-
var len = HEAP32[iov + 4
|
|
7865
|
+
var ptr = HEAP32[iov >>> 2];
|
|
7866
|
+
var len = HEAP32[iov + 4 >>> 2];
|
|
7796
7867
|
iov += 8;
|
|
7797
7868
|
for (var j = 0; j < len; j++) {
|
|
7798
|
-
SYSCALLS.printChar(fd, HEAPU8[ptr + j]);
|
|
7869
|
+
SYSCALLS.printChar(fd, HEAPU8[ptr + j >>> 0]);
|
|
7799
7870
|
}
|
|
7800
7871
|
num += len;
|
|
7801
7872
|
}
|
|
7802
|
-
HEAP32[pnum
|
|
7873
|
+
HEAP32[pnum >>> 2] = num;
|
|
7803
7874
|
return 0;
|
|
7804
7875
|
}
|
|
7805
7876
|
function _getTempRet0() {
|
|
@@ -7822,24 +7893,24 @@ var DuckDB = (() => {
|
|
|
7822
7893
|
errno = writeSockaddr(sa, family2, addr2, port2);
|
|
7823
7894
|
assert(!errno);
|
|
7824
7895
|
ai2 = _malloc(32);
|
|
7825
|
-
HEAP32[ai2 + 4
|
|
7826
|
-
HEAP32[ai2 + 8
|
|
7827
|
-
HEAP32[ai2 + 12
|
|
7828
|
-
HEAP32[ai2 + 24
|
|
7829
|
-
HEAP32[ai2 + 20
|
|
7896
|
+
HEAP32[ai2 + 4 >>> 2] = family2;
|
|
7897
|
+
HEAP32[ai2 + 8 >>> 2] = type2;
|
|
7898
|
+
HEAP32[ai2 + 12 >>> 2] = proto2;
|
|
7899
|
+
HEAP32[ai2 + 24 >>> 2] = canon;
|
|
7900
|
+
HEAP32[ai2 + 20 >>> 2] = sa;
|
|
7830
7901
|
if (family2 === 10) {
|
|
7831
|
-
HEAP32[ai2 + 16
|
|
7902
|
+
HEAP32[ai2 + 16 >>> 2] = 28;
|
|
7832
7903
|
} else {
|
|
7833
|
-
HEAP32[ai2 + 16
|
|
7904
|
+
HEAP32[ai2 + 16 >>> 2] = 16;
|
|
7834
7905
|
}
|
|
7835
|
-
HEAP32[ai2 + 28
|
|
7906
|
+
HEAP32[ai2 + 28 >>> 2] = 0;
|
|
7836
7907
|
return ai2;
|
|
7837
7908
|
}
|
|
7838
7909
|
if (hint) {
|
|
7839
|
-
flags = HEAP32[hint
|
|
7840
|
-
family = HEAP32[hint + 4
|
|
7841
|
-
type = HEAP32[hint + 8
|
|
7842
|
-
proto = HEAP32[hint + 12
|
|
7910
|
+
flags = HEAP32[hint >>> 2];
|
|
7911
|
+
family = HEAP32[hint + 4 >>> 2];
|
|
7912
|
+
type = HEAP32[hint + 8 >>> 2];
|
|
7913
|
+
proto = HEAP32[hint + 12 >>> 2];
|
|
7843
7914
|
}
|
|
7844
7915
|
if (type && !proto) {
|
|
7845
7916
|
proto = type === 2 ? 17 : 6;
|
|
@@ -7859,7 +7930,7 @@ var DuckDB = (() => {
|
|
|
7859
7930
|
if (flags & ~(1 | 2 | 4 | 1024 | 8 | 16 | 32)) {
|
|
7860
7931
|
return -1;
|
|
7861
7932
|
}
|
|
7862
|
-
if (hint !== 0 && HEAP32[hint
|
|
7933
|
+
if (hint !== 0 && HEAP32[hint >>> 2] & 2 && !node) {
|
|
7863
7934
|
return -1;
|
|
7864
7935
|
}
|
|
7865
7936
|
if (flags & 32) {
|
|
@@ -7893,7 +7964,7 @@ var DuckDB = (() => {
|
|
|
7893
7964
|
}
|
|
7894
7965
|
}
|
|
7895
7966
|
ai = allocaddrinfo(family, type, proto, null, addr, port);
|
|
7896
|
-
HEAP32[out2
|
|
7967
|
+
HEAP32[out2 >>> 2] = ai;
|
|
7897
7968
|
return 0;
|
|
7898
7969
|
}
|
|
7899
7970
|
node = UTF8ToString(node);
|
|
@@ -7919,7 +7990,7 @@ var DuckDB = (() => {
|
|
|
7919
7990
|
}
|
|
7920
7991
|
if (addr != null) {
|
|
7921
7992
|
ai = allocaddrinfo(family, type, proto, node, addr, port);
|
|
7922
|
-
HEAP32[out2
|
|
7993
|
+
HEAP32[out2 >>> 2] = ai;
|
|
7923
7994
|
return 0;
|
|
7924
7995
|
}
|
|
7925
7996
|
if (flags & 4) {
|
|
@@ -7933,7 +8004,7 @@ var DuckDB = (() => {
|
|
|
7933
8004
|
addr = [0, 0, _htonl(65535), addr];
|
|
7934
8005
|
}
|
|
7935
8006
|
ai = allocaddrinfo(family, type, proto, null, addr, port);
|
|
7936
|
-
HEAP32[out2
|
|
8007
|
+
HEAP32[out2 >>> 2] = ai;
|
|
7937
8008
|
return 0;
|
|
7938
8009
|
}
|
|
7939
8010
|
function getRandomDevice() {
|
|
@@ -7961,7 +8032,7 @@ var DuckDB = (() => {
|
|
|
7961
8032
|
_getentropy.randomDevice = getRandomDevice();
|
|
7962
8033
|
}
|
|
7963
8034
|
for (var i = 0; i < size; i++) {
|
|
7964
|
-
HEAP8[buffer2 + i
|
|
8035
|
+
HEAP8[buffer2 + i >>> 0] = _getentropy.randomDevice();
|
|
7965
8036
|
}
|
|
7966
8037
|
return 0;
|
|
7967
8038
|
}
|
|
@@ -8039,8 +8110,8 @@ var DuckDB = (() => {
|
|
|
8039
8110
|
return newDate;
|
|
8040
8111
|
}
|
|
8041
8112
|
function _strftime(s, maxsize, format, tm) {
|
|
8042
|
-
var tm_zone = HEAP32[tm + 40
|
|
8043
|
-
var date = { tm_sec: HEAP32[tm
|
|
8113
|
+
var tm_zone = HEAP32[tm + 40 >>> 2];
|
|
8114
|
+
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) : "" };
|
|
8044
8115
|
var pattern = UTF8ToString(format);
|
|
8045
8116
|
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" };
|
|
8046
8117
|
for (var rule in EXPANSION_RULES_1) {
|
|
@@ -11965,6 +12036,7 @@ var DuckDB3 = (() => {
|
|
|
11965
12036
|
}
|
|
11966
12037
|
var UTF8Decoder = typeof TextDecoder != "undefined" ? new TextDecoder("utf8") : void 0;
|
|
11967
12038
|
function UTF8ArrayToString(heapOrArray, idx, maxBytesToRead) {
|
|
12039
|
+
idx >>>= 0;
|
|
11968
12040
|
var endIdx = idx + maxBytesToRead;
|
|
11969
12041
|
var endPtr = idx;
|
|
11970
12042
|
while (heapOrArray[endPtr] && !(endPtr >= endIdx))
|
|
@@ -12001,9 +12073,11 @@ var DuckDB3 = (() => {
|
|
|
12001
12073
|
return str;
|
|
12002
12074
|
}
|
|
12003
12075
|
function UTF8ToString(ptr, maxBytesToRead) {
|
|
12076
|
+
ptr >>>= 0;
|
|
12004
12077
|
return ptr ? UTF8ArrayToString(HEAPU8, ptr, maxBytesToRead) : "";
|
|
12005
12078
|
}
|
|
12006
12079
|
function stringToUTF8Array(str, heap, outIdx, maxBytesToWrite) {
|
|
12080
|
+
outIdx >>>= 0;
|
|
12007
12081
|
if (!(maxBytesToWrite > 0))
|
|
12008
12082
|
return 0;
|
|
12009
12083
|
var startIdx = outIdx;
|
|
@@ -12017,28 +12091,28 @@ var DuckDB3 = (() => {
|
|
|
12017
12091
|
if (u <= 127) {
|
|
12018
12092
|
if (outIdx >= endIdx)
|
|
12019
12093
|
break;
|
|
12020
|
-
heap[outIdx++] = u;
|
|
12094
|
+
heap[outIdx++ >>> 0] = u;
|
|
12021
12095
|
} else if (u <= 2047) {
|
|
12022
12096
|
if (outIdx + 1 >= endIdx)
|
|
12023
12097
|
break;
|
|
12024
|
-
heap[outIdx++] = 192 | u >> 6;
|
|
12025
|
-
heap[outIdx++] = 128 | u & 63;
|
|
12098
|
+
heap[outIdx++ >>> 0] = 192 | u >> 6;
|
|
12099
|
+
heap[outIdx++ >>> 0] = 128 | u & 63;
|
|
12026
12100
|
} else if (u <= 65535) {
|
|
12027
12101
|
if (outIdx + 2 >= endIdx)
|
|
12028
12102
|
break;
|
|
12029
|
-
heap[outIdx++] = 224 | u >> 12;
|
|
12030
|
-
heap[outIdx++] = 128 | u >> 6 & 63;
|
|
12031
|
-
heap[outIdx++] = 128 | u & 63;
|
|
12103
|
+
heap[outIdx++ >>> 0] = 224 | u >> 12;
|
|
12104
|
+
heap[outIdx++ >>> 0] = 128 | u >> 6 & 63;
|
|
12105
|
+
heap[outIdx++ >>> 0] = 128 | u & 63;
|
|
12032
12106
|
} else {
|
|
12033
12107
|
if (outIdx + 3 >= endIdx)
|
|
12034
12108
|
break;
|
|
12035
|
-
heap[outIdx++] = 240 | u >> 18;
|
|
12036
|
-
heap[outIdx++] = 128 | u >> 12 & 63;
|
|
12037
|
-
heap[outIdx++] = 128 | u >> 6 & 63;
|
|
12038
|
-
heap[outIdx++] = 128 | u & 63;
|
|
12109
|
+
heap[outIdx++ >>> 0] = 240 | u >> 18;
|
|
12110
|
+
heap[outIdx++ >>> 0] = 128 | u >> 12 & 63;
|
|
12111
|
+
heap[outIdx++ >>> 0] = 128 | u >> 6 & 63;
|
|
12112
|
+
heap[outIdx++ >>> 0] = 128 | u & 63;
|
|
12039
12113
|
}
|
|
12040
12114
|
}
|
|
12041
|
-
heap[outIdx] = 0;
|
|
12115
|
+
heap[outIdx >>> 0] = 0;
|
|
12042
12116
|
return outIdx - startIdx;
|
|
12043
12117
|
}
|
|
12044
12118
|
function stringToUTF8(str, outPtr, maxBytesToWrite) {
|
|
@@ -12062,14 +12136,14 @@ var DuckDB3 = (() => {
|
|
|
12062
12136
|
return len;
|
|
12063
12137
|
}
|
|
12064
12138
|
function writeArrayToMemory(array, buffer2) {
|
|
12065
|
-
HEAP8.set(array, buffer2);
|
|
12139
|
+
HEAP8.set(array, buffer2 >>> 0);
|
|
12066
12140
|
}
|
|
12067
12141
|
function writeAsciiToMemory(str, buffer2, dontAddNull) {
|
|
12068
12142
|
for (var i = 0; i < str.length; ++i) {
|
|
12069
|
-
HEAP8[buffer2++
|
|
12143
|
+
HEAP8[buffer2++ >>> 0] = str.charCodeAt(i);
|
|
12070
12144
|
}
|
|
12071
12145
|
if (!dontAddNull)
|
|
12072
|
-
HEAP8[buffer2
|
|
12146
|
+
HEAP8[buffer2 >>> 0] = 0;
|
|
12073
12147
|
}
|
|
12074
12148
|
var buffer, HEAP8, HEAPU8, HEAP16, HEAPU16, HEAP32, HEAPU32, HEAPF32, HEAPF64;
|
|
12075
12149
|
function updateGlobalBufferAndViews(buf) {
|
|
@@ -12313,7 +12387,7 @@ var DuckDB3 = (() => {
|
|
|
12313
12387
|
}
|
|
12314
12388
|
}, varargs: void 0, get: function() {
|
|
12315
12389
|
SYSCALLS.varargs += 4;
|
|
12316
|
-
var ret = HEAP32[SYSCALLS.varargs - 4
|
|
12390
|
+
var ret = HEAP32[SYSCALLS.varargs - 4 >>> 2];
|
|
12317
12391
|
return ret;
|
|
12318
12392
|
}, getStr: function(ptr) {
|
|
12319
12393
|
var ret = UTF8ToString(ptr);
|
|
@@ -12402,22 +12476,22 @@ var DuckDB3 = (() => {
|
|
|
12402
12476
|
return str;
|
|
12403
12477
|
}
|
|
12404
12478
|
function readSockaddr(sa, salen) {
|
|
12405
|
-
var family = HEAP16[sa
|
|
12406
|
-
var port = _ntohs(HEAPU16[sa + 2
|
|
12479
|
+
var family = HEAP16[sa >>> 1];
|
|
12480
|
+
var port = _ntohs(HEAPU16[sa + 2 >>> 1]);
|
|
12407
12481
|
var addr;
|
|
12408
12482
|
switch (family) {
|
|
12409
12483
|
case 2:
|
|
12410
12484
|
if (salen !== 16) {
|
|
12411
12485
|
return { errno: 28 };
|
|
12412
12486
|
}
|
|
12413
|
-
addr = HEAP32[sa + 4
|
|
12487
|
+
addr = HEAP32[sa + 4 >>> 2];
|
|
12414
12488
|
addr = inetNtop4(addr);
|
|
12415
12489
|
break;
|
|
12416
12490
|
case 10:
|
|
12417
12491
|
if (salen !== 28) {
|
|
12418
12492
|
return { errno: 28 };
|
|
12419
12493
|
}
|
|
12420
|
-
addr = [HEAP32[sa + 8
|
|
12494
|
+
addr = [HEAP32[sa + 8 >>> 2], HEAP32[sa + 12 >>> 2], HEAP32[sa + 16 >>> 2], HEAP32[sa + 20 >>> 2]];
|
|
12421
12495
|
addr = inetNtop6(addr);
|
|
12422
12496
|
break;
|
|
12423
12497
|
default:
|
|
@@ -12552,24 +12626,24 @@ var DuckDB3 = (() => {
|
|
|
12552
12626
|
addr = inetPton4(addr);
|
|
12553
12627
|
zeroMemory(sa, 16);
|
|
12554
12628
|
if (addrlen) {
|
|
12555
|
-
HEAP32[addrlen
|
|
12629
|
+
HEAP32[addrlen >>> 2] = 16;
|
|
12556
12630
|
}
|
|
12557
|
-
HEAP16[sa
|
|
12558
|
-
HEAP32[sa + 4
|
|
12559
|
-
HEAP16[sa + 2
|
|
12631
|
+
HEAP16[sa >>> 1] = family;
|
|
12632
|
+
HEAP32[sa + 4 >>> 2] = addr;
|
|
12633
|
+
HEAP16[sa + 2 >>> 1] = _htons(port);
|
|
12560
12634
|
break;
|
|
12561
12635
|
case 10:
|
|
12562
12636
|
addr = inetPton6(addr);
|
|
12563
12637
|
zeroMemory(sa, 28);
|
|
12564
12638
|
if (addrlen) {
|
|
12565
|
-
HEAP32[addrlen
|
|
12639
|
+
HEAP32[addrlen >>> 2] = 28;
|
|
12566
12640
|
}
|
|
12567
|
-
HEAP32[sa
|
|
12568
|
-
HEAP32[sa + 8
|
|
12569
|
-
HEAP32[sa + 12
|
|
12570
|
-
HEAP32[sa + 16
|
|
12571
|
-
HEAP32[sa + 20
|
|
12572
|
-
HEAP16[sa + 2
|
|
12641
|
+
HEAP32[sa >>> 2] = family;
|
|
12642
|
+
HEAP32[sa + 8 >>> 2] = addr[0];
|
|
12643
|
+
HEAP32[sa + 12 >>> 2] = addr[1];
|
|
12644
|
+
HEAP32[sa + 16 >>> 2] = addr[2];
|
|
12645
|
+
HEAP32[sa + 20 >>> 2] = addr[3];
|
|
12646
|
+
HEAP16[sa + 2 >>> 1] = _htons(port);
|
|
12573
12647
|
break;
|
|
12574
12648
|
default:
|
|
12575
12649
|
return 5;
|
|
@@ -12588,8 +12662,8 @@ var DuckDB3 = (() => {
|
|
|
12588
12662
|
var sock = getSocketFromFD(fd);
|
|
12589
12663
|
if (level === 1) {
|
|
12590
12664
|
if (optname === 4) {
|
|
12591
|
-
HEAP32[optval
|
|
12592
|
-
HEAP32[optlen
|
|
12665
|
+
HEAP32[optval >>> 2] = sock.error;
|
|
12666
|
+
HEAP32[optlen >>> 2] = 4;
|
|
12593
12667
|
sock.error = null;
|
|
12594
12668
|
return 0;
|
|
12595
12669
|
}
|
|
@@ -12617,7 +12691,7 @@ var DuckDB3 = (() => {
|
|
|
12617
12691
|
if (addr) {
|
|
12618
12692
|
var errno = writeSockaddr(addr, sock.family, DNS.lookup_name(msg.addr), msg.port, addrlen);
|
|
12619
12693
|
}
|
|
12620
|
-
HEAPU8.set(msg.buffer, buf);
|
|
12694
|
+
HEAPU8.set(msg.buffer, buf >>> 0);
|
|
12621
12695
|
return msg.buffer.byteLength;
|
|
12622
12696
|
}
|
|
12623
12697
|
function ___syscall_renameat(olddirfd, oldpath, newdirfd, newpath) {
|
|
@@ -12697,7 +12771,7 @@ var DuckDB3 = (() => {
|
|
|
12697
12771
|
return globalThis.DUCKDB_RUNTIME.callScalarUDF(Module, funcId, descPtr, descSize, ptrsPtr, ptrsSize, response);
|
|
12698
12772
|
}
|
|
12699
12773
|
function _emscripten_get_heap_max() {
|
|
12700
|
-
return
|
|
12774
|
+
return 4294901760;
|
|
12701
12775
|
}
|
|
12702
12776
|
var _emscripten_get_now;
|
|
12703
12777
|
if (ENVIRONMENT_IS_NODE) {
|
|
@@ -12708,7 +12782,7 @@ var DuckDB3 = (() => {
|
|
|
12708
12782
|
} else
|
|
12709
12783
|
_emscripten_get_now = () => performance.now();
|
|
12710
12784
|
function _emscripten_memcpy_big(dest, src, num) {
|
|
12711
|
-
HEAPU8.copyWithin(dest, src, src + num);
|
|
12785
|
+
HEAPU8.copyWithin(dest >>> 0, src >>> 0, src + num >>> 0);
|
|
12712
12786
|
}
|
|
12713
12787
|
function emscripten_realloc_buffer(size) {
|
|
12714
12788
|
try {
|
|
@@ -12763,7 +12837,7 @@ var DuckDB3 = (() => {
|
|
|
12763
12837
|
var bufSize = 0;
|
|
12764
12838
|
getEnvStrings().forEach(function(string, i) {
|
|
12765
12839
|
var ptr = environ_buf + bufSize;
|
|
12766
|
-
HEAP32[__environ + i * 4
|
|
12840
|
+
HEAP32[__environ + i * 4 >>> 2] = ptr;
|
|
12767
12841
|
writeAsciiToMemory(string, ptr);
|
|
12768
12842
|
bufSize += string.length + 1;
|
|
12769
12843
|
});
|
|
@@ -12771,12 +12845,12 @@ var DuckDB3 = (() => {
|
|
|
12771
12845
|
}
|
|
12772
12846
|
function _environ_sizes_get(penviron_count, penviron_buf_size) {
|
|
12773
12847
|
var strings = getEnvStrings();
|
|
12774
|
-
HEAP32[penviron_count
|
|
12848
|
+
HEAP32[penviron_count >>> 2] = strings.length;
|
|
12775
12849
|
var bufSize = 0;
|
|
12776
12850
|
strings.forEach(function(string) {
|
|
12777
12851
|
bufSize += string.length + 1;
|
|
12778
12852
|
});
|
|
12779
|
-
HEAP32[penviron_buf_size
|
|
12853
|
+
HEAP32[penviron_buf_size >>> 2] = bufSize;
|
|
12780
12854
|
return 0;
|
|
12781
12855
|
}
|
|
12782
12856
|
function _fd_close(fd) {
|
|
@@ -12785,19 +12859,19 @@ var DuckDB3 = (() => {
|
|
|
12785
12859
|
function _fd_pread(fd, iov, iovcnt, offset_low, offset_high, pnum) {
|
|
12786
12860
|
var stream = SYSCALLS.getStreamFromFD(fd);
|
|
12787
12861
|
var num = SYSCALLS.doReadv(stream, iov, iovcnt, offset_low);
|
|
12788
|
-
HEAP32[pnum
|
|
12862
|
+
HEAP32[pnum >>> 2] = num;
|
|
12789
12863
|
return 0;
|
|
12790
12864
|
}
|
|
12791
12865
|
function _fd_pwrite(fd, iov, iovcnt, offset_low, offset_high, pnum) {
|
|
12792
12866
|
var stream = SYSCALLS.getStreamFromFD(fd);
|
|
12793
12867
|
var num = SYSCALLS.doWritev(stream, iov, iovcnt, offset_low);
|
|
12794
|
-
HEAP32[pnum
|
|
12868
|
+
HEAP32[pnum >>> 2] = num;
|
|
12795
12869
|
return 0;
|
|
12796
12870
|
}
|
|
12797
12871
|
function _fd_read(fd, iov, iovcnt, pnum) {
|
|
12798
12872
|
var stream = SYSCALLS.getStreamFromFD(fd);
|
|
12799
12873
|
var num = SYSCALLS.doReadv(stream, iov, iovcnt);
|
|
12800
|
-
HEAP32[pnum
|
|
12874
|
+
HEAP32[pnum >>> 2] = num;
|
|
12801
12875
|
return 0;
|
|
12802
12876
|
}
|
|
12803
12877
|
function _fd_seek(fd, offset_low, offset_high, whence, newOffset) {
|
|
@@ -12812,15 +12886,15 @@ var DuckDB3 = (() => {
|
|
|
12812
12886
|
function _fd_write(fd, iov, iovcnt, pnum) {
|
|
12813
12887
|
var num = 0;
|
|
12814
12888
|
for (var i = 0; i < iovcnt; i++) {
|
|
12815
|
-
var ptr = HEAP32[iov
|
|
12816
|
-
var len = HEAP32[iov + 4
|
|
12889
|
+
var ptr = HEAP32[iov >>> 2];
|
|
12890
|
+
var len = HEAP32[iov + 4 >>> 2];
|
|
12817
12891
|
iov += 8;
|
|
12818
12892
|
for (var j = 0; j < len; j++) {
|
|
12819
|
-
SYSCALLS.printChar(fd, HEAPU8[ptr + j]);
|
|
12893
|
+
SYSCALLS.printChar(fd, HEAPU8[ptr + j >>> 0]);
|
|
12820
12894
|
}
|
|
12821
12895
|
num += len;
|
|
12822
12896
|
}
|
|
12823
|
-
HEAP32[pnum
|
|
12897
|
+
HEAP32[pnum >>> 2] = num;
|
|
12824
12898
|
return 0;
|
|
12825
12899
|
}
|
|
12826
12900
|
function _getaddrinfo(node, service, hint, out2) {
|
|
@@ -12840,24 +12914,24 @@ var DuckDB3 = (() => {
|
|
|
12840
12914
|
errno = writeSockaddr(sa, family2, addr2, port2);
|
|
12841
12915
|
assert(!errno);
|
|
12842
12916
|
ai2 = _malloc(32);
|
|
12843
|
-
HEAP32[ai2 + 4
|
|
12844
|
-
HEAP32[ai2 + 8
|
|
12845
|
-
HEAP32[ai2 + 12
|
|
12846
|
-
HEAP32[ai2 + 24
|
|
12847
|
-
HEAP32[ai2 + 20
|
|
12917
|
+
HEAP32[ai2 + 4 >>> 2] = family2;
|
|
12918
|
+
HEAP32[ai2 + 8 >>> 2] = type2;
|
|
12919
|
+
HEAP32[ai2 + 12 >>> 2] = proto2;
|
|
12920
|
+
HEAP32[ai2 + 24 >>> 2] = canon;
|
|
12921
|
+
HEAP32[ai2 + 20 >>> 2] = sa;
|
|
12848
12922
|
if (family2 === 10) {
|
|
12849
|
-
HEAP32[ai2 + 16
|
|
12923
|
+
HEAP32[ai2 + 16 >>> 2] = 28;
|
|
12850
12924
|
} else {
|
|
12851
|
-
HEAP32[ai2 + 16
|
|
12925
|
+
HEAP32[ai2 + 16 >>> 2] = 16;
|
|
12852
12926
|
}
|
|
12853
|
-
HEAP32[ai2 + 28
|
|
12927
|
+
HEAP32[ai2 + 28 >>> 2] = 0;
|
|
12854
12928
|
return ai2;
|
|
12855
12929
|
}
|
|
12856
12930
|
if (hint) {
|
|
12857
|
-
flags = HEAP32[hint
|
|
12858
|
-
family = HEAP32[hint + 4
|
|
12859
|
-
type = HEAP32[hint + 8
|
|
12860
|
-
proto = HEAP32[hint + 12
|
|
12931
|
+
flags = HEAP32[hint >>> 2];
|
|
12932
|
+
family = HEAP32[hint + 4 >>> 2];
|
|
12933
|
+
type = HEAP32[hint + 8 >>> 2];
|
|
12934
|
+
proto = HEAP32[hint + 12 >>> 2];
|
|
12861
12935
|
}
|
|
12862
12936
|
if (type && !proto) {
|
|
12863
12937
|
proto = type === 2 ? 17 : 6;
|
|
@@ -12877,7 +12951,7 @@ var DuckDB3 = (() => {
|
|
|
12877
12951
|
if (flags & ~(1 | 2 | 4 | 1024 | 8 | 16 | 32)) {
|
|
12878
12952
|
return -1;
|
|
12879
12953
|
}
|
|
12880
|
-
if (hint !== 0 && HEAP32[hint
|
|
12954
|
+
if (hint !== 0 && HEAP32[hint >>> 2] & 2 && !node) {
|
|
12881
12955
|
return -1;
|
|
12882
12956
|
}
|
|
12883
12957
|
if (flags & 32) {
|
|
@@ -12911,7 +12985,7 @@ var DuckDB3 = (() => {
|
|
|
12911
12985
|
}
|
|
12912
12986
|
}
|
|
12913
12987
|
ai = allocaddrinfo(family, type, proto, null, addr, port);
|
|
12914
|
-
HEAP32[out2
|
|
12988
|
+
HEAP32[out2 >>> 2] = ai;
|
|
12915
12989
|
return 0;
|
|
12916
12990
|
}
|
|
12917
12991
|
node = UTF8ToString(node);
|
|
@@ -12937,7 +13011,7 @@ var DuckDB3 = (() => {
|
|
|
12937
13011
|
}
|
|
12938
13012
|
if (addr != null) {
|
|
12939
13013
|
ai = allocaddrinfo(family, type, proto, node, addr, port);
|
|
12940
|
-
HEAP32[out2
|
|
13014
|
+
HEAP32[out2 >>> 2] = ai;
|
|
12941
13015
|
return 0;
|
|
12942
13016
|
}
|
|
12943
13017
|
if (flags & 4) {
|
|
@@ -12951,7 +13025,7 @@ var DuckDB3 = (() => {
|
|
|
12951
13025
|
addr = [0, 0, _htonl(65535), addr];
|
|
12952
13026
|
}
|
|
12953
13027
|
ai = allocaddrinfo(family, type, proto, null, addr, port);
|
|
12954
|
-
HEAP32[out2
|
|
13028
|
+
HEAP32[out2 >>> 2] = ai;
|
|
12955
13029
|
return 0;
|
|
12956
13030
|
}
|
|
12957
13031
|
function getRandomDevice() {
|
|
@@ -12979,7 +13053,7 @@ var DuckDB3 = (() => {
|
|
|
12979
13053
|
_getentropy.randomDevice = getRandomDevice();
|
|
12980
13054
|
}
|
|
12981
13055
|
for (var i = 0; i < size; i++) {
|
|
12982
|
-
HEAP8[buffer2 + i
|
|
13056
|
+
HEAP8[buffer2 + i >>> 0] = _getentropy.randomDevice();
|
|
12983
13057
|
}
|
|
12984
13058
|
return 0;
|
|
12985
13059
|
}
|
|
@@ -13051,8 +13125,8 @@ var DuckDB3 = (() => {
|
|
|
13051
13125
|
return newDate;
|
|
13052
13126
|
}
|
|
13053
13127
|
function _strftime(s, maxsize, format, tm) {
|
|
13054
|
-
var tm_zone = HEAP32[tm + 40
|
|
13055
|
-
var date = { tm_sec: HEAP32[tm
|
|
13128
|
+
var tm_zone = HEAP32[tm + 40 >>> 2];
|
|
13129
|
+
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) : "" };
|
|
13056
13130
|
var pattern = UTF8ToString(format);
|
|
13057
13131
|
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" };
|
|
13058
13132
|
for (var rule in EXPANSION_RULES_1) {
|
|
@@ -13644,10 +13718,12 @@ var WorkerTask = class {
|
|
|
13644
13718
|
};
|
|
13645
13719
|
this.type = type;
|
|
13646
13720
|
this.data = data;
|
|
13647
|
-
this.promise = new Promise(
|
|
13648
|
-
|
|
13649
|
-
|
|
13650
|
-
|
|
13721
|
+
this.promise = new Promise(
|
|
13722
|
+
(resolve, reject) => {
|
|
13723
|
+
this.promiseResolver = resolve;
|
|
13724
|
+
this.promiseRejecter = reject;
|
|
13725
|
+
}
|
|
13726
|
+
);
|
|
13651
13727
|
}
|
|
13652
13728
|
};
|
|
13653
13729
|
|
|
@@ -13677,9 +13753,11 @@ var AsyncDuckDB = class {
|
|
|
13677
13753
|
this._worker.addEventListener("message", this._onMessageHandler);
|
|
13678
13754
|
this._worker.addEventListener("error", this._onErrorHandler);
|
|
13679
13755
|
this._worker.addEventListener("close", this._onCloseHandler);
|
|
13680
|
-
this._workerShutdownPromise = new Promise(
|
|
13681
|
-
|
|
13682
|
-
|
|
13756
|
+
this._workerShutdownPromise = new Promise(
|
|
13757
|
+
(resolve, _reject) => {
|
|
13758
|
+
this._workerShutdownResolver = resolve;
|
|
13759
|
+
}
|
|
13760
|
+
);
|
|
13683
13761
|
}
|
|
13684
13762
|
detach() {
|
|
13685
13763
|
if (!this._worker)
|
|
@@ -13709,11 +13787,14 @@ var AsyncDuckDB = class {
|
|
|
13709
13787
|
}
|
|
13710
13788
|
const mid = this._nextMessageId++;
|
|
13711
13789
|
this._pendingRequests.set(mid, task);
|
|
13712
|
-
this._worker.postMessage(
|
|
13713
|
-
|
|
13714
|
-
|
|
13715
|
-
|
|
13716
|
-
|
|
13790
|
+
this._worker.postMessage(
|
|
13791
|
+
{
|
|
13792
|
+
messageId: mid,
|
|
13793
|
+
type: task.type,
|
|
13794
|
+
data: task.data
|
|
13795
|
+
},
|
|
13796
|
+
transfer
|
|
13797
|
+
);
|
|
13717
13798
|
return await task.promise;
|
|
13718
13799
|
}
|
|
13719
13800
|
onMessage(event) {
|
|
@@ -13903,7 +13984,10 @@ var AsyncDuckDB = class {
|
|
|
13903
13984
|
async instantiate(mainModuleURL, pthreadWorkerURL = null, progress = (_p) => {
|
|
13904
13985
|
}) {
|
|
13905
13986
|
this._onInstantiationProgress.push(progress);
|
|
13906
|
-
const task = new WorkerTask(
|
|
13987
|
+
const task = new WorkerTask(
|
|
13988
|
+
"INSTANTIATE" /* INSTANTIATE */,
|
|
13989
|
+
[mainModuleURL, pthreadWorkerURL]
|
|
13990
|
+
);
|
|
13907
13991
|
return await this.postTask(task);
|
|
13908
13992
|
}
|
|
13909
13993
|
async getVersion() {
|
|
@@ -13912,7 +13996,10 @@ var AsyncDuckDB = class {
|
|
|
13912
13996
|
return version;
|
|
13913
13997
|
}
|
|
13914
13998
|
async getFeatureFlags() {
|
|
13915
|
-
const task = new WorkerTask(
|
|
13999
|
+
const task = new WorkerTask(
|
|
14000
|
+
"GET_FEATURE_FLAGS" /* GET_FEATURE_FLAGS */,
|
|
14001
|
+
null
|
|
14002
|
+
);
|
|
13916
14003
|
const feature = await this.postTask(task);
|
|
13917
14004
|
return feature;
|
|
13918
14005
|
}
|
|
@@ -13934,51 +14021,87 @@ var AsyncDuckDB = class {
|
|
|
13934
14021
|
return new AsyncDuckDBConnection(this, cid);
|
|
13935
14022
|
}
|
|
13936
14023
|
async disconnect(conn) {
|
|
13937
|
-
const task = new WorkerTask(
|
|
14024
|
+
const task = new WorkerTask(
|
|
14025
|
+
"DISCONNECT" /* DISCONNECT */,
|
|
14026
|
+
conn
|
|
14027
|
+
);
|
|
13938
14028
|
await this.postTask(task);
|
|
13939
14029
|
}
|
|
13940
14030
|
async runQuery(conn, text) {
|
|
13941
|
-
const task = new WorkerTask(
|
|
14031
|
+
const task = new WorkerTask(
|
|
14032
|
+
"RUN_QUERY" /* RUN_QUERY */,
|
|
14033
|
+
[conn, text]
|
|
14034
|
+
);
|
|
13942
14035
|
return await this.postTask(task);
|
|
13943
14036
|
}
|
|
13944
14037
|
async startPendingQuery(conn, text) {
|
|
13945
|
-
const task = new WorkerTask(
|
|
14038
|
+
const task = new WorkerTask(
|
|
14039
|
+
"START_PENDING_QUERY" /* START_PENDING_QUERY */,
|
|
14040
|
+
[conn, text]
|
|
14041
|
+
);
|
|
13946
14042
|
return await this.postTask(task);
|
|
13947
14043
|
}
|
|
13948
14044
|
async pollPendingQuery(conn) {
|
|
13949
|
-
const task = new WorkerTask(
|
|
14045
|
+
const task = new WorkerTask(
|
|
14046
|
+
"POLL_PENDING_QUERY" /* POLL_PENDING_QUERY */,
|
|
14047
|
+
conn
|
|
14048
|
+
);
|
|
13950
14049
|
return await this.postTask(task);
|
|
13951
14050
|
}
|
|
13952
14051
|
async cancelPendingQuery(conn) {
|
|
13953
|
-
const task = new WorkerTask(
|
|
14052
|
+
const task = new WorkerTask(
|
|
14053
|
+
"CANCEL_PENDING_QUERY" /* CANCEL_PENDING_QUERY */,
|
|
14054
|
+
conn
|
|
14055
|
+
);
|
|
13954
14056
|
return await this.postTask(task);
|
|
13955
14057
|
}
|
|
13956
14058
|
async fetchQueryResults(conn) {
|
|
13957
|
-
const task = new WorkerTask(
|
|
14059
|
+
const task = new WorkerTask(
|
|
14060
|
+
"FETCH_QUERY_RESULTS" /* FETCH_QUERY_RESULTS */,
|
|
14061
|
+
conn
|
|
14062
|
+
);
|
|
13958
14063
|
return await this.postTask(task);
|
|
13959
14064
|
}
|
|
13960
14065
|
async getTableNames(conn, text) {
|
|
13961
|
-
const task = new WorkerTask(
|
|
14066
|
+
const task = new WorkerTask(
|
|
14067
|
+
"GET_TABLE_NAMES" /* GET_TABLE_NAMES */,
|
|
14068
|
+
[conn, text]
|
|
14069
|
+
);
|
|
13962
14070
|
return await this.postTask(task);
|
|
13963
14071
|
}
|
|
13964
14072
|
async createPrepared(conn, text) {
|
|
13965
|
-
const task = new WorkerTask(
|
|
14073
|
+
const task = new WorkerTask(
|
|
14074
|
+
"CREATE_PREPARED" /* CREATE_PREPARED */,
|
|
14075
|
+
[conn, text]
|
|
14076
|
+
);
|
|
13966
14077
|
return await this.postTask(task);
|
|
13967
14078
|
}
|
|
13968
14079
|
async closePrepared(conn, statement) {
|
|
13969
|
-
const task = new WorkerTask(
|
|
14080
|
+
const task = new WorkerTask(
|
|
14081
|
+
"CLOSE_PREPARED" /* CLOSE_PREPARED */,
|
|
14082
|
+
[conn, statement]
|
|
14083
|
+
);
|
|
13970
14084
|
await this.postTask(task);
|
|
13971
14085
|
}
|
|
13972
14086
|
async runPrepared(conn, statement, params) {
|
|
13973
|
-
const task = new WorkerTask(
|
|
14087
|
+
const task = new WorkerTask(
|
|
14088
|
+
"RUN_PREPARED" /* RUN_PREPARED */,
|
|
14089
|
+
[conn, statement, params]
|
|
14090
|
+
);
|
|
13974
14091
|
return await this.postTask(task);
|
|
13975
14092
|
}
|
|
13976
14093
|
async sendPrepared(conn, statement, params) {
|
|
13977
|
-
const task = new WorkerTask(
|
|
14094
|
+
const task = new WorkerTask(
|
|
14095
|
+
"SEND_PREPARED" /* SEND_PREPARED */,
|
|
14096
|
+
[conn, statement, params]
|
|
14097
|
+
);
|
|
13978
14098
|
return await this.postTask(task);
|
|
13979
14099
|
}
|
|
13980
14100
|
async globFiles(path2) {
|
|
13981
|
-
const task = new WorkerTask(
|
|
14101
|
+
const task = new WorkerTask(
|
|
14102
|
+
"GLOB_FILE_INFOS" /* GLOB_FILE_INFOS */,
|
|
14103
|
+
path2
|
|
14104
|
+
);
|
|
13982
14105
|
return await this.postTask(task);
|
|
13983
14106
|
}
|
|
13984
14107
|
async registerFileText(name, text) {
|
|
@@ -13989,35 +14112,59 @@ var AsyncDuckDB = class {
|
|
|
13989
14112
|
if (url === void 0) {
|
|
13990
14113
|
url = name;
|
|
13991
14114
|
}
|
|
13992
|
-
const task = new WorkerTask(
|
|
14115
|
+
const task = new WorkerTask(
|
|
14116
|
+
"REGISTER_FILE_URL" /* REGISTER_FILE_URL */,
|
|
14117
|
+
[name, url]
|
|
14118
|
+
);
|
|
13993
14119
|
await this.postTask(task);
|
|
13994
14120
|
}
|
|
13995
14121
|
async registerEmptyFileBuffer(name) {
|
|
13996
|
-
const task = new WorkerTask(
|
|
14122
|
+
const task = new WorkerTask(
|
|
14123
|
+
"REGISTER_FILE_BUFFER" /* REGISTER_FILE_BUFFER */,
|
|
14124
|
+
[name, new Uint8Array()]
|
|
14125
|
+
);
|
|
13997
14126
|
await this.postTask(task);
|
|
13998
14127
|
}
|
|
13999
14128
|
async registerFileBuffer(name, buffer) {
|
|
14000
|
-
const task = new WorkerTask(
|
|
14129
|
+
const task = new WorkerTask(
|
|
14130
|
+
"REGISTER_FILE_BUFFER" /* REGISTER_FILE_BUFFER */,
|
|
14131
|
+
[name, buffer]
|
|
14132
|
+
);
|
|
14001
14133
|
await this.postTask(task, [buffer.buffer]);
|
|
14002
14134
|
}
|
|
14003
14135
|
async registerFileHandle(name, handle) {
|
|
14004
|
-
const task = new WorkerTask(
|
|
14136
|
+
const task = new WorkerTask(
|
|
14137
|
+
"REGISTER_FILE_HANDLE" /* REGISTER_FILE_HANDLE */,
|
|
14138
|
+
[name, handle]
|
|
14139
|
+
);
|
|
14005
14140
|
await this.postTask(task, []);
|
|
14006
14141
|
}
|
|
14007
14142
|
async collectFileStatistics(name, enable) {
|
|
14008
|
-
const task = new WorkerTask(
|
|
14143
|
+
const task = new WorkerTask(
|
|
14144
|
+
"COLLECT_FILE_STATISTICS" /* COLLECT_FILE_STATISTICS */,
|
|
14145
|
+
[name, enable]
|
|
14146
|
+
);
|
|
14009
14147
|
await this.postTask(task, []);
|
|
14010
14148
|
}
|
|
14011
14149
|
async exportFileStatistics(name) {
|
|
14012
|
-
const task = new WorkerTask(
|
|
14150
|
+
const task = new WorkerTask(
|
|
14151
|
+
"EXPORT_FILE_STATISTICS" /* EXPORT_FILE_STATISTICS */,
|
|
14152
|
+
name
|
|
14153
|
+
);
|
|
14013
14154
|
return await this.postTask(task, []);
|
|
14014
14155
|
}
|
|
14015
14156
|
async copyFileToBuffer(name) {
|
|
14016
|
-
const task = new WorkerTask(
|
|
14157
|
+
const task = new WorkerTask(
|
|
14158
|
+
"COPY_FILE_TO_BUFFER" /* COPY_FILE_TO_BUFFER */,
|
|
14159
|
+
name
|
|
14160
|
+
);
|
|
14017
14161
|
return await this.postTask(task);
|
|
14018
14162
|
}
|
|
14019
14163
|
async copyFileToPath(name, path2) {
|
|
14020
|
-
const task = new WorkerTask(
|
|
14164
|
+
const task = new WorkerTask(
|
|
14165
|
+
"COPY_FILE_TO_PATH" /* COPY_FILE_TO_PATH */,
|
|
14166
|
+
[name, path2]
|
|
14167
|
+
);
|
|
14021
14168
|
await this.postTask(task);
|
|
14022
14169
|
}
|
|
14023
14170
|
async insertArrowFromIPCStream(conn, buffer, options) {
|
|
@@ -14036,7 +14183,10 @@ var AsyncDuckDB = class {
|
|
|
14036
14183
|
options.columnsFlat = out;
|
|
14037
14184
|
delete options.columns;
|
|
14038
14185
|
}
|
|
14039
|
-
const task = new WorkerTask(
|
|
14186
|
+
const task = new WorkerTask(
|
|
14187
|
+
"IMPORT_CSV_FROM_PATH" /* INSERT_CSV_FROM_PATH */,
|
|
14188
|
+
[conn, path2, options]
|
|
14189
|
+
);
|
|
14040
14190
|
await this.postTask(task);
|
|
14041
14191
|
}
|
|
14042
14192
|
async insertJSONFromPath(conn, path2, options) {
|
|
@@ -14049,7 +14199,10 @@ var AsyncDuckDB = class {
|
|
|
14049
14199
|
options.columnsFlat = out;
|
|
14050
14200
|
delete options.columns;
|
|
14051
14201
|
}
|
|
14052
|
-
const task = new WorkerTask(
|
|
14202
|
+
const task = new WorkerTask(
|
|
14203
|
+
"IMPORT_JSON_FROM_PATH" /* INSERT_JSON_FROM_PATH */,
|
|
14204
|
+
[conn, path2, options]
|
|
14205
|
+
);
|
|
14053
14206
|
await this.postTask(task);
|
|
14054
14207
|
}
|
|
14055
14208
|
};
|
|
@@ -14378,11 +14531,61 @@ function testBindings(db2, baseURL) {
|
|
|
14378
14531
|
i VARCHAR(11) DEFAULT NULL
|
|
14379
14532
|
)`);
|
|
14380
14533
|
const stmt = conn.prepare("INSERT INTO typecheck VALUES(?,?,?,?,?,?,?,?,?)");
|
|
14381
|
-
expect(
|
|
14382
|
-
|
|
14383
|
-
|
|
14384
|
-
expect(
|
|
14385
|
-
|
|
14534
|
+
expect(
|
|
14535
|
+
() => stmt.query(true, 100, 1e4, 1e6, 5e9, 0.5, Math.PI, "hello world", "hi")
|
|
14536
|
+
).not.toThrow();
|
|
14537
|
+
expect(
|
|
14538
|
+
() => stmt.query(
|
|
14539
|
+
"test",
|
|
14540
|
+
100,
|
|
14541
|
+
1e4,
|
|
14542
|
+
1e6,
|
|
14543
|
+
5e9,
|
|
14544
|
+
0.5,
|
|
14545
|
+
Math.PI,
|
|
14546
|
+
"hello world",
|
|
14547
|
+
"hi"
|
|
14548
|
+
)
|
|
14549
|
+
).toThrow();
|
|
14550
|
+
expect(
|
|
14551
|
+
() => stmt.query(
|
|
14552
|
+
true,
|
|
14553
|
+
1e4,
|
|
14554
|
+
1e4,
|
|
14555
|
+
1e6,
|
|
14556
|
+
5e9,
|
|
14557
|
+
0.5,
|
|
14558
|
+
Math.PI,
|
|
14559
|
+
"hello world",
|
|
14560
|
+
"hi"
|
|
14561
|
+
)
|
|
14562
|
+
).toThrow();
|
|
14563
|
+
expect(
|
|
14564
|
+
() => stmt.query(
|
|
14565
|
+
true,
|
|
14566
|
+
100,
|
|
14567
|
+
1e6,
|
|
14568
|
+
1e6,
|
|
14569
|
+
5e9,
|
|
14570
|
+
0.5,
|
|
14571
|
+
Math.PI,
|
|
14572
|
+
"hello world",
|
|
14573
|
+
"hi"
|
|
14574
|
+
)
|
|
14575
|
+
).toThrow();
|
|
14576
|
+
expect(
|
|
14577
|
+
() => stmt.query(
|
|
14578
|
+
true,
|
|
14579
|
+
100,
|
|
14580
|
+
1e4,
|
|
14581
|
+
5e9,
|
|
14582
|
+
5e9,
|
|
14583
|
+
0.5,
|
|
14584
|
+
Math.PI,
|
|
14585
|
+
"hello world",
|
|
14586
|
+
"hi"
|
|
14587
|
+
)
|
|
14588
|
+
).toThrow();
|
|
14386
14589
|
conn.close();
|
|
14387
14590
|
});
|
|
14388
14591
|
});
|
|
@@ -14482,16 +14685,56 @@ function testAsyncBindings(adb2, baseURL) {
|
|
|
14482
14685
|
expect(throwed).toBe(true);
|
|
14483
14686
|
};
|
|
14484
14687
|
expectToThrow(async () => {
|
|
14485
|
-
await stmt.query(
|
|
14688
|
+
await stmt.query(
|
|
14689
|
+
"test",
|
|
14690
|
+
100,
|
|
14691
|
+
1e4,
|
|
14692
|
+
1e6,
|
|
14693
|
+
5e9,
|
|
14694
|
+
0.5,
|
|
14695
|
+
Math.PI,
|
|
14696
|
+
"hello world",
|
|
14697
|
+
"hi"
|
|
14698
|
+
);
|
|
14486
14699
|
});
|
|
14487
14700
|
expectToThrow(async () => {
|
|
14488
|
-
await stmt.query(
|
|
14701
|
+
await stmt.query(
|
|
14702
|
+
true,
|
|
14703
|
+
1e4,
|
|
14704
|
+
1e4,
|
|
14705
|
+
1e6,
|
|
14706
|
+
5e9,
|
|
14707
|
+
0.5,
|
|
14708
|
+
Math.PI,
|
|
14709
|
+
"hello world",
|
|
14710
|
+
"hi"
|
|
14711
|
+
);
|
|
14489
14712
|
});
|
|
14490
14713
|
expectToThrow(async () => {
|
|
14491
|
-
await stmt.query(
|
|
14714
|
+
await stmt.query(
|
|
14715
|
+
true,
|
|
14716
|
+
100,
|
|
14717
|
+
1e6,
|
|
14718
|
+
1e6,
|
|
14719
|
+
5e9,
|
|
14720
|
+
0.5,
|
|
14721
|
+
Math.PI,
|
|
14722
|
+
"hello world",
|
|
14723
|
+
"hi"
|
|
14724
|
+
);
|
|
14492
14725
|
});
|
|
14493
14726
|
expectToThrow(async () => {
|
|
14494
|
-
await stmt.query(
|
|
14727
|
+
await stmt.query(
|
|
14728
|
+
true,
|
|
14729
|
+
100,
|
|
14730
|
+
1e4,
|
|
14731
|
+
5e9,
|
|
14732
|
+
5e9,
|
|
14733
|
+
0.5,
|
|
14734
|
+
Math.PI,
|
|
14735
|
+
"hello world",
|
|
14736
|
+
"hi"
|
|
14737
|
+
);
|
|
14495
14738
|
});
|
|
14496
14739
|
await conn.close();
|
|
14497
14740
|
});
|
|
@@ -14505,7 +14748,7 @@ function testAsyncBindings(adb2, baseURL) {
|
|
|
14505
14748
|
}
|
|
14506
14749
|
});
|
|
14507
14750
|
const conn = await adb2().connect();
|
|
14508
|
-
const result = await conn.useUnsafe((db2, id) => db2.startPendingQuery(id, "
|
|
14751
|
+
const result = await conn.useUnsafe((db2, id) => db2.startPendingQuery(id, "SELECT SUM(i) FROM range(1000000) tbl(i);"));
|
|
14509
14752
|
expect(result).toBeNull();
|
|
14510
14753
|
const cancelOK = await conn.useUnsafe((db2, id) => db2.cancelPendingQuery(id));
|
|
14511
14754
|
expect(cancelOK).toBeTrue();
|
|
@@ -14521,6 +14764,8 @@ function testAsyncBindings(adb2, baseURL) {
|
|
|
14521
14764
|
expect(polledError.toString()).toEqual("Error: query was canceled");
|
|
14522
14765
|
const canceledAgain = await conn.useUnsafe((db2, id) => db2.cancelPendingQuery(id));
|
|
14523
14766
|
expect(canceledAgain).toBeFalse();
|
|
14767
|
+
const table = await conn.query("select 42::integer;");
|
|
14768
|
+
expect(table.schema.fields.length).toEqual(1);
|
|
14524
14769
|
});
|
|
14525
14770
|
it("noop cancel", async () => {
|
|
14526
14771
|
await adb2().open({
|
|
@@ -14530,7 +14775,7 @@ function testAsyncBindings(adb2, baseURL) {
|
|
|
14530
14775
|
}
|
|
14531
14776
|
});
|
|
14532
14777
|
const conn = await adb2().connect();
|
|
14533
|
-
const result = await conn.useUnsafe((db2, id) => db2.startPendingQuery(id, "
|
|
14778
|
+
const result = await conn.useUnsafe((db2, id) => db2.startPendingQuery(id, "SELECT SUM(i) FROM range(1000000) tbl(i);"));
|
|
14534
14779
|
expect(result).toBeNull();
|
|
14535
14780
|
let polledHeader = null;
|
|
14536
14781
|
let polledError = null;
|
|
@@ -14834,7 +15079,9 @@ function testFilesystem(db2, resolveData2, baseDir) {
|
|
|
14834
15079
|
batches.push(batch);
|
|
14835
15080
|
}
|
|
14836
15081
|
const table = await new arrow5.Table(batches);
|
|
14837
|
-
expect((_a = table.getChildAt(0)) == null ? void 0 : _a.toArray()).toEqual(
|
|
15082
|
+
expect((_a = table.getChildAt(0)) == null ? void 0 : _a.toArray()).toEqual(
|
|
15083
|
+
new Int32Array([24002, 25403, 26120, 26830, 27550, 28106, 29120, 29555])
|
|
15084
|
+
);
|
|
14838
15085
|
};
|
|
14839
15086
|
it("File buffer used once", async () => {
|
|
14840
15087
|
const students = await resolveData2("/uni/studenten.parquet");
|
|
@@ -14872,7 +15119,9 @@ function testFilesystem(db2, resolveData2, baseDir) {
|
|
|
14872
15119
|
batches.push(batch);
|
|
14873
15120
|
}
|
|
14874
15121
|
const table = await new arrow5.Table(batches);
|
|
14875
|
-
expect((_a = table.getChildAt(0)) == null ? void 0 : _a.toArray()).toEqual(
|
|
15122
|
+
expect((_a = table.getChildAt(0)) == null ? void 0 : _a.toArray()).toEqual(
|
|
15123
|
+
new Int32Array([24002, 25403, 26120, 26830, 27550, 28106, 29120, 29555])
|
|
15124
|
+
);
|
|
14876
15125
|
});
|
|
14877
15126
|
it("simple join", async () => {
|
|
14878
15127
|
var _a;
|
|
@@ -14970,7 +15219,9 @@ function testFilesystem(db2, resolveData2, baseDir) {
|
|
|
14970
15219
|
batches.push(batch);
|
|
14971
15220
|
}
|
|
14972
15221
|
const table = await new arrow5.Table(batches);
|
|
14973
|
-
expect((_a = table.getChildAt(0)) == null ? void 0 : _a.toArray()).toEqual(
|
|
15222
|
+
expect((_a = table.getChildAt(0)) == null ? void 0 : _a.toArray()).toEqual(
|
|
15223
|
+
new Int32Array([24002, 25403, 26120, 26830, 27550, 28106, 29120, 29555])
|
|
15224
|
+
);
|
|
14974
15225
|
});
|
|
14975
15226
|
});
|
|
14976
15227
|
describe("File access", () => {
|
|
@@ -14983,7 +15234,9 @@ function testFilesystem(db2, resolveData2, baseDir) {
|
|
|
14983
15234
|
batches.push(batch);
|
|
14984
15235
|
}
|
|
14985
15236
|
const table = await new arrow5.Table(batches);
|
|
14986
|
-
expect((_a = table.getChildAt(0)) == null ? void 0 : _a.toArray()).toEqual(
|
|
15237
|
+
expect((_a = table.getChildAt(0)) == null ? void 0 : _a.toArray()).toEqual(
|
|
15238
|
+
new Int32Array([24002, 25403, 26120, 26830, 27550, 28106, 29120, 29555])
|
|
15239
|
+
);
|
|
14987
15240
|
});
|
|
14988
15241
|
it("Large Parquet file", async () => {
|
|
14989
15242
|
var _a;
|
|
@@ -15019,7 +15272,9 @@ function testFilesystem(db2, resolveData2, baseDir) {
|
|
|
15019
15272
|
const load_script = decoder.decode(load_script_utf8);
|
|
15020
15273
|
const schema_script = decoder.decode(schema_script_utf8);
|
|
15021
15274
|
const csv_buffer = decoder.decode(csv_buffer_utf8);
|
|
15022
|
-
expect(load_script.trim()).toEqual(
|
|
15275
|
+
expect(load_script.trim()).toEqual(
|
|
15276
|
+
`COPY foo FROM '/tmp/duckdbexportcsv/foo.csv' (FORMAT 'csv', quote '"', delimiter ',', header 0);`
|
|
15277
|
+
);
|
|
15023
15278
|
expect(schema_script.trim()).toEqual(`CREATE TABLE foo(v BIGINT);`);
|
|
15024
15279
|
expect(csv_buffer.trim()).toEqual(`1
|
|
15025
15280
|
2
|
|
@@ -15046,7 +15301,9 @@ function testFilesystem(db2, resolveData2, baseDir) {
|
|
|
15046
15301
|
expect(load_script_utf8.length).not.toEqual(0);
|
|
15047
15302
|
expect(schema_script_utf8.length).not.toEqual(0);
|
|
15048
15303
|
expect(parquet_buffer.length).not.toEqual(0);
|
|
15049
|
-
const content = await conn.query(
|
|
15304
|
+
const content = await conn.query(
|
|
15305
|
+
`SELECT v::integer FROM parquet_scan('/tmp/duckdbexportparquet/foo.parquet')`
|
|
15306
|
+
);
|
|
15050
15307
|
expect(content.nullCount).toEqual(0);
|
|
15051
15308
|
expect(content.numRows).toEqual(5);
|
|
15052
15309
|
expect((_a = content.getChildAt(0)) == null ? void 0 : _a.toArray()).toEqual(new Int32Array([1, 2, 3, 4, 5]));
|
|
@@ -15055,7 +15312,9 @@ function testFilesystem(db2, resolveData2, baseDir) {
|
|
|
15055
15312
|
describe("Copy", () => {
|
|
15056
15313
|
it("Generate Series as Parquet", async () => {
|
|
15057
15314
|
var _a;
|
|
15058
|
-
await conn.query(
|
|
15315
|
+
await conn.query(
|
|
15316
|
+
`COPY (SELECT * FROM generate_series(1, 5) t(v)) TO '/tmp/duckdbcopytest.parquet' (FORMAT 'parquet')`
|
|
15317
|
+
);
|
|
15059
15318
|
const results = await db2().globFiles("/tmp/duckdbcopytest*");
|
|
15060
15319
|
expect(results).not.toEqual([]);
|
|
15061
15320
|
expect(results.length).toEqual(1);
|
|
@@ -16055,7 +16314,9 @@ function testUDF(db2) {
|
|
|
16055
16314
|
it("simple", async () => {
|
|
16056
16315
|
var _a, _b;
|
|
16057
16316
|
conn.createScalarFunction("jsudf", new import_apache_arrow2.Int32(), (a) => a);
|
|
16058
|
-
const result = conn.query(
|
|
16317
|
+
const result = conn.query(
|
|
16318
|
+
"SELECT max(jsudf(v::INTEGER))::INTEGER as foo FROM generate_series(1, 10000) as t(v)"
|
|
16319
|
+
);
|
|
16059
16320
|
expect(result.numRows).toEqual(1);
|
|
16060
16321
|
expect(result.numCols).toEqual(1);
|
|
16061
16322
|
expect((_a = result.getChildAt(0)) == null ? void 0 : _a.length).toEqual(1);
|
|
@@ -16064,7 +16325,9 @@ function testUDF(db2) {
|
|
|
16064
16325
|
it("double", async () => {
|
|
16065
16326
|
var _a, _b;
|
|
16066
16327
|
conn.createScalarFunction("jsudf2", new import_apache_arrow2.Float64(), (a) => a);
|
|
16067
|
-
const result = conn.query(
|
|
16328
|
+
const result = conn.query(
|
|
16329
|
+
"SELECT max(jsudf2(v::DOUBLE))::DOUBLE as foo FROM generate_series(1, 10000) as t(v)"
|
|
16330
|
+
);
|
|
16068
16331
|
expect(result.numRows).toEqual(1);
|
|
16069
16332
|
expect(result.numCols).toEqual(1);
|
|
16070
16333
|
expect((_a = result.getChildAt(0)) == null ? void 0 : _a.length).toEqual(1);
|
|
@@ -16073,7 +16336,9 @@ function testUDF(db2) {
|
|
|
16073
16336
|
it("2 args", async () => {
|
|
16074
16337
|
var _a, _b;
|
|
16075
16338
|
conn.createScalarFunction("jsudf3", new import_apache_arrow2.Int32(), (a, b) => a + b);
|
|
16076
|
-
const result = conn.query(
|
|
16339
|
+
const result = conn.query(
|
|
16340
|
+
"SELECT max(jsudf3(v::INTEGER, v::INTEGER))::INTEGER as foo FROM generate_series(1, 10000) as t(v)"
|
|
16341
|
+
);
|
|
16077
16342
|
expect(result.numRows).toEqual(1);
|
|
16078
16343
|
expect(result.numCols).toEqual(1);
|
|
16079
16344
|
expect((_a = result.getChildAt(0)) == null ? void 0 : _a.length).toEqual(1);
|
|
@@ -16082,7 +16347,9 @@ function testUDF(db2) {
|
|
|
16082
16347
|
it("3 args", async () => {
|
|
16083
16348
|
var _a, _b;
|
|
16084
16349
|
conn.createScalarFunction("jsudf3args", new import_apache_arrow2.Int32(), (a, b, c) => a + b + c);
|
|
16085
|
-
const result = conn.query(
|
|
16350
|
+
const result = conn.query(
|
|
16351
|
+
"SELECT max(jsudf3args(v::INTEGER, v::INTEGER, v::INTEGER))::INTEGER as foo FROM generate_series(1, 10000) as t(v)"
|
|
16352
|
+
);
|
|
16086
16353
|
expect(result.numRows).toEqual(1);
|
|
16087
16354
|
expect(result.numCols).toEqual(1);
|
|
16088
16355
|
expect((_a = result.getChildAt(0)) == null ? void 0 : _a.length).toEqual(1);
|
|
@@ -16091,7 +16358,9 @@ function testUDF(db2) {
|
|
|
16091
16358
|
it("4 args", async () => {
|
|
16092
16359
|
var _a, _b;
|
|
16093
16360
|
conn.createScalarFunction("jsudf4args", new import_apache_arrow2.Int32(), (a, b, c, d) => a + b + c + d);
|
|
16094
|
-
const result = conn.query(
|
|
16361
|
+
const result = conn.query(
|
|
16362
|
+
"SELECT max(jsudf4args(v::INTEGER, v::INTEGER, v::INTEGER, v::INTEGER))::INTEGER as foo FROM generate_series(1, 10000) as t(v)"
|
|
16363
|
+
);
|
|
16095
16364
|
expect(result.numRows).toEqual(1);
|
|
16096
16365
|
expect(result.numCols).toEqual(1);
|
|
16097
16366
|
expect((_a = result.getChildAt(0)) == null ? void 0 : _a.length).toEqual(1);
|
|
@@ -16109,7 +16378,9 @@ function testUDF(db2) {
|
|
|
16109
16378
|
it("withnulls", async () => {
|
|
16110
16379
|
var _a, _b;
|
|
16111
16380
|
conn.createScalarFunction("jsudf5", new import_apache_arrow2.Int32(), (a) => a == null ? -100 : a);
|
|
16112
|
-
const result = conn.query(
|
|
16381
|
+
const result = conn.query(
|
|
16382
|
+
"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)"
|
|
16383
|
+
);
|
|
16113
16384
|
expect(result.numRows).toEqual(1);
|
|
16114
16385
|
expect(result.numCols).toEqual(1);
|
|
16115
16386
|
expect((_a = result.getChildAt(0)) == null ? void 0 : _a.length).toEqual(1);
|
|
@@ -16121,7 +16392,9 @@ function testUDF(db2) {
|
|
|
16121
16392
|
return s.length;
|
|
16122
16393
|
}
|
|
16123
16394
|
conn.createScalarFunction("jsudf6", new import_apache_arrow2.Int32(), jsudf6);
|
|
16124
|
-
const result = conn.query(
|
|
16395
|
+
const result = conn.query(
|
|
16396
|
+
"SELECT max(jsudf6('str_' || v))::INTEGER as foo FROM generate_series(1, 10000) as t(v)"
|
|
16397
|
+
);
|
|
16125
16398
|
expect(result.numRows).toEqual(1);
|
|
16126
16399
|
expect(result.numCols).toEqual(1);
|
|
16127
16400
|
expect((_a = result.getChildAt(0)) == null ? void 0 : _a.length).toEqual(1);
|
|
@@ -16137,7 +16410,9 @@ function testUDF(db2) {
|
|
|
16137
16410
|
}
|
|
16138
16411
|
}
|
|
16139
16412
|
conn.createScalarFunction("jsudf7", new import_apache_arrow2.Int32(), jsudf7);
|
|
16140
|
-
const result = conn.query(
|
|
16413
|
+
const result = conn.query(
|
|
16414
|
+
"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)"
|
|
16415
|
+
);
|
|
16141
16416
|
expect(result.numRows).toEqual(1);
|
|
16142
16417
|
expect(result.numCols).toEqual(1);
|
|
16143
16418
|
expect((_a = result.getChildAt(0)) == null ? void 0 : _a.length).toEqual(1);
|
|
@@ -16146,7 +16421,9 @@ function testUDF(db2) {
|
|
|
16146
16421
|
it("nullintreturn", async () => {
|
|
16147
16422
|
var _a, _b;
|
|
16148
16423
|
conn.createScalarFunction("jsudf8", new import_apache_arrow2.Int32(), (a) => void 0);
|
|
16149
|
-
const result = conn.query(
|
|
16424
|
+
const result = conn.query(
|
|
16425
|
+
"SELECT max(COALESCE(jsudf8(v::INTEGER), 42))::INTEGER as foo FROM generate_series(1, 10000) as t(v)"
|
|
16426
|
+
);
|
|
16150
16427
|
expect(result.numRows).toEqual(1);
|
|
16151
16428
|
expect(result.numCols).toEqual(1);
|
|
16152
16429
|
expect((_a = result.getChildAt(0)) == null ? void 0 : _a.length).toEqual(1);
|
|
@@ -16155,7 +16432,9 @@ function testUDF(db2) {
|
|
|
16155
16432
|
it("stringreturn", async () => {
|
|
16156
16433
|
var _a, _b;
|
|
16157
16434
|
conn.createScalarFunction("jsudf9", new import_apache_arrow2.Utf8(), (a) => "Hello " + a);
|
|
16158
|
-
const result = conn.query(
|
|
16435
|
+
const result = conn.query(
|
|
16436
|
+
"SELECT max(LENGTH(jsudf9(v::INTEGER)))::INTEGER as foo FROM generate_series(1, 10000) as t(v)"
|
|
16437
|
+
);
|
|
16159
16438
|
expect(result.numRows).toEqual(1);
|
|
16160
16439
|
expect(result.numCols).toEqual(1);
|
|
16161
16440
|
expect((_a = result.getChildAt(0)) == null ? void 0 : _a.length).toEqual(1);
|
|
@@ -16164,7 +16443,9 @@ function testUDF(db2) {
|
|
|
16164
16443
|
it("nullstringreturn", async () => {
|
|
16165
16444
|
var _a, _b;
|
|
16166
16445
|
conn.createScalarFunction("jsudf10", new import_apache_arrow2.Utf8(), (a) => a % 2 == 0 ? "Hello" : void 0);
|
|
16167
|
-
const result = conn.query(
|
|
16446
|
+
const result = conn.query(
|
|
16447
|
+
"SELECT COUNT(jsudf10(v::INTEGER))::INTEGER as foo FROM generate_series(1, 10000) as t(v)"
|
|
16448
|
+
);
|
|
16168
16449
|
expect(result.numRows).toEqual(1);
|
|
16169
16450
|
expect(result.numCols).toEqual(1);
|
|
16170
16451
|
expect((_a = result.getChildAt(0)) == null ? void 0 : _a.length).toEqual(1);
|
|
@@ -16173,7 +16454,9 @@ function testUDF(db2) {
|
|
|
16173
16454
|
it("struct", async () => {
|
|
16174
16455
|
var _a, _b;
|
|
16175
16456
|
conn.createScalarFunction("jsudf11", new import_apache_arrow2.Int32(), (a) => a.x == null ? -100 : a.x);
|
|
16176
|
-
const result = conn.query(
|
|
16457
|
+
const result = conn.query(
|
|
16458
|
+
`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)`
|
|
16459
|
+
);
|
|
16177
16460
|
expect(result.numRows).toEqual(1);
|
|
16178
16461
|
expect(result.numCols).toEqual(1);
|
|
16179
16462
|
expect((_a = result.getChildAt(0)) == null ? void 0 : _a.length).toEqual(1);
|
|
@@ -16182,7 +16465,9 @@ function testUDF(db2) {
|
|
|
16182
16465
|
it("structnested", async () => {
|
|
16183
16466
|
var _a, _b;
|
|
16184
16467
|
conn.createScalarFunction("jsudf12", new import_apache_arrow2.Int32(), (a) => a.x.y == null ? -100 : a.x.y);
|
|
16185
|
-
const result = conn.query(
|
|
16468
|
+
const result = conn.query(
|
|
16469
|
+
`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)`
|
|
16470
|
+
);
|
|
16186
16471
|
expect(result.numRows).toEqual(1);
|
|
16187
16472
|
expect(result.numCols).toEqual(1);
|
|
16188
16473
|
expect((_a = result.getChildAt(0)) == null ? void 0 : _a.length).toEqual(1);
|
|
@@ -16194,7 +16479,9 @@ function testUDF(db2) {
|
|
|
16194
16479
|
var _a2;
|
|
16195
16480
|
return ((_a2 = a.x) == null ? void 0 : _a2.y) == null ? -100 : a.x.y;
|
|
16196
16481
|
});
|
|
16197
|
-
const result = conn.query(
|
|
16482
|
+
const result = conn.query(
|
|
16483
|
+
`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)`
|
|
16484
|
+
);
|
|
16198
16485
|
expect(result.numRows).toEqual(1);
|
|
16199
16486
|
expect(result.numCols).toEqual(1);
|
|
16200
16487
|
expect((_a = result.getChildAt(0)) == null ? void 0 : _a.length).toEqual(1);
|
|
@@ -16217,7 +16504,9 @@ function test332(db2) {
|
|
|
16217
16504
|
});
|
|
16218
16505
|
describe("GitHub issues", () => {
|
|
16219
16506
|
it("332", async () => {
|
|
16220
|
-
await db2().registerFileText(
|
|
16507
|
+
await db2().registerFileText(
|
|
16508
|
+
"Products.csv",
|
|
16509
|
+
`ProductGroup,Product,Year,Quarter,Revenue,Units,Count,Product Key,Reseller,Product Info,QuarterAsNumber
|
|
16221
16510
|
Electronics,Phone,2018,Q1,103,7,1,2018-Q1,Sony,Format=XML; <Properties>\u2026,1
|
|
16222
16511
|
Electronics,Phone,2018,Q1,102,4,1,2018-Q1,Sony,Format=XML; <Properties>\u2026,1
|
|
16223
16512
|
Electronics,Phone,2019,Q1,98,12,1,2019-Q1,Sony,Format=XML; <Properties>\u2026,1
|
|
@@ -16263,7 +16552,8 @@ Electronics,Computer,2020,Q4,104,3,1,2020-Q4,LG,Format=XML; <Properties>\u2026,4
|
|
|
16263
16552
|
Electronics,Computer,2020,Q1,83,7,1,2020-Q1,Sony,Format=XML; <Properties>\u2026,1
|
|
16264
16553
|
Media,Theater,2020,Q1,17,4,1,2020-Q1,Microsoft,Format=XML; <Properties>\u2026,1
|
|
16265
16554
|
Media,Theater,2020,Q1,20,7,1,2020-Q1,Sony,Format=XML; <Properties>\u2026,1
|
|
16266
|
-
`
|
|
16555
|
+
`
|
|
16556
|
+
);
|
|
16267
16557
|
await conn.query("CREATE TABLE products AS SELECT * FROM 'Products.csv'");
|
|
16268
16558
|
const all = await conn.query("SELECT * FROM products");
|
|
16269
16559
|
expect(all.schema.fields.length).toBe(11);
|
|
@@ -16301,10 +16591,13 @@ function test334(adb2) {
|
|
|
16301
16591
|
await adb2().dropFile("data.csv");
|
|
16302
16592
|
});
|
|
16303
16593
|
it("JSON row insert", async () => {
|
|
16304
|
-
await adb2().registerFileText(
|
|
16594
|
+
await adb2().registerFileText(
|
|
16595
|
+
"rows.json",
|
|
16596
|
+
`[
|
|
16305
16597
|
{ "col1": 1, "col2": "foo" },
|
|
16306
16598
|
{ "col1": 2, "col2": "bar" },
|
|
16307
|
-
]`
|
|
16599
|
+
]`
|
|
16600
|
+
);
|
|
16308
16601
|
const conn = await adb2().connect();
|
|
16309
16602
|
await conn.insertJSONFromPath("rows.json", { name: "rows" });
|
|
16310
16603
|
await conn.query("DROP TABLE IF EXISTS rows");
|
|
@@ -16312,10 +16605,13 @@ function test334(adb2) {
|
|
|
16312
16605
|
await adb2().dropFile("rows.json");
|
|
16313
16606
|
});
|
|
16314
16607
|
it("JSON column insert", async () => {
|
|
16315
|
-
await adb2().registerFileText(
|
|
16608
|
+
await adb2().registerFileText(
|
|
16609
|
+
"columns.json",
|
|
16610
|
+
`{
|
|
16316
16611
|
"col1": [1, 2],
|
|
16317
16612
|
"col2": ["foo", "bar"]
|
|
16318
|
-
}`
|
|
16613
|
+
}`
|
|
16614
|
+
);
|
|
16319
16615
|
const conn = await adb2().connect();
|
|
16320
16616
|
await conn.insertJSONFromPath("columns.json", { name: "columns" });
|
|
16321
16617
|
await conn.query("DROP TABLE IF EXISTS columns");
|
|
@@ -16541,10 +16837,16 @@ function testFTS(db2) {
|
|
|
16541
16837
|
describe("FTS", () => {
|
|
16542
16838
|
it("sample", async () => {
|
|
16543
16839
|
var _a;
|
|
16544
|
-
await conn.query(
|
|
16545
|
-
|
|
16840
|
+
await conn.query(
|
|
16841
|
+
"CREATE TABLE documents(document_identifier VARCHAR, text_content VARCHAR, author VARCHAR, doc_version INTEGER);"
|
|
16842
|
+
);
|
|
16843
|
+
await conn.query(
|
|
16844
|
+
"INSERT INTO documents VALUES ('doc1', 'The mallard is a dabbling duck that breeds throughout the temperate.','Hannes M\xFChleisen', 3), ('doc2', 'The cat is a domestic species of small carnivorous mammal.', 'Laurens Kuiper', 2);"
|
|
16845
|
+
);
|
|
16546
16846
|
await conn.query("PRAGMA create_fts_index('documents', 'document_identifier', 'text_content', 'author');");
|
|
16547
|
-
const result = conn.query(
|
|
16847
|
+
const result = conn.query(
|
|
16848
|
+
"SELECT document_identifier, score\n FROM (SELECT *, fts_main_documents.match_bm25(document_identifier, 'Muhleisen', fields := 'author') AS score\n FROM documents) sq\n WHERE score IS NOT NULL\n AND doc_version > 2\n ORDER BY score DESC;"
|
|
16849
|
+
);
|
|
16548
16850
|
expect((_a = result.getChildAt(0)) == null ? void 0 : _a.toArray()).toEqual(["doc1"]);
|
|
16549
16851
|
});
|
|
16550
16852
|
});
|