@haybarn/node-api 1.5.5-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,58 @@
|
|
|
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.DuckDBBigIntVector = 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 DuckDBBigIntVector 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 * BigInt64Array.BYTES_PER_ELEMENT);
|
|
24
|
+
const items = new BigInt64Array(data.buffer, data.byteOffset, itemCount);
|
|
25
|
+
const validity = DuckDBValidity_1.DuckDBValidity.fromVector(vector, itemCount);
|
|
26
|
+
return new DuckDBBigIntVector(items, validity, vector);
|
|
27
|
+
}
|
|
28
|
+
get type() {
|
|
29
|
+
return DuckDBType_1.DuckDBBigIntType.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 (BigInt.asIntN(64, value) !== value) {
|
|
41
|
+
throw new Error(`bigint out of int64 range`);
|
|
42
|
+
}
|
|
43
|
+
this.items[itemIndex] = value;
|
|
44
|
+
this.validity.setItemValid(itemIndex, true);
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
this.validity.setItemValid(itemIndex, false);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
flush() {
|
|
51
|
+
node_bindings_1.default.copy_data_to_vector(this.vector, 0, this.items.buffer, this.items.byteOffset, this.items.byteLength);
|
|
52
|
+
this.validity.flush(this.vector);
|
|
53
|
+
}
|
|
54
|
+
slice(offset, length) {
|
|
55
|
+
return new DuckDBBigIntVector(this.items.slice(offset, offset + length), this.validity.slice(offset, length), this.vector);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
exports.DuckDBBigIntVector = DuckDBBigIntVector;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import duckdb from '@haybarn/node-bindings';
|
|
2
|
+
import { DuckDBBigNumType } from '../DuckDBType';
|
|
3
|
+
import { DuckDBVector } from './DuckDBVector';
|
|
4
|
+
import { DuckDBValidity } from './DuckDBValidity';
|
|
5
|
+
export declare class DuckDBBigNumVector extends DuckDBVector<bigint> {
|
|
6
|
+
private readonly dataView;
|
|
7
|
+
private readonly validity;
|
|
8
|
+
private readonly vector;
|
|
9
|
+
private readonly itemOffset;
|
|
10
|
+
private readonly _itemCount;
|
|
11
|
+
private readonly itemCache;
|
|
12
|
+
private readonly itemCacheDirty;
|
|
13
|
+
constructor(dataView: DataView, validity: DuckDBValidity, vector: duckdb.Vector, itemOffset: number, itemCount: number);
|
|
14
|
+
static fromRawVector(vector: duckdb.Vector, itemCount: number): DuckDBBigNumVector;
|
|
15
|
+
get type(): DuckDBBigNumType;
|
|
16
|
+
get itemCount(): number;
|
|
17
|
+
getItem(itemIndex: number): bigint | null;
|
|
18
|
+
setItem(itemIndex: number, value: bigint | null): void;
|
|
19
|
+
flush(): void;
|
|
20
|
+
slice(offset: number, length: number): DuckDBBigNumVector;
|
|
21
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
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.DuckDBBigNumVector = 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 DuckDBBigNumVector extends DuckDBVector_1.DuckDBVector {
|
|
13
|
+
dataView;
|
|
14
|
+
validity;
|
|
15
|
+
vector;
|
|
16
|
+
itemOffset;
|
|
17
|
+
_itemCount;
|
|
18
|
+
itemCache;
|
|
19
|
+
itemCacheDirty;
|
|
20
|
+
constructor(dataView, validity, vector, itemOffset, itemCount) {
|
|
21
|
+
super();
|
|
22
|
+
this.dataView = dataView;
|
|
23
|
+
this.validity = validity;
|
|
24
|
+
this.vector = vector;
|
|
25
|
+
this.itemOffset = itemOffset;
|
|
26
|
+
this._itemCount = itemCount;
|
|
27
|
+
this.itemCache = [];
|
|
28
|
+
this.itemCacheDirty = [];
|
|
29
|
+
}
|
|
30
|
+
static fromRawVector(vector, itemCount) {
|
|
31
|
+
const data = (0, dataAccessors_1.vectorData)(vector, itemCount * 16);
|
|
32
|
+
const dataView = new DataView(data.buffer, data.byteOffset, data.byteLength);
|
|
33
|
+
const validity = DuckDBValidity_1.DuckDBValidity.fromVector(vector, itemCount);
|
|
34
|
+
return new DuckDBBigNumVector(dataView, validity, vector, 0, itemCount);
|
|
35
|
+
}
|
|
36
|
+
get type() {
|
|
37
|
+
return DuckDBType_1.DuckDBBigNumType.instance;
|
|
38
|
+
}
|
|
39
|
+
get itemCount() {
|
|
40
|
+
return this._itemCount;
|
|
41
|
+
}
|
|
42
|
+
getItem(itemIndex) {
|
|
43
|
+
if (!this.validity.itemValid(itemIndex)) {
|
|
44
|
+
return null;
|
|
45
|
+
}
|
|
46
|
+
const bytes = (0, dataAccessors_1.getStringBytes)(this.dataView, itemIndex * 16);
|
|
47
|
+
return bytes ? (0, dataAccessors_1.getBigNumFromBytes)(bytes) : null;
|
|
48
|
+
}
|
|
49
|
+
setItem(itemIndex, value) {
|
|
50
|
+
this.itemCache[itemIndex] = value;
|
|
51
|
+
this.validity.setItemValid(itemIndex, value != null);
|
|
52
|
+
this.itemCacheDirty[itemIndex] = true;
|
|
53
|
+
}
|
|
54
|
+
flush() {
|
|
55
|
+
for (let itemIndex = 0; itemIndex < this._itemCount; itemIndex++) {
|
|
56
|
+
if (this.itemCacheDirty[itemIndex]) {
|
|
57
|
+
const cachedItem = this.itemCache[itemIndex];
|
|
58
|
+
if (cachedItem !== undefined && cachedItem !== null) {
|
|
59
|
+
node_bindings_1.default.vector_assign_string_element_len(this.vector, this.itemOffset + itemIndex, (0, dataAccessors_1.getBytesFromBigNum)(cachedItem));
|
|
60
|
+
}
|
|
61
|
+
this.itemCacheDirty[itemIndex] = false;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
this.validity.flush(this.vector);
|
|
65
|
+
}
|
|
66
|
+
slice(offset, length) {
|
|
67
|
+
return new DuckDBBigNumVector(new DataView(this.dataView.buffer, this.dataView.byteOffset + offset * 16, length * 16), this.validity.slice(offset, length), this.vector, offset, length);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
exports.DuckDBBigNumVector = DuckDBBigNumVector;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import duckdb from '@haybarn/node-bindings';
|
|
2
|
+
import { DuckDBBitType } from '../DuckDBType';
|
|
3
|
+
import { DuckDBBitValue } from '../values';
|
|
4
|
+
import { DuckDBVector } from './DuckDBVector';
|
|
5
|
+
import { DuckDBValidity } from './DuckDBValidity';
|
|
6
|
+
export declare class DuckDBBitVector extends DuckDBVector<DuckDBBitValue> {
|
|
7
|
+
private readonly dataView;
|
|
8
|
+
private readonly validity;
|
|
9
|
+
private readonly vector;
|
|
10
|
+
private readonly itemOffset;
|
|
11
|
+
private readonly _itemCount;
|
|
12
|
+
private readonly itemCache;
|
|
13
|
+
private readonly itemCacheDirty;
|
|
14
|
+
constructor(dataView: DataView, validity: DuckDBValidity, vector: duckdb.Vector, itemOffset: number, itemCount: number);
|
|
15
|
+
static fromRawVector(vector: duckdb.Vector, itemCount: number): DuckDBBitVector;
|
|
16
|
+
get type(): DuckDBBitType;
|
|
17
|
+
get itemCount(): number;
|
|
18
|
+
getItem(itemIndex: number): DuckDBBitValue | null;
|
|
19
|
+
setItem(itemIndex: number, value: DuckDBBitValue | null): void;
|
|
20
|
+
flush(): void;
|
|
21
|
+
slice(offset: number, length: number): DuckDBBitVector;
|
|
22
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
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.DuckDBBitVector = 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 DuckDBBitVector extends DuckDBVector_1.DuckDBVector {
|
|
14
|
+
dataView;
|
|
15
|
+
validity;
|
|
16
|
+
vector;
|
|
17
|
+
itemOffset;
|
|
18
|
+
_itemCount;
|
|
19
|
+
itemCache;
|
|
20
|
+
itemCacheDirty;
|
|
21
|
+
constructor(dataView, validity, vector, itemOffset, itemCount) {
|
|
22
|
+
super();
|
|
23
|
+
this.dataView = dataView;
|
|
24
|
+
this.validity = validity;
|
|
25
|
+
this.vector = vector;
|
|
26
|
+
this.itemOffset = itemOffset;
|
|
27
|
+
this._itemCount = itemCount;
|
|
28
|
+
this.itemCache = [];
|
|
29
|
+
this.itemCacheDirty = [];
|
|
30
|
+
}
|
|
31
|
+
static fromRawVector(vector, itemCount) {
|
|
32
|
+
const data = (0, dataAccessors_1.vectorData)(vector, itemCount * 16);
|
|
33
|
+
const dataView = new DataView(data.buffer, data.byteOffset, data.byteLength);
|
|
34
|
+
const validity = DuckDBValidity_1.DuckDBValidity.fromVector(vector, itemCount);
|
|
35
|
+
return new DuckDBBitVector(dataView, validity, vector, 0, itemCount);
|
|
36
|
+
}
|
|
37
|
+
get type() {
|
|
38
|
+
return DuckDBType_1.DuckDBBitType.instance;
|
|
39
|
+
}
|
|
40
|
+
get itemCount() {
|
|
41
|
+
return this._itemCount;
|
|
42
|
+
}
|
|
43
|
+
getItem(itemIndex) {
|
|
44
|
+
if (!this.validity.itemValid(itemIndex)) {
|
|
45
|
+
return null;
|
|
46
|
+
}
|
|
47
|
+
// getBuffer rather than getStringBytes: the latter returns a view into the
|
|
48
|
+
// vector's memory for payloads of twelve bytes or fewer, and the value it is
|
|
49
|
+
// handed to keeps that reference, so it would dangle once the vector goes.
|
|
50
|
+
const bytes = (0, dataAccessors_1.getBuffer)(this.dataView, itemIndex * 16);
|
|
51
|
+
return bytes ? new values_1.DuckDBBitValue(bytes) : null;
|
|
52
|
+
}
|
|
53
|
+
setItem(itemIndex, value) {
|
|
54
|
+
this.itemCache[itemIndex] = value;
|
|
55
|
+
this.validity.setItemValid(itemIndex, value != null);
|
|
56
|
+
this.itemCacheDirty[itemIndex] = true;
|
|
57
|
+
}
|
|
58
|
+
flush() {
|
|
59
|
+
for (let itemIndex = 0; itemIndex < this._itemCount; itemIndex++) {
|
|
60
|
+
if (this.itemCacheDirty[itemIndex]) {
|
|
61
|
+
const cachedItem = this.itemCache[itemIndex];
|
|
62
|
+
if (cachedItem !== undefined && cachedItem !== null) {
|
|
63
|
+
node_bindings_1.default.vector_assign_string_element_len(this.vector, this.itemOffset + itemIndex, cachedItem.data);
|
|
64
|
+
}
|
|
65
|
+
this.itemCacheDirty[itemIndex] = false;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
this.validity.flush(this.vector);
|
|
69
|
+
}
|
|
70
|
+
slice(offset, length) {
|
|
71
|
+
return new DuckDBBitVector(new DataView(this.dataView.buffer, this.dataView.byteOffset + offset * 16, length * 16), this.validity.slice(offset, length), this.vector, offset, length);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
exports.DuckDBBitVector = DuckDBBitVector;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import duckdb from '@haybarn/node-bindings';
|
|
2
|
+
import { DuckDBBlobType } from '../DuckDBType';
|
|
3
|
+
import { DuckDBBlobValue } from '../values';
|
|
4
|
+
import { DuckDBVector } from './DuckDBVector';
|
|
5
|
+
import { DuckDBValidity } from './DuckDBValidity';
|
|
6
|
+
export declare class DuckDBBlobVector extends DuckDBVector<DuckDBBlobValue> {
|
|
7
|
+
private readonly dataView;
|
|
8
|
+
private readonly validity;
|
|
9
|
+
private readonly vector;
|
|
10
|
+
private readonly itemOffset;
|
|
11
|
+
private readonly _itemCount;
|
|
12
|
+
private readonly itemCache;
|
|
13
|
+
private readonly itemCacheDirty;
|
|
14
|
+
constructor(dataView: DataView, validity: DuckDBValidity, vector: duckdb.Vector, itemOffset: number, itemCount: number);
|
|
15
|
+
static fromRawVector(vector: duckdb.Vector, itemCount: number): DuckDBBlobVector;
|
|
16
|
+
get type(): DuckDBBlobType;
|
|
17
|
+
get itemCount(): number;
|
|
18
|
+
getItem(itemIndex: number): DuckDBBlobValue | null;
|
|
19
|
+
/**
|
|
20
|
+
* Returns the raw bytes for the item at `itemIndex`, or null if the item
|
|
21
|
+
* is SQL NULL. Avoids the `Buffer.from(...)` copy that `getItem` does.
|
|
22
|
+
*
|
|
23
|
+
* The returned `Uint8Array` is a view over the underlying string_t
|
|
24
|
+
* backing buffer for inline payloads (≤12 bytes); for larger payloads
|
|
25
|
+
* it's a fresh allocation returned by the native bindings. Treat the
|
|
26
|
+
* result as read-only either way.
|
|
27
|
+
*/
|
|
28
|
+
getItemBytes(itemIndex: number): Uint8Array | null;
|
|
29
|
+
setItem(itemIndex: number, value: DuckDBBlobValue | null): void;
|
|
30
|
+
flush(): void;
|
|
31
|
+
slice(offset: number, length: number): DuckDBBlobVector;
|
|
32
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
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.DuckDBBlobVector = 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 DuckDBBlobVector extends DuckDBVector_1.DuckDBVector {
|
|
14
|
+
dataView;
|
|
15
|
+
validity;
|
|
16
|
+
vector;
|
|
17
|
+
itemOffset;
|
|
18
|
+
_itemCount;
|
|
19
|
+
itemCache;
|
|
20
|
+
itemCacheDirty;
|
|
21
|
+
constructor(dataView, validity, vector, itemOffset, itemCount) {
|
|
22
|
+
super();
|
|
23
|
+
this.dataView = dataView;
|
|
24
|
+
this.validity = validity;
|
|
25
|
+
this.vector = vector;
|
|
26
|
+
this.itemOffset = itemOffset;
|
|
27
|
+
this._itemCount = itemCount;
|
|
28
|
+
this.itemCache = [];
|
|
29
|
+
this.itemCacheDirty = [];
|
|
30
|
+
}
|
|
31
|
+
static fromRawVector(vector, itemCount) {
|
|
32
|
+
const data = (0, dataAccessors_1.vectorData)(vector, itemCount * 16);
|
|
33
|
+
const dataView = new DataView(data.buffer, data.byteOffset, data.byteLength);
|
|
34
|
+
const validity = DuckDBValidity_1.DuckDBValidity.fromVector(vector, itemCount);
|
|
35
|
+
return new DuckDBBlobVector(dataView, validity, vector, 0, itemCount);
|
|
36
|
+
}
|
|
37
|
+
get type() {
|
|
38
|
+
return DuckDBType_1.DuckDBBlobType.instance;
|
|
39
|
+
}
|
|
40
|
+
get itemCount() {
|
|
41
|
+
return this._itemCount;
|
|
42
|
+
}
|
|
43
|
+
getItem(itemIndex) {
|
|
44
|
+
return this.validity.itemValid(itemIndex)
|
|
45
|
+
? new values_1.DuckDBBlobValue((0, dataAccessors_1.getBuffer)(this.dataView, itemIndex * 16))
|
|
46
|
+
: null;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Returns the raw bytes for the item at `itemIndex`, or null if the item
|
|
50
|
+
* is SQL NULL. Avoids the `Buffer.from(...)` copy that `getItem` does.
|
|
51
|
+
*
|
|
52
|
+
* The returned `Uint8Array` is a view over the underlying string_t
|
|
53
|
+
* backing buffer for inline payloads (≤12 bytes); for larger payloads
|
|
54
|
+
* it's a fresh allocation returned by the native bindings. Treat the
|
|
55
|
+
* result as read-only either way.
|
|
56
|
+
*/
|
|
57
|
+
getItemBytes(itemIndex) {
|
|
58
|
+
return this.validity.itemValid(itemIndex)
|
|
59
|
+
? (0, dataAccessors_1.getStringBytes)(this.dataView, itemIndex * 16)
|
|
60
|
+
: null;
|
|
61
|
+
}
|
|
62
|
+
setItem(itemIndex, value) {
|
|
63
|
+
this.itemCache[itemIndex] = value;
|
|
64
|
+
this.validity.setItemValid(itemIndex, value != null);
|
|
65
|
+
this.itemCacheDirty[itemIndex] = true;
|
|
66
|
+
}
|
|
67
|
+
flush() {
|
|
68
|
+
for (let itemIndex = 0; itemIndex < this._itemCount; itemIndex++) {
|
|
69
|
+
if (this.itemCacheDirty[itemIndex]) {
|
|
70
|
+
const cachedItem = this.itemCache[itemIndex];
|
|
71
|
+
if (cachedItem !== undefined && cachedItem !== null) {
|
|
72
|
+
node_bindings_1.default.vector_assign_string_element_len(this.vector, this.itemOffset + itemIndex, cachedItem.bytes);
|
|
73
|
+
}
|
|
74
|
+
this.itemCacheDirty[itemIndex] = false;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
this.validity.flush(this.vector);
|
|
78
|
+
}
|
|
79
|
+
slice(offset, length) {
|
|
80
|
+
return new DuckDBBlobVector(new DataView(this.dataView.buffer, this.dataView.byteOffset + offset * 16, length * 16), this.validity.slice(offset, length), this.vector, offset, length);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
exports.DuckDBBlobVector = DuckDBBlobVector;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import duckdb from '@haybarn/node-bindings';
|
|
2
|
+
import { DuckDBBooleanType } from '../DuckDBType';
|
|
3
|
+
import { DuckDBVector } from './DuckDBVector';
|
|
4
|
+
import { DuckDBValidity } from './DuckDBValidity';
|
|
5
|
+
export declare class DuckDBBooleanVector extends DuckDBVector<boolean> {
|
|
6
|
+
private readonly dataView;
|
|
7
|
+
private readonly validity;
|
|
8
|
+
private readonly vector;
|
|
9
|
+
private readonly _itemCount;
|
|
10
|
+
constructor(dataView: DataView, validity: DuckDBValidity, vector: duckdb.Vector, itemCount: number);
|
|
11
|
+
static fromRawVector(vector: duckdb.Vector, itemCount: number): DuckDBBooleanVector;
|
|
12
|
+
get type(): DuckDBBooleanType;
|
|
13
|
+
get itemCount(): number;
|
|
14
|
+
getItem(itemIndex: number): boolean | null;
|
|
15
|
+
setItem(itemIndex: number, value: boolean | null): void;
|
|
16
|
+
flush(): void;
|
|
17
|
+
slice(offset: number, length: number): DuckDBBooleanVector;
|
|
18
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
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.DuckDBBooleanVector = 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 DuckDBBooleanVector extends DuckDBVector_1.DuckDBVector {
|
|
13
|
+
dataView;
|
|
14
|
+
validity;
|
|
15
|
+
vector;
|
|
16
|
+
_itemCount;
|
|
17
|
+
constructor(dataView, validity, vector, itemCount) {
|
|
18
|
+
super();
|
|
19
|
+
this.dataView = dataView;
|
|
20
|
+
this.validity = validity;
|
|
21
|
+
this.vector = vector;
|
|
22
|
+
this._itemCount = itemCount;
|
|
23
|
+
}
|
|
24
|
+
static fromRawVector(vector, itemCount) {
|
|
25
|
+
const data = (0, dataAccessors_1.vectorData)(vector, itemCount * node_bindings_1.default.sizeof_bool);
|
|
26
|
+
const dataView = new DataView(data.buffer, data.byteOffset, data.byteLength);
|
|
27
|
+
const validity = DuckDBValidity_1.DuckDBValidity.fromVector(vector, itemCount);
|
|
28
|
+
return new DuckDBBooleanVector(dataView, validity, vector, itemCount);
|
|
29
|
+
}
|
|
30
|
+
get type() {
|
|
31
|
+
return DuckDBType_1.DuckDBBooleanType.instance;
|
|
32
|
+
}
|
|
33
|
+
get itemCount() {
|
|
34
|
+
return this._itemCount;
|
|
35
|
+
}
|
|
36
|
+
getItem(itemIndex) {
|
|
37
|
+
return this.validity.itemValid(itemIndex)
|
|
38
|
+
? (0, dataAccessors_1.getBoolean)(this.dataView, itemIndex * node_bindings_1.default.sizeof_bool)
|
|
39
|
+
: null;
|
|
40
|
+
}
|
|
41
|
+
setItem(itemIndex, value) {
|
|
42
|
+
if (value != null) {
|
|
43
|
+
(0, dataAccessors_1.setBoolean)(this.dataView, itemIndex * node_bindings_1.default.sizeof_bool, value);
|
|
44
|
+
this.validity.setItemValid(itemIndex, true);
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
this.validity.setItemValid(itemIndex, false);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
flush() {
|
|
51
|
+
node_bindings_1.default.copy_data_to_vector(this.vector, 0, this.dataView.buffer, this.dataView.byteOffset, this.dataView.byteLength);
|
|
52
|
+
this.validity.flush(this.vector);
|
|
53
|
+
}
|
|
54
|
+
slice(offset, length) {
|
|
55
|
+
return new DuckDBBooleanVector(new DataView(this.dataView.buffer, this.dataView.byteOffset + offset * node_bindings_1.default.sizeof_bool, length * node_bindings_1.default.sizeof_bool), this.validity.slice(offset, length), this.vector, length);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
exports.DuckDBBooleanVector = DuckDBBooleanVector;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import duckdb from '@haybarn/node-bindings';
|
|
2
|
+
import { DuckDBDateType } from '../DuckDBType';
|
|
3
|
+
import { DuckDBDateValue } from '../values';
|
|
4
|
+
import { DuckDBVector } from './DuckDBVector';
|
|
5
|
+
import { DuckDBValidity } from './DuckDBValidity';
|
|
6
|
+
export declare class DuckDBDateVector extends DuckDBVector<DuckDBDateValue> {
|
|
7
|
+
private readonly items;
|
|
8
|
+
private readonly validity;
|
|
9
|
+
private readonly vector;
|
|
10
|
+
constructor(items: Int32Array, validity: DuckDBValidity, vector: duckdb.Vector);
|
|
11
|
+
static fromRawVector(vector: duckdb.Vector, itemCount: number): DuckDBDateVector;
|
|
12
|
+
get type(): DuckDBDateType;
|
|
13
|
+
get itemCount(): number;
|
|
14
|
+
getItem(itemIndex: number): DuckDBDateValue | null;
|
|
15
|
+
setItem(itemIndex: number, value: DuckDBDateValue | null): void;
|
|
16
|
+
flush(): void;
|
|
17
|
+
slice(offset: number, length: number): DuckDBDateVector;
|
|
18
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
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.DuckDBDateVector = 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 DuckDBDateVector 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 * Int32Array.BYTES_PER_ELEMENT);
|
|
25
|
+
const items = new Int32Array(data.buffer, data.byteOffset, itemCount);
|
|
26
|
+
const validity = DuckDBValidity_1.DuckDBValidity.fromVector(vector, itemCount);
|
|
27
|
+
return new DuckDBDateVector(items, validity, vector);
|
|
28
|
+
}
|
|
29
|
+
get type() {
|
|
30
|
+
return DuckDBType_1.DuckDBDateType.instance;
|
|
31
|
+
}
|
|
32
|
+
get itemCount() {
|
|
33
|
+
return this.items.length;
|
|
34
|
+
}
|
|
35
|
+
getItem(itemIndex) {
|
|
36
|
+
return this.validity.itemValid(itemIndex)
|
|
37
|
+
? new values_1.DuckDBDateValue(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 (!Number.isInteger(value.days)) {
|
|
44
|
+
throw new Error(`number is not an integer`);
|
|
45
|
+
}
|
|
46
|
+
if (value.days < -2147483648 || value.days > 2147483647) {
|
|
47
|
+
throw new Error(`number out of int32 range`);
|
|
48
|
+
}
|
|
49
|
+
this.items[itemIndex] = value.days;
|
|
50
|
+
this.validity.setItemValid(itemIndex, true);
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
this.validity.setItemValid(itemIndex, false);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
flush() {
|
|
57
|
+
node_bindings_1.default.copy_data_to_vector(this.vector, 0, this.items.buffer, this.items.byteOffset, this.items.byteLength);
|
|
58
|
+
this.validity.flush(this.vector);
|
|
59
|
+
}
|
|
60
|
+
slice(offset, length) {
|
|
61
|
+
return new DuckDBDateVector(this.items.slice(offset, offset + length), this.validity.slice(offset, length), this.vector);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
exports.DuckDBDateVector = DuckDBDateVector;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import duckdb from '@haybarn/node-bindings';
|
|
2
|
+
import { DuckDBDecimalType } from '../DuckDBType';
|
|
3
|
+
import { DuckDBDecimalValue } from '../values';
|
|
4
|
+
import { DuckDBVector } from './DuckDBVector';
|
|
5
|
+
import { DuckDBValidity } from './DuckDBValidity';
|
|
6
|
+
export declare class DuckDBDecimal128Vector extends DuckDBVector<DuckDBDecimalValue> {
|
|
7
|
+
private readonly decimalType;
|
|
8
|
+
private readonly dataView;
|
|
9
|
+
private readonly validity;
|
|
10
|
+
private readonly vector;
|
|
11
|
+
private readonly _itemCount;
|
|
12
|
+
constructor(decimalType: DuckDBDecimalType, dataView: DataView, validity: DuckDBValidity, vector: duckdb.Vector, itemCount: number);
|
|
13
|
+
static fromRawVector(decimalType: DuckDBDecimalType, vector: duckdb.Vector, itemCount: number): DuckDBDecimal128Vector;
|
|
14
|
+
get type(): DuckDBDecimalType;
|
|
15
|
+
get itemCount(): number;
|
|
16
|
+
getItem(itemIndex: number): DuckDBDecimalValue | null;
|
|
17
|
+
getScaledValue(itemIndex: number): bigint | null;
|
|
18
|
+
setItem(itemIndex: number, value: DuckDBDecimalValue | null): void;
|
|
19
|
+
flush(): void;
|
|
20
|
+
slice(offset: number, length: number): DuckDBDecimal128Vector;
|
|
21
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
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.DuckDBDecimal128Vector = void 0;
|
|
7
|
+
const node_bindings_1 = __importDefault(require("@haybarn/node-bindings"));
|
|
8
|
+
const DuckDBVector_1 = require("./DuckDBVector");
|
|
9
|
+
const DuckDBValidity_1 = require("./DuckDBValidity");
|
|
10
|
+
const dataAccessors_1 = require("./dataAccessors");
|
|
11
|
+
class DuckDBDecimal128Vector extends DuckDBVector_1.DuckDBVector {
|
|
12
|
+
decimalType;
|
|
13
|
+
dataView;
|
|
14
|
+
validity;
|
|
15
|
+
vector;
|
|
16
|
+
_itemCount;
|
|
17
|
+
constructor(decimalType, dataView, validity, vector, itemCount) {
|
|
18
|
+
super();
|
|
19
|
+
this.decimalType = decimalType;
|
|
20
|
+
this.dataView = dataView;
|
|
21
|
+
this.validity = validity;
|
|
22
|
+
this.vector = vector;
|
|
23
|
+
this._itemCount = itemCount;
|
|
24
|
+
}
|
|
25
|
+
static fromRawVector(decimalType, vector, itemCount) {
|
|
26
|
+
const data = (0, dataAccessors_1.vectorData)(vector, itemCount * 16);
|
|
27
|
+
const dataView = new DataView(data.buffer, data.byteOffset, data.byteLength);
|
|
28
|
+
const validity = DuckDBValidity_1.DuckDBValidity.fromVector(vector, itemCount);
|
|
29
|
+
return new DuckDBDecimal128Vector(decimalType, dataView, validity, vector, itemCount);
|
|
30
|
+
}
|
|
31
|
+
get type() {
|
|
32
|
+
return this.decimalType;
|
|
33
|
+
}
|
|
34
|
+
get itemCount() {
|
|
35
|
+
return this._itemCount;
|
|
36
|
+
}
|
|
37
|
+
getItem(itemIndex) {
|
|
38
|
+
return this.validity.itemValid(itemIndex)
|
|
39
|
+
? (0, dataAccessors_1.getDecimal128)(this.dataView, itemIndex * 16, this.decimalType)
|
|
40
|
+
: null;
|
|
41
|
+
}
|
|
42
|
+
getScaledValue(itemIndex) {
|
|
43
|
+
return this.validity.itemValid(itemIndex)
|
|
44
|
+
? (0, dataAccessors_1.getInt128)(this.dataView, itemIndex * 16)
|
|
45
|
+
: null;
|
|
46
|
+
}
|
|
47
|
+
setItem(itemIndex, value) {
|
|
48
|
+
if (value != null) {
|
|
49
|
+
(0, dataAccessors_1.setInt128)(this.dataView, itemIndex * 16, value.value);
|
|
50
|
+
this.validity.setItemValid(itemIndex, true);
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
this.validity.setItemValid(itemIndex, false);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
flush() {
|
|
57
|
+
node_bindings_1.default.copy_data_to_vector(this.vector, 0, this.dataView.buffer, this.dataView.byteOffset, this.dataView.byteLength);
|
|
58
|
+
this.validity.flush(this.vector);
|
|
59
|
+
}
|
|
60
|
+
slice(offset, length) {
|
|
61
|
+
return new DuckDBDecimal128Vector(this.decimalType, new DataView(this.dataView.buffer, this.dataView.byteOffset + offset * 16, length * 16), this.validity.slice(offset, length), this.vector, length);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
exports.DuckDBDecimal128Vector = DuckDBDecimal128Vector;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import duckdb from '@haybarn/node-bindings';
|
|
2
|
+
import { DuckDBDecimalType } from '../DuckDBType';
|
|
3
|
+
import { DuckDBDecimalValue } from '../values';
|
|
4
|
+
import { DuckDBVector } from './DuckDBVector';
|
|
5
|
+
import { DuckDBValidity } from './DuckDBValidity';
|
|
6
|
+
export declare class DuckDBDecimal16Vector extends DuckDBVector<DuckDBDecimalValue> {
|
|
7
|
+
private readonly decimalType;
|
|
8
|
+
private readonly dataView;
|
|
9
|
+
private readonly validity;
|
|
10
|
+
private readonly vector;
|
|
11
|
+
private readonly _itemCount;
|
|
12
|
+
constructor(decimalType: DuckDBDecimalType, dataView: DataView, validity: DuckDBValidity, vector: duckdb.Vector, itemCount: number);
|
|
13
|
+
static fromRawVector(decimalType: DuckDBDecimalType, vector: duckdb.Vector, itemCount: number): DuckDBDecimal16Vector;
|
|
14
|
+
get type(): DuckDBDecimalType;
|
|
15
|
+
get itemCount(): number;
|
|
16
|
+
getItem(itemIndex: number): DuckDBDecimalValue | null;
|
|
17
|
+
getScaledValue(itemIndex: number): number | null;
|
|
18
|
+
setItem(itemIndex: number, value: DuckDBDecimalValue | null): void;
|
|
19
|
+
flush(): void;
|
|
20
|
+
slice(offset: number, length: number): DuckDBDecimal16Vector;
|
|
21
|
+
}
|