@haybarn/node-api 1.5.6-rc1 → 2.0.0-rc3
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/README.md +315 -20
- package/lib/DuckDBAppender.d.ts +8 -2
- package/lib/DuckDBAppender.js +19 -1
- package/lib/DuckDBConnection.d.ts +2 -0
- package/lib/DuckDBConnection.js +4 -1
- package/lib/DuckDBDataChunk.d.ts +30 -0
- package/lib/DuckDBDataChunk.js +94 -1
- package/lib/DuckDBDataChunkWriter.d.ts +74 -0
- package/lib/DuckDBDataChunkWriter.js +109 -0
- package/lib/DuckDBLogicalType.d.ts +5 -1
- package/lib/DuckDBLogicalType.js +18 -1
- package/lib/DuckDBMaterializedResult.d.ts +8 -1
- package/lib/DuckDBMaterializedResult.js +22 -2
- package/lib/DuckDBPendingResult.d.ts +16 -1
- package/lib/DuckDBPendingResult.js +19 -2
- package/lib/DuckDBPreparedStatement.d.ts +4 -1
- package/lib/DuckDBPreparedStatement.js +17 -4
- package/lib/DuckDBResult.d.ts +21 -1
- package/lib/DuckDBResult.js +87 -5
- package/lib/DuckDBResultReader.d.ts +5 -0
- package/lib/DuckDBResultReader.js +9 -2
- package/lib/DuckDBScalarFunction.d.ts +9 -5
- package/lib/DuckDBScalarFunction.js +14 -5
- package/lib/DuckDBScalarFunctionBindInfo.d.ts +16 -0
- package/lib/{DuckDBBindInfo.js → DuckDBScalarFunctionBindInfo.js} +5 -3
- package/lib/DuckDBScalarFunctionInfo.d.ts +16 -0
- package/lib/{DuckDBFunctionInfo.js → DuckDBScalarFunctionInfo.js} +11 -3
- package/lib/{DuckDBBindInfo.d.ts → DuckDBScalarFunctionInitInfo.d.ts} +6 -4
- package/lib/DuckDBScalarFunctionInitInfo.js +39 -0
- package/lib/DuckDBTableFunction.d.ts +41 -0
- package/lib/DuckDBTableFunction.js +83 -0
- package/lib/DuckDBTableFunctionBindInfo.d.ts +21 -0
- package/lib/DuckDBTableFunctionBindInfo.js +54 -0
- package/lib/DuckDBTableFunctionInfo.d.ts +15 -0
- package/lib/DuckDBTableFunctionInfo.js +42 -0
- package/lib/DuckDBTableFunctionInitInfo.d.ts +22 -0
- package/lib/DuckDBTableFunctionInitInfo.js +58 -0
- package/lib/DuckDBType.d.ts +1 -373
- package/lib/DuckDBType.js +14 -927
- package/lib/DuckDBTypeId.d.ts +4 -1
- package/lib/DuckDBTypeId.js +3 -0
- package/lib/DuckDBValueConverter.d.ts +10 -0
- package/lib/DuckDBValueConverters.d.ts +27 -0
- package/lib/DuckDBValueConverters.js +128 -1
- package/lib/DuckDBVector.d.ts +1 -596
- package/lib/DuckDBVector.js +14 -2522
- package/lib/JSDuckDBValueConverter.d.ts +1 -2
- package/lib/JSDuckDBValueConverter.js +5 -2
- package/lib/JSInputTypeForTypeId.d.ts +104 -0
- package/lib/JSInputTypeForTypeId.js +3 -0
- package/lib/JSToDuckDBValueConverter.d.ts +30 -0
- package/lib/JSToDuckDBValueConverter.js +83 -0
- package/lib/JSTypeForTypeId.d.ts +91 -0
- package/lib/JSTypeForTypeId.js +3 -0
- package/lib/JsonDuckDBValueConverter.d.ts +1 -2
- package/lib/JsonDuckDBValueConverter.js +4 -1
- package/lib/JsonTypeForTypeId.d.ts +96 -0
- package/lib/JsonTypeForTypeId.js +3 -0
- package/lib/ToDuckDBValueConverter.d.ts +41 -0
- package/lib/ToDuckDBValueConverter.js +27 -0
- package/lib/ToDuckDBValueConverters.d.ts +54 -0
- package/lib/ToDuckDBValueConverters.js +199 -0
- package/lib/conversion/dateTimeStringConversion.d.ts +2 -2
- package/lib/conversion/dateTimeStringConversion.js +20 -7
- package/lib/conversion/varintDecode.d.ts +18 -0
- package/lib/conversion/varintDecode.js +42 -0
- package/lib/convertColumnsFromChunks.d.ts +1 -1
- package/lib/convertColumnsFromChunks.js +2 -2
- package/lib/createResult.d.ts +2 -1
- package/lib/createResult.js +3 -3
- package/lib/createValue.js +63 -5
- package/lib/duckdb.d.ts +15 -2
- package/lib/duckdb.js +15 -2
- package/lib/getColumnsFromChunks.d.ts +1 -1
- package/lib/getColumnsFromChunks.js +2 -2
- package/lib/getColumnsObjectFromChunks.js +3 -0
- package/lib/readValue.d.ts +22 -0
- package/lib/readValue.js +35 -0
- package/lib/typeForValue.js +21 -2
- package/lib/types/BaseDuckDBType.d.ts +11 -0
- package/lib/types/BaseDuckDBType.js +34 -0
- package/lib/types/DuckDBAnyType.d.ts +8 -0
- package/lib/types/DuckDBAnyType.js +16 -0
- package/lib/types/DuckDBArrayType.d.ts +14 -0
- package/lib/types/DuckDBArrayType.js +38 -0
- package/lib/types/DuckDBBigIntType.d.ts +12 -0
- package/lib/types/DuckDBBigIntType.js +24 -0
- package/lib/types/DuckDBBigNumType.d.ts +12 -0
- package/lib/types/DuckDBBigNumType.js +24 -0
- package/lib/types/DuckDBBitType.d.ts +8 -0
- package/lib/types/DuckDBBitType.js +16 -0
- package/lib/types/DuckDBBlobType.d.ts +8 -0
- package/lib/types/DuckDBBlobType.js +16 -0
- package/lib/types/DuckDBBooleanType.d.ts +8 -0
- package/lib/types/DuckDBBooleanType.js +16 -0
- package/lib/types/DuckDBDateType.d.ts +14 -0
- package/lib/types/DuckDBDateType.js +32 -0
- package/lib/types/DuckDBDecimalType.d.ts +14 -0
- package/lib/types/DuckDBDecimalType.js +45 -0
- package/lib/types/DuckDBDoubleType.d.ts +12 -0
- package/lib/types/DuckDBDoubleType.js +24 -0
- package/lib/types/DuckDBEnumType.d.ts +29 -0
- package/lib/types/DuckDBEnumType.js +100 -0
- package/lib/types/DuckDBFloatType.d.ts +12 -0
- package/lib/types/DuckDBFloatType.js +24 -0
- package/lib/types/DuckDBGeometryType.d.ts +19 -0
- package/lib/types/DuckDBGeometryType.js +38 -0
- package/lib/types/DuckDBHugeIntType.d.ts +12 -0
- package/lib/types/DuckDBHugeIntType.js +24 -0
- package/lib/types/DuckDBIntegerLiteralType.d.ts +8 -0
- package/lib/types/DuckDBIntegerLiteralType.js +16 -0
- package/lib/types/DuckDBIntegerType.d.ts +12 -0
- package/lib/types/DuckDBIntegerType.js +24 -0
- package/lib/types/DuckDBIntervalType.d.ts +8 -0
- package/lib/types/DuckDBIntervalType.js +16 -0
- package/lib/types/DuckDBListType.d.ts +13 -0
- package/lib/types/DuckDBListType.js +35 -0
- package/lib/types/DuckDBMapType.d.ts +14 -0
- package/lib/types/DuckDBMapType.js +38 -0
- package/lib/types/DuckDBSQLNullType.d.ts +10 -0
- package/lib/types/DuckDBSQLNullType.js +20 -0
- package/lib/types/DuckDBSmallIntType.d.ts +12 -0
- package/lib/types/DuckDBSmallIntType.js +24 -0
- package/lib/types/DuckDBStringLiteralType.d.ts +8 -0
- package/lib/types/DuckDBStringLiteralType.js +16 -0
- package/lib/types/DuckDBStructType.d.ts +29 -0
- package/lib/types/DuckDBStructType.js +86 -0
- package/lib/types/DuckDBTimeNSType.d.ts +11 -0
- package/lib/types/DuckDBTimeNSType.js +23 -0
- package/lib/types/DuckDBTimeTZType.d.ts +12 -0
- package/lib/types/DuckDBTimeTZType.js +26 -0
- package/lib/types/DuckDBTimeType.d.ts +11 -0
- package/lib/types/DuckDBTimeType.js +23 -0
- package/lib/types/DuckDBTimestampMillisecondsType.d.ts +14 -0
- package/lib/types/DuckDBTimestampMillisecondsType.js +32 -0
- package/lib/types/DuckDBTimestampNanosecondsType.d.ts +14 -0
- package/lib/types/DuckDBTimestampNanosecondsType.js +32 -0
- package/lib/types/DuckDBTimestampSecondsType.d.ts +14 -0
- package/lib/types/DuckDBTimestampSecondsType.js +32 -0
- package/lib/types/DuckDBTimestampTZNanosecondsType.d.ts +15 -0
- package/lib/types/DuckDBTimestampTZNanosecondsType.js +35 -0
- package/lib/types/DuckDBTimestampTZType.d.ts +15 -0
- package/lib/types/DuckDBTimestampTZType.js +35 -0
- package/lib/types/DuckDBTimestampType.d.ts +16 -0
- package/lib/types/DuckDBTimestampType.js +33 -0
- package/lib/types/DuckDBTinyIntType.d.ts +12 -0
- package/lib/types/DuckDBTinyIntType.js +24 -0
- package/lib/types/DuckDBType.d.ts +43 -0
- package/lib/types/DuckDBType.js +2 -0
- package/lib/types/DuckDBUBigIntType.d.ts +12 -0
- package/lib/types/DuckDBUBigIntType.js +24 -0
- package/lib/types/DuckDBUHugeIntType.d.ts +12 -0
- package/lib/types/DuckDBUHugeIntType.js +24 -0
- package/lib/types/DuckDBUIntegerType.d.ts +12 -0
- package/lib/types/DuckDBUIntegerType.js +24 -0
- package/lib/types/DuckDBUSmallIntType.d.ts +12 -0
- package/lib/types/DuckDBUSmallIntType.js +24 -0
- package/lib/types/DuckDBUTinyIntType.d.ts +12 -0
- package/lib/types/DuckDBUTinyIntType.js +24 -0
- package/lib/types/DuckDBUUIDType.d.ts +11 -0
- package/lib/types/DuckDBUUIDType.js +23 -0
- package/lib/types/DuckDBUnionType.d.ts +18 -0
- package/lib/types/DuckDBUnionType.js +64 -0
- package/lib/types/DuckDBVarCharType.d.ts +8 -0
- package/lib/types/DuckDBVarCharType.js +16 -0
- package/lib/types/DuckDBVariantType.d.ts +8 -0
- package/lib/types/DuckDBVariantType.js +16 -0
- package/lib/types/index.d.ts +44 -0
- package/lib/types/index.js +60 -0
- package/lib/values/DuckDBGeometryValue.d.ts +12 -0
- package/lib/values/DuckDBGeometryValue.js +30 -0
- package/lib/values/DuckDBTimestampTZNanosecondsValue.d.ts +14 -0
- package/lib/values/DuckDBTimestampTZNanosecondsValue.js +33 -0
- package/lib/values/DuckDBTupleValue.d.ts +11 -0
- package/lib/values/DuckDBTupleValue.js +22 -0
- package/lib/values/DuckDBUUIDValue.js +5 -1
- package/lib/values/DuckDBValue.d.ts +5 -1
- package/lib/values/DuckDBVariantValue.d.ts +19 -0
- package/lib/values/DuckDBVariantValue.js +30 -0
- package/lib/values/index.d.ts +4 -0
- package/lib/values/index.js +4 -0
- package/lib/vectors/DuckDBArrayVector.d.ts +21 -0
- package/lib/vectors/DuckDBArrayVector.js +79 -0
- package/lib/vectors/DuckDBBigIntVector.d.ts +17 -0
- package/lib/vectors/DuckDBBigIntVector.js +58 -0
- package/lib/vectors/DuckDBBigNumVector.d.ts +21 -0
- package/lib/vectors/DuckDBBigNumVector.js +70 -0
- package/lib/vectors/DuckDBBitVector.d.ts +22 -0
- package/lib/vectors/DuckDBBitVector.js +74 -0
- package/lib/vectors/DuckDBBlobVector.d.ts +32 -0
- package/lib/vectors/DuckDBBlobVector.js +83 -0
- package/lib/vectors/DuckDBBooleanVector.d.ts +18 -0
- package/lib/vectors/DuckDBBooleanVector.js +58 -0
- package/lib/vectors/DuckDBDateVector.d.ts +18 -0
- package/lib/vectors/DuckDBDateVector.js +64 -0
- package/lib/vectors/DuckDBDecimal128Vector.d.ts +21 -0
- package/lib/vectors/DuckDBDecimal128Vector.js +64 -0
- package/lib/vectors/DuckDBDecimal16Vector.d.ts +21 -0
- package/lib/vectors/DuckDBDecimal16Vector.js +64 -0
- package/lib/vectors/DuckDBDecimal32Vector.d.ts +21 -0
- package/lib/vectors/DuckDBDecimal32Vector.js +64 -0
- package/lib/vectors/DuckDBDecimal64Vector.d.ts +21 -0
- package/lib/vectors/DuckDBDecimal64Vector.js +64 -0
- package/lib/vectors/DuckDBDoubleVector.d.ts +17 -0
- package/lib/vectors/DuckDBDoubleVector.js +54 -0
- package/lib/vectors/DuckDBEnum16Vector.d.ts +18 -0
- package/lib/vectors/DuckDBEnum16Vector.js +57 -0
- package/lib/vectors/DuckDBEnum32Vector.d.ts +18 -0
- package/lib/vectors/DuckDBEnum32Vector.js +57 -0
- package/lib/vectors/DuckDBEnum8Vector.d.ts +18 -0
- package/lib/vectors/DuckDBEnum8Vector.js +57 -0
- package/lib/vectors/DuckDBFloatVector.d.ts +17 -0
- package/lib/vectors/DuckDBFloatVector.js +54 -0
- package/lib/vectors/DuckDBGeometryVector.d.ts +22 -0
- package/lib/vectors/DuckDBGeometryVector.js +69 -0
- package/lib/vectors/DuckDBHugeIntVector.d.ts +19 -0
- package/lib/vectors/DuckDBHugeIntVector.js +63 -0
- package/lib/vectors/DuckDBIntegerVector.d.ts +17 -0
- package/lib/vectors/DuckDBIntegerVector.js +61 -0
- package/lib/vectors/DuckDBIntervalVector.d.ts +19 -0
- package/lib/vectors/DuckDBIntervalVector.js +67 -0
- package/lib/vectors/DuckDBListVector.d.ts +35 -0
- package/lib/vectors/DuckDBListVector.js +151 -0
- package/lib/vectors/DuckDBMapVector.d.ts +17 -0
- package/lib/vectors/DuckDBMapVector.js +60 -0
- package/lib/vectors/DuckDBSQLNullVector.d.ts +18 -0
- package/lib/vectors/DuckDBSQLNullVector.js +44 -0
- package/lib/vectors/DuckDBSmallIntVector.d.ts +17 -0
- package/lib/vectors/DuckDBSmallIntVector.js +61 -0
- package/lib/vectors/DuckDBStructVector.d.ts +35 -0
- package/lib/vectors/DuckDBStructVector.js +105 -0
- package/lib/vectors/DuckDBTimeNSVector.d.ts +18 -0
- package/lib/vectors/DuckDBTimeNSVector.js +61 -0
- package/lib/vectors/DuckDBTimeTZVector.d.ts +18 -0
- package/lib/vectors/DuckDBTimeTZVector.js +61 -0
- package/lib/vectors/DuckDBTimeVector.d.ts +18 -0
- package/lib/vectors/DuckDBTimeVector.js +61 -0
- package/lib/vectors/DuckDBTimestampMillisecondsVector.d.ts +18 -0
- package/lib/vectors/DuckDBTimestampMillisecondsVector.js +61 -0
- package/lib/vectors/DuckDBTimestampNanosecondsVector.d.ts +18 -0
- package/lib/vectors/DuckDBTimestampNanosecondsVector.js +61 -0
- package/lib/vectors/DuckDBTimestampSecondsVector.d.ts +18 -0
- package/lib/vectors/DuckDBTimestampSecondsVector.js +61 -0
- package/lib/vectors/DuckDBTimestampTZNanosecondsVector.d.ts +18 -0
- package/lib/vectors/DuckDBTimestampTZNanosecondsVector.js +61 -0
- package/lib/vectors/DuckDBTimestampTZVector.d.ts +18 -0
- package/lib/vectors/DuckDBTimestampTZVector.js +61 -0
- package/lib/vectors/DuckDBTimestampVector.d.ts +18 -0
- package/lib/vectors/DuckDBTimestampVector.js +61 -0
- package/lib/vectors/DuckDBTinyIntVector.d.ts +17 -0
- package/lib/vectors/DuckDBTinyIntVector.js +61 -0
- package/lib/vectors/DuckDBTupleVector.d.ts +26 -0
- package/lib/vectors/DuckDBTupleVector.js +91 -0
- package/lib/vectors/DuckDBUBigIntVector.d.ts +17 -0
- package/lib/vectors/DuckDBUBigIntVector.js +58 -0
- package/lib/vectors/DuckDBUHugeIntVector.d.ts +19 -0
- package/lib/vectors/DuckDBUHugeIntVector.js +63 -0
- package/lib/vectors/DuckDBUIntegerVector.d.ts +17 -0
- package/lib/vectors/DuckDBUIntegerVector.js +61 -0
- package/lib/vectors/DuckDBUSmallIntVector.d.ts +17 -0
- package/lib/vectors/DuckDBUSmallIntVector.js +61 -0
- package/lib/vectors/DuckDBUTinyIntVector.d.ts +17 -0
- package/lib/vectors/DuckDBUTinyIntVector.js +61 -0
- package/lib/vectors/DuckDBUUIDVector.d.ts +19 -0
- package/lib/vectors/DuckDBUUIDVector.js +59 -0
- package/lib/vectors/DuckDBUnionVector.d.ts +17 -0
- package/lib/vectors/DuckDBUnionVector.js +70 -0
- package/lib/vectors/DuckDBValidity.d.ts +12 -0
- package/lib/vectors/DuckDBValidity.js +91 -0
- package/lib/vectors/DuckDBVarCharVector.d.ts +21 -0
- package/lib/vectors/DuckDBVarCharVector.js +74 -0
- package/lib/vectors/DuckDBVariantVector.d.ts +42 -0
- package/lib/vectors/DuckDBVariantVector.js +461 -0
- package/lib/vectors/DuckDBVector.d.ts +14 -0
- package/lib/vectors/DuckDBVector.js +27 -0
- package/lib/vectors/createVector.d.ts +1 -0
- package/lib/vectors/createVector.js +201 -0
- package/lib/vectors/dataAccessors.d.ts +45 -0
- package/lib/vectors/dataAccessors.js +344 -0
- package/lib/vectors/index.d.ts +47 -0
- package/lib/vectors/index.js +65 -0
- package/lib/vectors/vectorRegistry.d.ts +20 -0
- package/lib/vectors/vectorRegistry.js +16 -0
- package/package.json +3 -2
- package/lib/DuckDBFunctionInfo.d.ts +0 -10
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.DuckDBSmallIntVector = void 0;
|
|
7
|
+
const node_bindings_1 = __importDefault(require("@haybarn/node-bindings"));
|
|
8
|
+
const DuckDBType_1 = require("../DuckDBType");
|
|
9
|
+
const DuckDBVector_1 = require("./DuckDBVector");
|
|
10
|
+
const DuckDBValidity_1 = require("./DuckDBValidity");
|
|
11
|
+
const dataAccessors_1 = require("./dataAccessors");
|
|
12
|
+
class DuckDBSmallIntVector extends DuckDBVector_1.DuckDBVector {
|
|
13
|
+
items;
|
|
14
|
+
validity;
|
|
15
|
+
vector;
|
|
16
|
+
constructor(items, validity, vector) {
|
|
17
|
+
super();
|
|
18
|
+
this.items = items;
|
|
19
|
+
this.validity = validity;
|
|
20
|
+
this.vector = vector;
|
|
21
|
+
}
|
|
22
|
+
static fromRawVector(vector, itemCount) {
|
|
23
|
+
const data = (0, dataAccessors_1.vectorData)(vector, itemCount * Int16Array.BYTES_PER_ELEMENT);
|
|
24
|
+
const items = new Int16Array(data.buffer, data.byteOffset, itemCount);
|
|
25
|
+
const validity = DuckDBValidity_1.DuckDBValidity.fromVector(vector, itemCount);
|
|
26
|
+
return new DuckDBSmallIntVector(items, validity, vector);
|
|
27
|
+
}
|
|
28
|
+
get type() {
|
|
29
|
+
return DuckDBType_1.DuckDBSmallIntType.instance;
|
|
30
|
+
}
|
|
31
|
+
get itemCount() {
|
|
32
|
+
return this.items.length;
|
|
33
|
+
}
|
|
34
|
+
getItem(itemIndex) {
|
|
35
|
+
return this.validity.itemValid(itemIndex) ? this.items[itemIndex] : null;
|
|
36
|
+
}
|
|
37
|
+
setItem(itemIndex, value) {
|
|
38
|
+
if (value != null) {
|
|
39
|
+
// Checked inline for bulk-write throughput; see dataAccessors.ts.
|
|
40
|
+
if (!Number.isInteger(value)) {
|
|
41
|
+
throw new Error(`number is not an integer`);
|
|
42
|
+
}
|
|
43
|
+
if (value < -32768 || value > 32767) {
|
|
44
|
+
throw new Error(`number out of int16 range`);
|
|
45
|
+
}
|
|
46
|
+
this.items[itemIndex] = value;
|
|
47
|
+
this.validity.setItemValid(itemIndex, true);
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
this.validity.setItemValid(itemIndex, false);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
flush() {
|
|
54
|
+
node_bindings_1.default.copy_data_to_vector(this.vector, 0, this.items.buffer, this.items.byteOffset, this.items.byteLength);
|
|
55
|
+
this.validity.flush(this.vector);
|
|
56
|
+
}
|
|
57
|
+
slice(offset, length) {
|
|
58
|
+
return new DuckDBSmallIntVector(this.items.slice(offset, offset + length), this.validity.slice(offset, length), this.vector);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
exports.DuckDBSmallIntVector = DuckDBSmallIntVector;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import duckdb from '@haybarn/node-bindings';
|
|
2
|
+
import { DuckDBStructType } from '../DuckDBType';
|
|
3
|
+
import { DuckDBStructValue, DuckDBValue } from '../values';
|
|
4
|
+
import { DuckDBVector } from './DuckDBVector';
|
|
5
|
+
import { DuckDBValidity } from './DuckDBValidity';
|
|
6
|
+
export declare class DuckDBStructVector extends DuckDBVector<DuckDBStructValue> {
|
|
7
|
+
private readonly structType;
|
|
8
|
+
private readonly _itemCount;
|
|
9
|
+
private readonly entryVectors;
|
|
10
|
+
private readonly validity;
|
|
11
|
+
private readonly vector;
|
|
12
|
+
constructor(structType: DuckDBStructType, itemCount: number, entryVectors: readonly DuckDBVector[], validity: DuckDBValidity, vector: duckdb.Vector);
|
|
13
|
+
static fromRawVector(structType: DuckDBStructType, vector: duckdb.Vector, itemCount: number): DuckDBStructVector;
|
|
14
|
+
get type(): DuckDBStructType;
|
|
15
|
+
get itemCount(): number;
|
|
16
|
+
getItem(itemIndex: number): DuckDBStructValue | null;
|
|
17
|
+
getItemValue(itemIndex: number, entryIndex: number): DuckDBValue | null;
|
|
18
|
+
/**
|
|
19
|
+
* Returns the underlying child vector for entry `index`. Useful for
|
|
20
|
+
* callers that want direct access to a child's flat backing storage
|
|
21
|
+
* (e.g. when decoding a physical-layout type that overlays a STRUCT).
|
|
22
|
+
*/
|
|
23
|
+
entryVectorAt(index: number): DuckDBVector;
|
|
24
|
+
/**
|
|
25
|
+
* Returns whether the top-level row at `itemIndex` is non-NULL. Useful
|
|
26
|
+
* for callers overlaying a logical type on a STRUCT vector that need to
|
|
27
|
+
* distinguish a SQL-NULL row from a row whose children just happen to
|
|
28
|
+
* be NULL.
|
|
29
|
+
*/
|
|
30
|
+
isItemValid(itemIndex: number): boolean;
|
|
31
|
+
setItem(itemIndex: number, value: DuckDBStructValue | null): void;
|
|
32
|
+
setItemValue(itemIndex: number, entryIndex: number, value: DuckDBValue): void;
|
|
33
|
+
flush(): void;
|
|
34
|
+
slice(offset: number, length: number): DuckDBStructVector;
|
|
35
|
+
}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.DuckDBStructVector = void 0;
|
|
7
|
+
const node_bindings_1 = __importDefault(require("@haybarn/node-bindings"));
|
|
8
|
+
const values_1 = require("../values");
|
|
9
|
+
const DuckDBVector_1 = require("./DuckDBVector");
|
|
10
|
+
const DuckDBValidity_1 = require("./DuckDBValidity");
|
|
11
|
+
class DuckDBStructVector extends DuckDBVector_1.DuckDBVector {
|
|
12
|
+
structType;
|
|
13
|
+
_itemCount;
|
|
14
|
+
entryVectors;
|
|
15
|
+
validity;
|
|
16
|
+
vector;
|
|
17
|
+
constructor(structType, itemCount, entryVectors, validity, vector) {
|
|
18
|
+
super();
|
|
19
|
+
this.structType = structType;
|
|
20
|
+
this._itemCount = itemCount;
|
|
21
|
+
this.entryVectors = entryVectors;
|
|
22
|
+
this.validity = validity;
|
|
23
|
+
this.vector = vector;
|
|
24
|
+
}
|
|
25
|
+
static fromRawVector(structType, vector, itemCount) {
|
|
26
|
+
const entryCount = structType.entryCount;
|
|
27
|
+
const entryVectors = [];
|
|
28
|
+
for (let i = 0; i < entryCount; i++) {
|
|
29
|
+
const child_vector = node_bindings_1.default.struct_vector_get_child(vector, i);
|
|
30
|
+
entryVectors.push(DuckDBVector_1.DuckDBVector.create(child_vector, itemCount, structType.entryTypes[i]));
|
|
31
|
+
}
|
|
32
|
+
const validity = DuckDBValidity_1.DuckDBValidity.fromVector(vector, itemCount);
|
|
33
|
+
return new DuckDBStructVector(structType, itemCount, entryVectors, validity, vector);
|
|
34
|
+
}
|
|
35
|
+
get type() {
|
|
36
|
+
return this.structType;
|
|
37
|
+
}
|
|
38
|
+
get itemCount() {
|
|
39
|
+
return this._itemCount;
|
|
40
|
+
}
|
|
41
|
+
getItem(itemIndex) {
|
|
42
|
+
if (!this.validity.itemValid(itemIndex)) {
|
|
43
|
+
return null;
|
|
44
|
+
}
|
|
45
|
+
const entries = {};
|
|
46
|
+
const entryCount = this.structType.entryCount;
|
|
47
|
+
for (let i = 0; i < entryCount; i++) {
|
|
48
|
+
entries[this.structType.entryNames[i]] =
|
|
49
|
+
this.entryVectors[i].getItem(itemIndex);
|
|
50
|
+
}
|
|
51
|
+
return new values_1.DuckDBStructValue(entries);
|
|
52
|
+
}
|
|
53
|
+
getItemValue(itemIndex, entryIndex) {
|
|
54
|
+
if (!this.validity.itemValid(itemIndex)) {
|
|
55
|
+
return null;
|
|
56
|
+
}
|
|
57
|
+
return this.entryVectors[entryIndex].getItem(itemIndex);
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Returns the underlying child vector for entry `index`. Useful for
|
|
61
|
+
* callers that want direct access to a child's flat backing storage
|
|
62
|
+
* (e.g. when decoding a physical-layout type that overlays a STRUCT).
|
|
63
|
+
*/
|
|
64
|
+
entryVectorAt(index) {
|
|
65
|
+
return this.entryVectors[index];
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Returns whether the top-level row at `itemIndex` is non-NULL. Useful
|
|
69
|
+
* for callers overlaying a logical type on a STRUCT vector that need to
|
|
70
|
+
* distinguish a SQL-NULL row from a row whose children just happen to
|
|
71
|
+
* be NULL.
|
|
72
|
+
*/
|
|
73
|
+
isItemValid(itemIndex) {
|
|
74
|
+
return this.validity.itemValid(itemIndex);
|
|
75
|
+
}
|
|
76
|
+
setItem(itemIndex, value) {
|
|
77
|
+
if (value != null) {
|
|
78
|
+
const entryCount = this.structType.entryCount;
|
|
79
|
+
for (let i = 0; i < entryCount; i++) {
|
|
80
|
+
this.entryVectors[i].setItem(itemIndex, value.entries[this.structType.entryNames[i]]);
|
|
81
|
+
}
|
|
82
|
+
this.validity.setItemValid(itemIndex, true);
|
|
83
|
+
}
|
|
84
|
+
else {
|
|
85
|
+
const entryCount = this.structType.entryCount;
|
|
86
|
+
for (let i = 0; i < entryCount; i++) {
|
|
87
|
+
this.entryVectors[i].setItem(itemIndex, null);
|
|
88
|
+
}
|
|
89
|
+
this.validity.setItemValid(itemIndex, false);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
setItemValue(itemIndex, entryIndex, value) {
|
|
93
|
+
return this.entryVectors[entryIndex].setItem(itemIndex, value);
|
|
94
|
+
}
|
|
95
|
+
flush() {
|
|
96
|
+
for (const entryVector of this.entryVectors) {
|
|
97
|
+
entryVector.flush();
|
|
98
|
+
}
|
|
99
|
+
this.validity.flush(this.vector);
|
|
100
|
+
}
|
|
101
|
+
slice(offset, length) {
|
|
102
|
+
return new DuckDBStructVector(this.structType, length, this.entryVectors.map((entryVector) => entryVector.slice(offset, length)), this.validity.slice(offset, length), this.vector);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
exports.DuckDBStructVector = DuckDBStructVector;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import duckdb from '@haybarn/node-bindings';
|
|
2
|
+
import { DuckDBTimeNSType } from '../DuckDBType';
|
|
3
|
+
import { DuckDBTimeNSValue } from '../values';
|
|
4
|
+
import { DuckDBVector } from './DuckDBVector';
|
|
5
|
+
import { DuckDBValidity } from './DuckDBValidity';
|
|
6
|
+
export declare class DuckDBTimeNSVector extends DuckDBVector<DuckDBTimeNSValue> {
|
|
7
|
+
private readonly items;
|
|
8
|
+
private readonly validity;
|
|
9
|
+
private readonly vector;
|
|
10
|
+
constructor(items: BigInt64Array, validity: DuckDBValidity, vector: duckdb.Vector);
|
|
11
|
+
static fromRawVector(vector: duckdb.Vector, itemCount: number): DuckDBTimeNSVector;
|
|
12
|
+
get type(): DuckDBTimeNSType;
|
|
13
|
+
get itemCount(): number;
|
|
14
|
+
getItem(itemIndex: number): DuckDBTimeNSValue | null;
|
|
15
|
+
setItem(itemIndex: number, value: DuckDBTimeNSValue | null): void;
|
|
16
|
+
flush(): void;
|
|
17
|
+
slice(offset: number, length: number): DuckDBTimeNSVector;
|
|
18
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.DuckDBTimeNSVector = void 0;
|
|
7
|
+
const node_bindings_1 = __importDefault(require("@haybarn/node-bindings"));
|
|
8
|
+
const DuckDBType_1 = require("../DuckDBType");
|
|
9
|
+
const values_1 = require("../values");
|
|
10
|
+
const DuckDBVector_1 = require("./DuckDBVector");
|
|
11
|
+
const DuckDBValidity_1 = require("./DuckDBValidity");
|
|
12
|
+
const dataAccessors_1 = require("./dataAccessors");
|
|
13
|
+
class DuckDBTimeNSVector extends DuckDBVector_1.DuckDBVector {
|
|
14
|
+
items;
|
|
15
|
+
validity;
|
|
16
|
+
vector;
|
|
17
|
+
constructor(items, validity, vector) {
|
|
18
|
+
super();
|
|
19
|
+
this.items = items;
|
|
20
|
+
this.validity = validity;
|
|
21
|
+
this.vector = vector;
|
|
22
|
+
}
|
|
23
|
+
static fromRawVector(vector, itemCount) {
|
|
24
|
+
const data = (0, dataAccessors_1.vectorData)(vector, itemCount * BigInt64Array.BYTES_PER_ELEMENT);
|
|
25
|
+
const items = new BigInt64Array(data.buffer, data.byteOffset, itemCount);
|
|
26
|
+
const validity = DuckDBValidity_1.DuckDBValidity.fromVector(vector, itemCount);
|
|
27
|
+
return new DuckDBTimeNSVector(items, validity, vector);
|
|
28
|
+
}
|
|
29
|
+
get type() {
|
|
30
|
+
return DuckDBType_1.DuckDBTimeNSType.instance;
|
|
31
|
+
}
|
|
32
|
+
get itemCount() {
|
|
33
|
+
return this.items.length;
|
|
34
|
+
}
|
|
35
|
+
getItem(itemIndex) {
|
|
36
|
+
return this.validity.itemValid(itemIndex)
|
|
37
|
+
? new values_1.DuckDBTimeNSValue(this.items[itemIndex])
|
|
38
|
+
: null;
|
|
39
|
+
}
|
|
40
|
+
setItem(itemIndex, value) {
|
|
41
|
+
if (value != null) {
|
|
42
|
+
// Checked inline for bulk-write throughput; see dataAccessors.ts.
|
|
43
|
+
if (BigInt.asIntN(64, value.nanos) !== value.nanos) {
|
|
44
|
+
throw new Error(`bigint out of int64 range`);
|
|
45
|
+
}
|
|
46
|
+
this.items[itemIndex] = value.nanos;
|
|
47
|
+
this.validity.setItemValid(itemIndex, true);
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
this.validity.setItemValid(itemIndex, false);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
flush() {
|
|
54
|
+
node_bindings_1.default.copy_data_to_vector(this.vector, 0, this.items.buffer, this.items.byteOffset, this.items.byteLength);
|
|
55
|
+
this.validity.flush(this.vector);
|
|
56
|
+
}
|
|
57
|
+
slice(offset, length) {
|
|
58
|
+
return new DuckDBTimeNSVector(this.items.slice(offset, offset + length), this.validity.slice(offset, length), this.vector);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
exports.DuckDBTimeNSVector = DuckDBTimeNSVector;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import duckdb from '@haybarn/node-bindings';
|
|
2
|
+
import { DuckDBTimeTZType } from '../DuckDBType';
|
|
3
|
+
import { DuckDBTimeTZValue } from '../values';
|
|
4
|
+
import { DuckDBVector } from './DuckDBVector';
|
|
5
|
+
import { DuckDBValidity } from './DuckDBValidity';
|
|
6
|
+
export declare class DuckDBTimeTZVector extends DuckDBVector<DuckDBTimeTZValue> {
|
|
7
|
+
private readonly items;
|
|
8
|
+
private readonly validity;
|
|
9
|
+
private readonly vector;
|
|
10
|
+
constructor(items: BigUint64Array, validity: DuckDBValidity, vector: duckdb.Vector);
|
|
11
|
+
static fromRawVector(vector: duckdb.Vector, itemCount: number): DuckDBTimeTZVector;
|
|
12
|
+
get type(): DuckDBTimeTZType;
|
|
13
|
+
get itemCount(): number;
|
|
14
|
+
getItem(itemIndex: number): DuckDBTimeTZValue | null;
|
|
15
|
+
setItem(itemIndex: number, value: DuckDBTimeTZValue | null): void;
|
|
16
|
+
flush(): void;
|
|
17
|
+
slice(offset: number, length: number): DuckDBTimeTZVector;
|
|
18
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.DuckDBTimeTZVector = void 0;
|
|
7
|
+
const node_bindings_1 = __importDefault(require("@haybarn/node-bindings"));
|
|
8
|
+
const DuckDBType_1 = require("../DuckDBType");
|
|
9
|
+
const values_1 = require("../values");
|
|
10
|
+
const DuckDBVector_1 = require("./DuckDBVector");
|
|
11
|
+
const DuckDBValidity_1 = require("./DuckDBValidity");
|
|
12
|
+
const dataAccessors_1 = require("./dataAccessors");
|
|
13
|
+
class DuckDBTimeTZVector extends DuckDBVector_1.DuckDBVector {
|
|
14
|
+
items;
|
|
15
|
+
validity;
|
|
16
|
+
vector;
|
|
17
|
+
constructor(items, validity, vector) {
|
|
18
|
+
super();
|
|
19
|
+
this.items = items;
|
|
20
|
+
this.validity = validity;
|
|
21
|
+
this.vector = vector;
|
|
22
|
+
}
|
|
23
|
+
static fromRawVector(vector, itemCount) {
|
|
24
|
+
const data = (0, dataAccessors_1.vectorData)(vector, itemCount * BigUint64Array.BYTES_PER_ELEMENT);
|
|
25
|
+
const items = new BigUint64Array(data.buffer, data.byteOffset, itemCount);
|
|
26
|
+
const validity = DuckDBValidity_1.DuckDBValidity.fromVector(vector, itemCount);
|
|
27
|
+
return new DuckDBTimeTZVector(items, validity, vector);
|
|
28
|
+
}
|
|
29
|
+
get type() {
|
|
30
|
+
return DuckDBType_1.DuckDBTimeTZType.instance;
|
|
31
|
+
}
|
|
32
|
+
get itemCount() {
|
|
33
|
+
return this.items.length;
|
|
34
|
+
}
|
|
35
|
+
getItem(itemIndex) {
|
|
36
|
+
return this.validity.itemValid(itemIndex)
|
|
37
|
+
? values_1.DuckDBTimeTZValue.fromBits(this.items[itemIndex])
|
|
38
|
+
: null;
|
|
39
|
+
}
|
|
40
|
+
setItem(itemIndex, value) {
|
|
41
|
+
if (value != null) {
|
|
42
|
+
// Checked inline for bulk-write throughput; see dataAccessors.ts.
|
|
43
|
+
if (BigInt.asUintN(64, value.bits) !== value.bits) {
|
|
44
|
+
throw new Error(`bigint out of uint64 range`);
|
|
45
|
+
}
|
|
46
|
+
this.items[itemIndex] = value.bits;
|
|
47
|
+
this.validity.setItemValid(itemIndex, true);
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
this.validity.setItemValid(itemIndex, false);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
flush() {
|
|
54
|
+
node_bindings_1.default.copy_data_to_vector(this.vector, 0, this.items.buffer, this.items.byteOffset, this.items.byteLength);
|
|
55
|
+
this.validity.flush(this.vector);
|
|
56
|
+
}
|
|
57
|
+
slice(offset, length) {
|
|
58
|
+
return new DuckDBTimeTZVector(this.items.slice(offset, offset + length), this.validity.slice(offset, length), this.vector);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
exports.DuckDBTimeTZVector = DuckDBTimeTZVector;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import duckdb from '@haybarn/node-bindings';
|
|
2
|
+
import { DuckDBTimeType } from '../DuckDBType';
|
|
3
|
+
import { DuckDBTimeValue } from '../values';
|
|
4
|
+
import { DuckDBVector } from './DuckDBVector';
|
|
5
|
+
import { DuckDBValidity } from './DuckDBValidity';
|
|
6
|
+
export declare class DuckDBTimeVector extends DuckDBVector<DuckDBTimeValue> {
|
|
7
|
+
private readonly items;
|
|
8
|
+
private readonly validity;
|
|
9
|
+
private readonly vector;
|
|
10
|
+
constructor(items: BigInt64Array, validity: DuckDBValidity, vector: duckdb.Vector);
|
|
11
|
+
static fromRawVector(vector: duckdb.Vector, itemCount: number): DuckDBTimeVector;
|
|
12
|
+
get type(): DuckDBTimeType;
|
|
13
|
+
get itemCount(): number;
|
|
14
|
+
getItem(itemIndex: number): DuckDBTimeValue | null;
|
|
15
|
+
setItem(itemIndex: number, value: DuckDBTimeValue | null): void;
|
|
16
|
+
flush(): void;
|
|
17
|
+
slice(offset: number, length: number): DuckDBTimeVector;
|
|
18
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.DuckDBTimeVector = void 0;
|
|
7
|
+
const node_bindings_1 = __importDefault(require("@haybarn/node-bindings"));
|
|
8
|
+
const DuckDBType_1 = require("../DuckDBType");
|
|
9
|
+
const values_1 = require("../values");
|
|
10
|
+
const DuckDBVector_1 = require("./DuckDBVector");
|
|
11
|
+
const DuckDBValidity_1 = require("./DuckDBValidity");
|
|
12
|
+
const dataAccessors_1 = require("./dataAccessors");
|
|
13
|
+
class DuckDBTimeVector extends DuckDBVector_1.DuckDBVector {
|
|
14
|
+
items;
|
|
15
|
+
validity;
|
|
16
|
+
vector;
|
|
17
|
+
constructor(items, validity, vector) {
|
|
18
|
+
super();
|
|
19
|
+
this.items = items;
|
|
20
|
+
this.validity = validity;
|
|
21
|
+
this.vector = vector;
|
|
22
|
+
}
|
|
23
|
+
static fromRawVector(vector, itemCount) {
|
|
24
|
+
const data = (0, dataAccessors_1.vectorData)(vector, itemCount * BigInt64Array.BYTES_PER_ELEMENT);
|
|
25
|
+
const items = new BigInt64Array(data.buffer, data.byteOffset, itemCount);
|
|
26
|
+
const validity = DuckDBValidity_1.DuckDBValidity.fromVector(vector, itemCount);
|
|
27
|
+
return new DuckDBTimeVector(items, validity, vector);
|
|
28
|
+
}
|
|
29
|
+
get type() {
|
|
30
|
+
return DuckDBType_1.DuckDBTimeType.instance;
|
|
31
|
+
}
|
|
32
|
+
get itemCount() {
|
|
33
|
+
return this.items.length;
|
|
34
|
+
}
|
|
35
|
+
getItem(itemIndex) {
|
|
36
|
+
return this.validity.itemValid(itemIndex)
|
|
37
|
+
? new values_1.DuckDBTimeValue(this.items[itemIndex])
|
|
38
|
+
: null;
|
|
39
|
+
}
|
|
40
|
+
setItem(itemIndex, value) {
|
|
41
|
+
if (value != null) {
|
|
42
|
+
// Checked inline for bulk-write throughput; see dataAccessors.ts.
|
|
43
|
+
if (BigInt.asIntN(64, value.micros) !== value.micros) {
|
|
44
|
+
throw new Error(`bigint out of int64 range`);
|
|
45
|
+
}
|
|
46
|
+
this.items[itemIndex] = value.micros;
|
|
47
|
+
this.validity.setItemValid(itemIndex, true);
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
this.validity.setItemValid(itemIndex, false);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
flush() {
|
|
54
|
+
node_bindings_1.default.copy_data_to_vector(this.vector, 0, this.items.buffer, this.items.byteOffset, this.items.byteLength);
|
|
55
|
+
this.validity.flush(this.vector);
|
|
56
|
+
}
|
|
57
|
+
slice(offset, length) {
|
|
58
|
+
return new DuckDBTimeVector(this.items.slice(offset, offset + length), this.validity.slice(offset, length), this.vector);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
exports.DuckDBTimeVector = DuckDBTimeVector;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import duckdb from '@haybarn/node-bindings';
|
|
2
|
+
import { DuckDBTimestampMillisecondsType } from '../DuckDBType';
|
|
3
|
+
import { DuckDBTimestampMillisecondsValue } from '../values';
|
|
4
|
+
import { DuckDBVector } from './DuckDBVector';
|
|
5
|
+
import { DuckDBValidity } from './DuckDBValidity';
|
|
6
|
+
export declare class DuckDBTimestampMillisecondsVector extends DuckDBVector<DuckDBTimestampMillisecondsValue> {
|
|
7
|
+
private readonly items;
|
|
8
|
+
private readonly validity;
|
|
9
|
+
private readonly vector;
|
|
10
|
+
constructor(items: BigInt64Array, validity: DuckDBValidity, vector: duckdb.Vector);
|
|
11
|
+
static fromRawVector(vector: duckdb.Vector, itemCount: number): DuckDBTimestampMillisecondsVector;
|
|
12
|
+
get type(): DuckDBTimestampMillisecondsType;
|
|
13
|
+
get itemCount(): number;
|
|
14
|
+
getItem(itemIndex: number): DuckDBTimestampMillisecondsValue | null;
|
|
15
|
+
setItem(itemIndex: number, value: DuckDBTimestampMillisecondsValue | null): void;
|
|
16
|
+
flush(): void;
|
|
17
|
+
slice(offset: number, length: number): DuckDBTimestampMillisecondsVector;
|
|
18
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.DuckDBTimestampMillisecondsVector = void 0;
|
|
7
|
+
const node_bindings_1 = __importDefault(require("@haybarn/node-bindings"));
|
|
8
|
+
const DuckDBType_1 = require("../DuckDBType");
|
|
9
|
+
const values_1 = require("../values");
|
|
10
|
+
const DuckDBVector_1 = require("./DuckDBVector");
|
|
11
|
+
const DuckDBValidity_1 = require("./DuckDBValidity");
|
|
12
|
+
const dataAccessors_1 = require("./dataAccessors");
|
|
13
|
+
class DuckDBTimestampMillisecondsVector extends DuckDBVector_1.DuckDBVector {
|
|
14
|
+
items;
|
|
15
|
+
validity;
|
|
16
|
+
vector;
|
|
17
|
+
constructor(items, validity, vector) {
|
|
18
|
+
super();
|
|
19
|
+
this.items = items;
|
|
20
|
+
this.validity = validity;
|
|
21
|
+
this.vector = vector;
|
|
22
|
+
}
|
|
23
|
+
static fromRawVector(vector, itemCount) {
|
|
24
|
+
const data = (0, dataAccessors_1.vectorData)(vector, itemCount * BigInt64Array.BYTES_PER_ELEMENT);
|
|
25
|
+
const items = new BigInt64Array(data.buffer, data.byteOffset, itemCount);
|
|
26
|
+
const validity = DuckDBValidity_1.DuckDBValidity.fromVector(vector, itemCount);
|
|
27
|
+
return new DuckDBTimestampMillisecondsVector(items, validity, vector);
|
|
28
|
+
}
|
|
29
|
+
get type() {
|
|
30
|
+
return DuckDBType_1.DuckDBTimestampMillisecondsType.instance;
|
|
31
|
+
}
|
|
32
|
+
get itemCount() {
|
|
33
|
+
return this.items.length;
|
|
34
|
+
}
|
|
35
|
+
getItem(itemIndex) {
|
|
36
|
+
return this.validity.itemValid(itemIndex)
|
|
37
|
+
? new values_1.DuckDBTimestampMillisecondsValue(this.items[itemIndex])
|
|
38
|
+
: null;
|
|
39
|
+
}
|
|
40
|
+
setItem(itemIndex, value) {
|
|
41
|
+
if (value != null) {
|
|
42
|
+
// Checked inline for bulk-write throughput; see dataAccessors.ts.
|
|
43
|
+
if (BigInt.asIntN(64, value.millis) !== value.millis) {
|
|
44
|
+
throw new Error(`bigint out of int64 range`);
|
|
45
|
+
}
|
|
46
|
+
this.items[itemIndex] = value.millis;
|
|
47
|
+
this.validity.setItemValid(itemIndex, true);
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
this.validity.setItemValid(itemIndex, false);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
flush() {
|
|
54
|
+
node_bindings_1.default.copy_data_to_vector(this.vector, 0, this.items.buffer, this.items.byteOffset, this.items.byteLength);
|
|
55
|
+
this.validity.flush(this.vector);
|
|
56
|
+
}
|
|
57
|
+
slice(offset, length) {
|
|
58
|
+
return new DuckDBTimestampMillisecondsVector(this.items.slice(offset, offset + length), this.validity.slice(offset, length), this.vector);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
exports.DuckDBTimestampMillisecondsVector = DuckDBTimestampMillisecondsVector;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import duckdb from '@haybarn/node-bindings';
|
|
2
|
+
import { DuckDBTimestampNanosecondsType } from '../DuckDBType';
|
|
3
|
+
import { DuckDBTimestampNanosecondsValue } from '../values';
|
|
4
|
+
import { DuckDBVector } from './DuckDBVector';
|
|
5
|
+
import { DuckDBValidity } from './DuckDBValidity';
|
|
6
|
+
export declare class DuckDBTimestampNanosecondsVector extends DuckDBVector<DuckDBTimestampNanosecondsValue> {
|
|
7
|
+
private readonly items;
|
|
8
|
+
private readonly validity;
|
|
9
|
+
private readonly vector;
|
|
10
|
+
constructor(items: BigInt64Array, validity: DuckDBValidity, vector: duckdb.Vector);
|
|
11
|
+
static fromRawVector(vector: duckdb.Vector, itemCount: number): DuckDBTimestampNanosecondsVector;
|
|
12
|
+
get type(): DuckDBTimestampNanosecondsType;
|
|
13
|
+
get itemCount(): number;
|
|
14
|
+
getItem(itemIndex: number): DuckDBTimestampNanosecondsValue | null;
|
|
15
|
+
setItem(itemIndex: number, value: DuckDBTimestampNanosecondsValue | null): void;
|
|
16
|
+
flush(): void;
|
|
17
|
+
slice(offset: number, length: number): DuckDBTimestampNanosecondsVector;
|
|
18
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.DuckDBTimestampNanosecondsVector = void 0;
|
|
7
|
+
const node_bindings_1 = __importDefault(require("@haybarn/node-bindings"));
|
|
8
|
+
const DuckDBType_1 = require("../DuckDBType");
|
|
9
|
+
const values_1 = require("../values");
|
|
10
|
+
const DuckDBVector_1 = require("./DuckDBVector");
|
|
11
|
+
const DuckDBValidity_1 = require("./DuckDBValidity");
|
|
12
|
+
const dataAccessors_1 = require("./dataAccessors");
|
|
13
|
+
class DuckDBTimestampNanosecondsVector extends DuckDBVector_1.DuckDBVector {
|
|
14
|
+
items;
|
|
15
|
+
validity;
|
|
16
|
+
vector;
|
|
17
|
+
constructor(items, validity, vector) {
|
|
18
|
+
super();
|
|
19
|
+
this.items = items;
|
|
20
|
+
this.validity = validity;
|
|
21
|
+
this.vector = vector;
|
|
22
|
+
}
|
|
23
|
+
static fromRawVector(vector, itemCount) {
|
|
24
|
+
const data = (0, dataAccessors_1.vectorData)(vector, itemCount * BigInt64Array.BYTES_PER_ELEMENT);
|
|
25
|
+
const items = new BigInt64Array(data.buffer, data.byteOffset, itemCount);
|
|
26
|
+
const validity = DuckDBValidity_1.DuckDBValidity.fromVector(vector, itemCount);
|
|
27
|
+
return new DuckDBTimestampNanosecondsVector(items, validity, vector);
|
|
28
|
+
}
|
|
29
|
+
get type() {
|
|
30
|
+
return DuckDBType_1.DuckDBTimestampNanosecondsType.instance;
|
|
31
|
+
}
|
|
32
|
+
get itemCount() {
|
|
33
|
+
return this.items.length;
|
|
34
|
+
}
|
|
35
|
+
getItem(itemIndex) {
|
|
36
|
+
return this.validity.itemValid(itemIndex)
|
|
37
|
+
? new values_1.DuckDBTimestampNanosecondsValue(this.items[itemIndex])
|
|
38
|
+
: null;
|
|
39
|
+
}
|
|
40
|
+
setItem(itemIndex, value) {
|
|
41
|
+
if (value != null) {
|
|
42
|
+
// Checked inline for bulk-write throughput; see dataAccessors.ts.
|
|
43
|
+
if (BigInt.asIntN(64, value.nanos) !== value.nanos) {
|
|
44
|
+
throw new Error(`bigint out of int64 range`);
|
|
45
|
+
}
|
|
46
|
+
this.items[itemIndex] = value.nanos;
|
|
47
|
+
this.validity.setItemValid(itemIndex, true);
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
this.validity.setItemValid(itemIndex, false);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
flush() {
|
|
54
|
+
node_bindings_1.default.copy_data_to_vector(this.vector, 0, this.items.buffer, this.items.byteOffset, this.items.byteLength);
|
|
55
|
+
this.validity.flush(this.vector);
|
|
56
|
+
}
|
|
57
|
+
slice(offset, length) {
|
|
58
|
+
return new DuckDBTimestampNanosecondsVector(this.items.slice(offset, offset + length), this.validity.slice(offset, length), this.vector);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
exports.DuckDBTimestampNanosecondsVector = DuckDBTimestampNanosecondsVector;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import duckdb from '@haybarn/node-bindings';
|
|
2
|
+
import { DuckDBTimestampSecondsType } from '../DuckDBType';
|
|
3
|
+
import { DuckDBTimestampSecondsValue } from '../values';
|
|
4
|
+
import { DuckDBVector } from './DuckDBVector';
|
|
5
|
+
import { DuckDBValidity } from './DuckDBValidity';
|
|
6
|
+
export declare class DuckDBTimestampSecondsVector extends DuckDBVector<DuckDBTimestampSecondsValue> {
|
|
7
|
+
private readonly items;
|
|
8
|
+
private readonly validity;
|
|
9
|
+
private readonly vector;
|
|
10
|
+
constructor(items: BigInt64Array, validity: DuckDBValidity, vector: duckdb.Vector);
|
|
11
|
+
static fromRawVector(vector: duckdb.Vector, itemCount: number): DuckDBTimestampSecondsVector;
|
|
12
|
+
get type(): DuckDBTimestampSecondsType;
|
|
13
|
+
get itemCount(): number;
|
|
14
|
+
getItem(itemIndex: number): DuckDBTimestampSecondsValue | null;
|
|
15
|
+
setItem(itemIndex: number, value: DuckDBTimestampSecondsValue | null): void;
|
|
16
|
+
flush(): void;
|
|
17
|
+
slice(offset: number, length: number): DuckDBTimestampSecondsVector;
|
|
18
|
+
}
|