@avidian/duckdb-bun 0.0.0-stage → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +22 -0
- package/README.md +284 -2
- package/package.json +95 -4
- package/src/bindings/api/appender.ts +288 -0
- package/src/bindings/api/data-chunk.ts +58 -0
- package/src/bindings/api/database.ts +232 -0
- package/src/bindings/api/datetime.ts +158 -0
- package/src/bindings/api/index.ts +13 -0
- package/src/bindings/api/logical-types.ts +227 -0
- package/src/bindings/api/query.ts +616 -0
- package/src/bindings/api/scalar-function.ts +274 -0
- package/src/bindings/api/table-function.ts +339 -0
- package/src/bindings/api/values.ts +546 -0
- package/src/bindings/api/vector.ts +266 -0
- package/src/bindings/generated/capi.ts +695 -0
- package/src/bindings/generated/contract.ts +162 -0
- package/src/bindings/index.ts +10 -0
- package/src/bindings/runtime/convert.ts +307 -0
- package/src/bindings/runtime/diagnostics.ts +45 -0
- package/src/bindings/runtime/dispatch.ts +200 -0
- package/src/bindings/runtime/exception.ts +103 -0
- package/src/bindings/runtime/flags.ts +19 -0
- package/src/bindings/runtime/handle.ts +217 -0
- package/src/bindings/runtime/kinds.ts +53 -0
- package/src/bindings/runtime/marshal.ts +190 -0
- package/src/bindings/runtime/native.ts +150 -0
- package/src/bindings/runtime/ring.ts +54 -0
- package/src/bindings/runtime/scope.ts +133 -0
- package/src/bindings/runtime/trace.ts +65 -0
- package/src/connection.ts +35 -0
- package/src/database.ts +27 -0
- package/src/errors.ts +30 -0
- package/src/file-assets.d.ts +10 -0
- package/src/index.ts +17 -0
- package/src/library.ts +83 -0
- package/src/neo.ts +16 -0
- package/src/reader.ts +47 -0
- package/src/statement.ts +61 -0
- package/src/types.ts +52 -0
- package/src/version.ts +6 -0
- package/vendor/node-api/LICENSE +7 -0
- package/vendor/node-api/PROVENANCE.md +54 -0
- package/vendor/node-api/node-bindings.d.ts +1669 -0
- package/vendor/node-api/src/DuckDBAppender.ts +237 -0
- package/vendor/node-api/src/DuckDBClientContext.ts +13 -0
- package/vendor/node-api/src/DuckDBConnection.ts +315 -0
- package/vendor/node-api/src/DuckDBDataChunk.ts +412 -0
- package/vendor/node-api/src/DuckDBDataChunkWriter.ts +144 -0
- package/vendor/node-api/src/DuckDBExtractedStatements.ts +37 -0
- package/vendor/node-api/src/DuckDBInstance.ts +35 -0
- package/vendor/node-api/src/DuckDBInstanceCache.ts +29 -0
- package/vendor/node-api/src/DuckDBLogicalType.ts +446 -0
- package/vendor/node-api/src/DuckDBMaterializedResult.ts +39 -0
- package/vendor/node-api/src/DuckDBPendingResult.ts +83 -0
- package/vendor/node-api/src/DuckDBPreparedStatement.ts +376 -0
- package/vendor/node-api/src/DuckDBPreparedStatementCollection.ts +5 -0
- package/vendor/node-api/src/DuckDBPreparedStatementWeakRefCollection.ts +31 -0
- package/vendor/node-api/src/DuckDBResult.ts +403 -0
- package/vendor/node-api/src/DuckDBResultReader.ts +283 -0
- package/vendor/node-api/src/DuckDBScalarFunction.ts +149 -0
- package/vendor/node-api/src/DuckDBScalarFunctionBindInfo.ts +34 -0
- package/vendor/node-api/src/DuckDBScalarFunctionInfo.ts +34 -0
- package/vendor/node-api/src/DuckDBScalarFunctionInitInfo.ts +35 -0
- package/vendor/node-api/src/DuckDBTableFunction.ts +149 -0
- package/vendor/node-api/src/DuckDBTableFunctionBindInfo.ts +56 -0
- package/vendor/node-api/src/DuckDBTableFunctionInfo.ts +36 -0
- package/vendor/node-api/src/DuckDBTableFunctionInitInfo.ts +52 -0
- package/vendor/node-api/src/DuckDBType.ts +1 -0
- package/vendor/node-api/src/DuckDBTypeId.ts +46 -0
- package/vendor/node-api/src/DuckDBValueConverter.ts +23 -0
- package/vendor/node-api/src/DuckDBValueConverters.ts +461 -0
- package/vendor/node-api/src/DuckDBVector.ts +1 -0
- package/vendor/node-api/src/JS.ts +11 -0
- package/vendor/node-api/src/JSDuckDBValueConverter.ts +85 -0
- package/vendor/node-api/src/JSInputTypeForTypeId.ts +101 -0
- package/vendor/node-api/src/JSToDuckDBValueConverter.ts +136 -0
- package/vendor/node-api/src/JSTypeForTypeId.ts +78 -0
- package/vendor/node-api/src/Json.ts +7 -0
- package/vendor/node-api/src/JsonDuckDBValueConverter.ts +72 -0
- package/vendor/node-api/src/JsonTypeForTypeId.ts +86 -0
- package/vendor/node-api/src/ToDuckDBValueConverter.ts +68 -0
- package/vendor/node-api/src/ToDuckDBValueConverters.ts +303 -0
- package/vendor/node-api/src/configurationOptionDescriptions.ts +13 -0
- package/vendor/node-api/src/conversion/bytesFromString.ts +5 -0
- package/vendor/node-api/src/conversion/dateTimeStringConversion.ts +343 -0
- package/vendor/node-api/src/conversion/displayStringForDuckDBValue.ts +12 -0
- package/vendor/node-api/src/conversion/stringFromBlob.ts +48 -0
- package/vendor/node-api/src/conversion/stringFromDecimal.ts +129 -0
- package/vendor/node-api/src/conversion/varintDecode.ts +42 -0
- package/vendor/node-api/src/convertColumnsFromChunks.ts +28 -0
- package/vendor/node-api/src/convertColumnsObjectFromChunks.ts +29 -0
- package/vendor/node-api/src/convertRowObjectsFromChunks.ts +21 -0
- package/vendor/node-api/src/convertRowsFromChunks.ts +16 -0
- package/vendor/node-api/src/createConfig.ts +14 -0
- package/vendor/node-api/src/createDuckDBValueConverter.ts +17 -0
- package/vendor/node-api/src/createResult.ts +15 -0
- package/vendor/node-api/src/createValue.ts +355 -0
- package/vendor/node-api/src/duckdb.ts +51 -0
- package/vendor/node-api/src/enums.ts +7 -0
- package/vendor/node-api/src/getColumnsFromChunks.ts +13 -0
- package/vendor/node-api/src/getColumnsObjectFromChunks.ts +16 -0
- package/vendor/node-api/src/getRowObjectsFromChunks.ts +13 -0
- package/vendor/node-api/src/getRowsFromChunks.ts +12 -0
- package/vendor/node-api/src/index.ts +3 -0
- package/vendor/node-api/src/readValue.ts +31 -0
- package/vendor/node-api/src/sleep.ts +5 -0
- package/vendor/node-api/src/sql.ts +7 -0
- package/vendor/node-api/src/tsconfig.json +7 -0
- package/vendor/node-api/src/typeForValue.ts +144 -0
- package/vendor/node-api/src/types/BaseDuckDBType.ts +31 -0
- package/vendor/node-api/src/types/DuckDBAnyType.ts +13 -0
- package/vendor/node-api/src/types/DuckDBArrayType.ts +43 -0
- package/vendor/node-api/src/types/DuckDBBigIntType.ts +21 -0
- package/vendor/node-api/src/types/DuckDBBigNumType.ts +21 -0
- package/vendor/node-api/src/types/DuckDBBitType.ts +13 -0
- package/vendor/node-api/src/types/DuckDBBlobType.ts +13 -0
- package/vendor/node-api/src/types/DuckDBBooleanType.ts +13 -0
- package/vendor/node-api/src/types/DuckDBDateType.ts +29 -0
- package/vendor/node-api/src/types/DuckDBDecimalType.ts +46 -0
- package/vendor/node-api/src/types/DuckDBDoubleType.ts +21 -0
- package/vendor/node-api/src/types/DuckDBEnumType.ts +111 -0
- package/vendor/node-api/src/types/DuckDBFloatType.ts +21 -0
- package/vendor/node-api/src/types/DuckDBGeometryType.ts +36 -0
- package/vendor/node-api/src/types/DuckDBHugeIntType.ts +21 -0
- package/vendor/node-api/src/types/DuckDBIntegerLiteralType.ts +13 -0
- package/vendor/node-api/src/types/DuckDBIntegerType.ts +21 -0
- package/vendor/node-api/src/types/DuckDBIntervalType.ts +13 -0
- package/vendor/node-api/src/types/DuckDBListType.ts +35 -0
- package/vendor/node-api/src/types/DuckDBMapType.ts +47 -0
- package/vendor/node-api/src/types/DuckDBSQLNullType.ts +17 -0
- package/vendor/node-api/src/types/DuckDBSmallIntType.ts +21 -0
- package/vendor/node-api/src/types/DuckDBStringLiteralType.ts +13 -0
- package/vendor/node-api/src/types/DuckDBStructType.ts +104 -0
- package/vendor/node-api/src/types/DuckDBTimeNSType.ts +20 -0
- package/vendor/node-api/src/types/DuckDBTimeTZType.ts +23 -0
- package/vendor/node-api/src/types/DuckDBTimeType.ts +20 -0
- package/vendor/node-api/src/types/DuckDBTimestampMillisecondsType.ts +29 -0
- package/vendor/node-api/src/types/DuckDBTimestampNanosecondsType.ts +29 -0
- package/vendor/node-api/src/types/DuckDBTimestampSecondsType.ts +29 -0
- package/vendor/node-api/src/types/DuckDBTimestampTZNanosecondsType.ts +32 -0
- package/vendor/node-api/src/types/DuckDBTimestampTZType.ts +32 -0
- package/vendor/node-api/src/types/DuckDBTimestampType.ts +32 -0
- package/vendor/node-api/src/types/DuckDBTinyIntType.ts +21 -0
- package/vendor/node-api/src/types/DuckDBType.ts +86 -0
- package/vendor/node-api/src/types/DuckDBUBigIntType.ts +21 -0
- package/vendor/node-api/src/types/DuckDBUHugeIntType.ts +21 -0
- package/vendor/node-api/src/types/DuckDBUIntegerType.ts +21 -0
- package/vendor/node-api/src/types/DuckDBUSmallIntType.ts +21 -0
- package/vendor/node-api/src/types/DuckDBUTinyIntType.ts +21 -0
- package/vendor/node-api/src/types/DuckDBUUIDType.ts +20 -0
- package/vendor/node-api/src/types/DuckDBUnionType.ts +74 -0
- package/vendor/node-api/src/types/DuckDBVarCharType.ts +13 -0
- package/vendor/node-api/src/types/DuckDBVariantType.ts +13 -0
- package/vendor/node-api/src/types/index.ts +44 -0
- package/vendor/node-api/src/values/DuckDBArrayValue.ts +18 -0
- package/vendor/node-api/src/values/DuckDBBitValue.ts +117 -0
- package/vendor/node-api/src/values/DuckDBBlobValue.ts +26 -0
- package/vendor/node-api/src/values/DuckDBDateValue.ts +43 -0
- package/vendor/node-api/src/values/DuckDBDecimalValue.ts +44 -0
- package/vendor/node-api/src/values/DuckDBGeometryValue.ts +30 -0
- package/vendor/node-api/src/values/DuckDBIntervalValue.ts +22 -0
- package/vendor/node-api/src/values/DuckDBListValue.ts +18 -0
- package/vendor/node-api/src/values/DuckDBMapValue.ts +25 -0
- package/vendor/node-api/src/values/DuckDBStructValue.ts +22 -0
- package/vendor/node-api/src/values/DuckDBTimeNSValue.ts +23 -0
- package/vendor/node-api/src/values/DuckDBTimeTZValue.ts +96 -0
- package/vendor/node-api/src/values/DuckDBTimeValue.ts +34 -0
- package/vendor/node-api/src/values/DuckDBTimestampMillisecondsValue.ts +29 -0
- package/vendor/node-api/src/values/DuckDBTimestampNanosecondsValue.ts +28 -0
- package/vendor/node-api/src/values/DuckDBTimestampSecondsValue.ts +28 -0
- package/vendor/node-api/src/values/DuckDBTimestampTZNanosecondsValue.ts +44 -0
- package/vendor/node-api/src/values/DuckDBTimestampTZValue.ts +54 -0
- package/vendor/node-api/src/values/DuckDBTimestampValue.ts +45 -0
- package/vendor/node-api/src/values/DuckDBTupleValue.ts +22 -0
- package/vendor/node-api/src/values/DuckDBUUIDValue.ts +48 -0
- package/vendor/node-api/src/values/DuckDBUnionValue.ts +22 -0
- package/vendor/node-api/src/values/DuckDBValue.ts +53 -0
- package/vendor/node-api/src/values/DuckDBVariantValue.ts +34 -0
- package/vendor/node-api/src/values/index.ts +24 -0
- package/vendor/node-api/src/vectors/DuckDBArrayVector.ts +107 -0
- package/vendor/node-api/src/vectors/DuckDBBigIntVector.ts +75 -0
- package/vendor/node-api/src/vectors/DuckDBBigNumVector.ts +98 -0
- package/vendor/node-api/src/vectors/DuckDBBitVector.ts +102 -0
- package/vendor/node-api/src/vectors/DuckDBBlobVector.ts +112 -0
- package/vendor/node-api/src/vectors/DuckDBBooleanVector.ts +84 -0
- package/vendor/node-api/src/vectors/DuckDBDateVector.ts +80 -0
- package/vendor/node-api/src/vectors/DuckDBDecimal128Vector.ts +107 -0
- package/vendor/node-api/src/vectors/DuckDBDecimal16Vector.ts +104 -0
- package/vendor/node-api/src/vectors/DuckDBDecimal32Vector.ts +104 -0
- package/vendor/node-api/src/vectors/DuckDBDecimal64Vector.ts +104 -0
- package/vendor/node-api/src/vectors/DuckDBDoubleVector.ts +68 -0
- package/vendor/node-api/src/vectors/DuckDBEnum16Vector.ts +75 -0
- package/vendor/node-api/src/vectors/DuckDBEnum32Vector.ts +75 -0
- package/vendor/node-api/src/vectors/DuckDBEnum8Vector.ts +75 -0
- package/vendor/node-api/src/vectors/DuckDBFloatVector.ts +68 -0
- package/vendor/node-api/src/vectors/DuckDBGeometryVector.ts +97 -0
- package/vendor/node-api/src/vectors/DuckDBHugeIntVector.ts +89 -0
- package/vendor/node-api/src/vectors/DuckDBIntegerVector.ts +75 -0
- package/vendor/node-api/src/vectors/DuckDBIntervalVector.ts +100 -0
- package/vendor/node-api/src/vectors/DuckDBListVector.ts +221 -0
- package/vendor/node-api/src/vectors/DuckDBMapVector.ts +88 -0
- package/vendor/node-api/src/vectors/DuckDBSQLNullVector.ts +53 -0
- package/vendor/node-api/src/vectors/DuckDBSmallIntVector.ts +75 -0
- package/vendor/node-api/src/vectors/DuckDBStructVector.ts +138 -0
- package/vendor/node-api/src/vectors/DuckDBTimeNSVector.ts +80 -0
- package/vendor/node-api/src/vectors/DuckDBTimeTZVector.ts +80 -0
- package/vendor/node-api/src/vectors/DuckDBTimeVector.ts +80 -0
- package/vendor/node-api/src/vectors/DuckDBTimestampMillisecondsVector.ts +88 -0
- package/vendor/node-api/src/vectors/DuckDBTimestampNanosecondsVector.ts +88 -0
- package/vendor/node-api/src/vectors/DuckDBTimestampSecondsVector.ts +88 -0
- package/vendor/node-api/src/vectors/DuckDBTimestampTZNanosecondsVector.ts +88 -0
- package/vendor/node-api/src/vectors/DuckDBTimestampTZVector.ts +86 -0
- package/vendor/node-api/src/vectors/DuckDBTimestampVector.ts +83 -0
- package/vendor/node-api/src/vectors/DuckDBTinyIntVector.ts +75 -0
- package/vendor/node-api/src/vectors/DuckDBTupleVector.ts +125 -0
- package/vendor/node-api/src/vectors/DuckDBUBigIntVector.ts +75 -0
- package/vendor/node-api/src/vectors/DuckDBUHugeIntVector.ts +89 -0
- package/vendor/node-api/src/vectors/DuckDBUIntegerVector.ts +75 -0
- package/vendor/node-api/src/vectors/DuckDBUSmallIntVector.ts +75 -0
- package/vendor/node-api/src/vectors/DuckDBUTinyIntVector.ts +75 -0
- package/vendor/node-api/src/vectors/DuckDBUUIDVector.ts +89 -0
- package/vendor/node-api/src/vectors/DuckDBUnionVector.ts +84 -0
- package/vendor/node-api/src/vectors/DuckDBValidity.ts +104 -0
- package/vendor/node-api/src/vectors/DuckDBVarCharVector.ts +100 -0
- package/vendor/node-api/src/vectors/DuckDBVariantVector.ts +609 -0
- package/vendor/node-api/src/vectors/DuckDBVector.ts +33 -0
- package/vendor/node-api/src/vectors/createVector.ts +269 -0
- package/vendor/node-api/src/vectors/dataAccessors.ts +387 -0
- package/vendor/node-api/src/vectors/index.ts +50 -0
- package/vendor/node-api/src/vectors/vectorRegistry.ts +24 -0
- package/vendor/node-api/src/version.ts +5 -0
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import duckdb from "../../../../src/bindings/index.ts";
|
|
2
|
+
import {
|
|
3
|
+
DuckDBStructType,
|
|
4
|
+
} from '../DuckDBType';
|
|
5
|
+
import {
|
|
6
|
+
DuckDBStructValue,
|
|
7
|
+
DuckDBValue,
|
|
8
|
+
} from '../values';
|
|
9
|
+
import { DuckDBVector } from './DuckDBVector';
|
|
10
|
+
import { DuckDBValidity } from './DuckDBValidity';
|
|
11
|
+
|
|
12
|
+
export class DuckDBStructVector extends DuckDBVector<DuckDBStructValue> {
|
|
13
|
+
private readonly structType: DuckDBStructType;
|
|
14
|
+
private readonly _itemCount: number;
|
|
15
|
+
private readonly entryVectors: readonly DuckDBVector[];
|
|
16
|
+
private readonly validity: DuckDBValidity;
|
|
17
|
+
private readonly vector: duckdb.Vector;
|
|
18
|
+
constructor(
|
|
19
|
+
structType: DuckDBStructType,
|
|
20
|
+
itemCount: number,
|
|
21
|
+
entryVectors: readonly DuckDBVector[],
|
|
22
|
+
validity: DuckDBValidity,
|
|
23
|
+
vector: duckdb.Vector
|
|
24
|
+
) {
|
|
25
|
+
super();
|
|
26
|
+
this.structType = structType;
|
|
27
|
+
this._itemCount = itemCount;
|
|
28
|
+
this.entryVectors = entryVectors;
|
|
29
|
+
this.validity = validity;
|
|
30
|
+
this.vector = vector;
|
|
31
|
+
}
|
|
32
|
+
static fromRawVector(
|
|
33
|
+
structType: DuckDBStructType,
|
|
34
|
+
vector: duckdb.Vector,
|
|
35
|
+
itemCount: number
|
|
36
|
+
): DuckDBStructVector {
|
|
37
|
+
const entryCount = structType.entryCount;
|
|
38
|
+
const entryVectors: DuckDBVector[] = [];
|
|
39
|
+
for (let i = 0; i < entryCount; i++) {
|
|
40
|
+
const child_vector = duckdb.struct_vector_get_child(vector, i);
|
|
41
|
+
entryVectors.push(
|
|
42
|
+
DuckDBVector.create(child_vector, itemCount, structType.entryTypes[i])
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
const validity = DuckDBValidity.fromVector(vector, itemCount);
|
|
46
|
+
return new DuckDBStructVector(
|
|
47
|
+
structType,
|
|
48
|
+
itemCount,
|
|
49
|
+
entryVectors,
|
|
50
|
+
validity,
|
|
51
|
+
vector
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
public override get type(): DuckDBStructType {
|
|
55
|
+
return this.structType;
|
|
56
|
+
}
|
|
57
|
+
public override get itemCount(): number {
|
|
58
|
+
return this._itemCount;
|
|
59
|
+
}
|
|
60
|
+
public override getItem(itemIndex: number): DuckDBStructValue | null {
|
|
61
|
+
if (!this.validity.itemValid(itemIndex)) {
|
|
62
|
+
return null;
|
|
63
|
+
}
|
|
64
|
+
const entries: { [name: string]: DuckDBValue } = {};
|
|
65
|
+
const entryCount = this.structType.entryCount;
|
|
66
|
+
for (let i = 0; i < entryCount; i++) {
|
|
67
|
+
entries[this.structType.entryNames[i]] =
|
|
68
|
+
this.entryVectors[i].getItem(itemIndex);
|
|
69
|
+
}
|
|
70
|
+
return new DuckDBStructValue(entries);
|
|
71
|
+
}
|
|
72
|
+
public getItemValue(
|
|
73
|
+
itemIndex: number,
|
|
74
|
+
entryIndex: number
|
|
75
|
+
): DuckDBValue | null {
|
|
76
|
+
if (!this.validity.itemValid(itemIndex)) {
|
|
77
|
+
return null;
|
|
78
|
+
}
|
|
79
|
+
return this.entryVectors[entryIndex].getItem(itemIndex);
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Returns the underlying child vector for entry `index`. Useful for
|
|
83
|
+
* callers that want direct access to a child's flat backing storage
|
|
84
|
+
* (e.g. when decoding a physical-layout type that overlays a STRUCT).
|
|
85
|
+
*/
|
|
86
|
+
public entryVectorAt(index: number): DuckDBVector {
|
|
87
|
+
return this.entryVectors[index];
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Returns whether the top-level row at `itemIndex` is non-NULL. Useful
|
|
91
|
+
* for callers overlaying a logical type on a STRUCT vector that need to
|
|
92
|
+
* distinguish a SQL-NULL row from a row whose children just happen to
|
|
93
|
+
* be NULL.
|
|
94
|
+
*/
|
|
95
|
+
public isItemValid(itemIndex: number): boolean {
|
|
96
|
+
return this.validity.itemValid(itemIndex);
|
|
97
|
+
}
|
|
98
|
+
public override setItem(itemIndex: number, value: DuckDBStructValue | null) {
|
|
99
|
+
if (value != null) {
|
|
100
|
+
const entryCount = this.structType.entryCount;
|
|
101
|
+
for (let i = 0; i < entryCount; i++) {
|
|
102
|
+
this.entryVectors[i].setItem(
|
|
103
|
+
itemIndex,
|
|
104
|
+
value.entries[this.structType.entryNames[i]]
|
|
105
|
+
);
|
|
106
|
+
}
|
|
107
|
+
this.validity.setItemValid(itemIndex, true);
|
|
108
|
+
} else {
|
|
109
|
+
const entryCount = this.structType.entryCount;
|
|
110
|
+
for (let i = 0; i < entryCount; i++) {
|
|
111
|
+
this.entryVectors[i].setItem(itemIndex, null);
|
|
112
|
+
}
|
|
113
|
+
this.validity.setItemValid(itemIndex, false);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
public setItemValue(
|
|
117
|
+
itemIndex: number,
|
|
118
|
+
entryIndex: number,
|
|
119
|
+
value: DuckDBValue
|
|
120
|
+
) {
|
|
121
|
+
return this.entryVectors[entryIndex].setItem(itemIndex, value);
|
|
122
|
+
}
|
|
123
|
+
public override flush() {
|
|
124
|
+
for (const entryVector of this.entryVectors) {
|
|
125
|
+
entryVector.flush();
|
|
126
|
+
}
|
|
127
|
+
this.validity.flush(this.vector);
|
|
128
|
+
}
|
|
129
|
+
public override slice(offset: number, length: number): DuckDBStructVector {
|
|
130
|
+
return new DuckDBStructVector(
|
|
131
|
+
this.structType,
|
|
132
|
+
length,
|
|
133
|
+
this.entryVectors.map((entryVector) => entryVector.slice(offset, length)),
|
|
134
|
+
this.validity.slice(offset, length),
|
|
135
|
+
this.vector
|
|
136
|
+
);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import duckdb from "../../../../src/bindings/index.ts";
|
|
2
|
+
import {
|
|
3
|
+
DuckDBTimeNSType,
|
|
4
|
+
} from '../DuckDBType';
|
|
5
|
+
import {
|
|
6
|
+
DuckDBTimeNSValue,
|
|
7
|
+
} from '../values';
|
|
8
|
+
import { DuckDBVector } from './DuckDBVector';
|
|
9
|
+
import { DuckDBValidity } from './DuckDBValidity';
|
|
10
|
+
import {
|
|
11
|
+
vectorData,
|
|
12
|
+
} from './dataAccessors';
|
|
13
|
+
|
|
14
|
+
export class DuckDBTimeNSVector extends DuckDBVector<DuckDBTimeNSValue> {
|
|
15
|
+
private readonly items: BigInt64Array;
|
|
16
|
+
private readonly validity: DuckDBValidity;
|
|
17
|
+
private readonly vector: duckdb.Vector;
|
|
18
|
+
constructor(
|
|
19
|
+
items: BigInt64Array,
|
|
20
|
+
validity: DuckDBValidity,
|
|
21
|
+
vector: duckdb.Vector
|
|
22
|
+
) {
|
|
23
|
+
super();
|
|
24
|
+
this.items = items;
|
|
25
|
+
this.validity = validity;
|
|
26
|
+
this.vector = vector;
|
|
27
|
+
}
|
|
28
|
+
static fromRawVector(
|
|
29
|
+
vector: duckdb.Vector,
|
|
30
|
+
itemCount: number
|
|
31
|
+
): DuckDBTimeNSVector {
|
|
32
|
+
const data = vectorData(
|
|
33
|
+
vector,
|
|
34
|
+
itemCount * BigInt64Array.BYTES_PER_ELEMENT
|
|
35
|
+
);
|
|
36
|
+
const items = new BigInt64Array(data.buffer, data.byteOffset, itemCount);
|
|
37
|
+
const validity = DuckDBValidity.fromVector(vector, itemCount);
|
|
38
|
+
return new DuckDBTimeNSVector(items, validity, vector);
|
|
39
|
+
}
|
|
40
|
+
public override get type(): DuckDBTimeNSType {
|
|
41
|
+
return DuckDBTimeNSType.instance;
|
|
42
|
+
}
|
|
43
|
+
public override get itemCount(): number {
|
|
44
|
+
return this.items.length;
|
|
45
|
+
}
|
|
46
|
+
public override getItem(itemIndex: number): DuckDBTimeNSValue | null {
|
|
47
|
+
return this.validity.itemValid(itemIndex)
|
|
48
|
+
? new DuckDBTimeNSValue(this.items[itemIndex])
|
|
49
|
+
: null;
|
|
50
|
+
}
|
|
51
|
+
public override setItem(itemIndex: number, value: DuckDBTimeNSValue | null) {
|
|
52
|
+
if (value != null) {
|
|
53
|
+
// Checked inline for bulk-write throughput; see dataAccessors.ts.
|
|
54
|
+
if (BigInt.asIntN(64, value.nanos) !== value.nanos) {
|
|
55
|
+
throw new Error(`bigint out of int64 range`);
|
|
56
|
+
}
|
|
57
|
+
this.items[itemIndex] = value.nanos;
|
|
58
|
+
this.validity.setItemValid(itemIndex, true);
|
|
59
|
+
} else {
|
|
60
|
+
this.validity.setItemValid(itemIndex, false);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
public override flush() {
|
|
64
|
+
duckdb.copy_data_to_vector(
|
|
65
|
+
this.vector,
|
|
66
|
+
0,
|
|
67
|
+
this.items.buffer as ArrayBuffer,
|
|
68
|
+
this.items.byteOffset,
|
|
69
|
+
this.items.byteLength
|
|
70
|
+
);
|
|
71
|
+
this.validity.flush(this.vector);
|
|
72
|
+
}
|
|
73
|
+
public override slice(offset: number, length: number): DuckDBTimeNSVector {
|
|
74
|
+
return new DuckDBTimeNSVector(
|
|
75
|
+
this.items.slice(offset, offset + length),
|
|
76
|
+
this.validity.slice(offset, length),
|
|
77
|
+
this.vector
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import duckdb from "../../../../src/bindings/index.ts";
|
|
2
|
+
import {
|
|
3
|
+
DuckDBTimeTZType,
|
|
4
|
+
} from '../DuckDBType';
|
|
5
|
+
import {
|
|
6
|
+
DuckDBTimeTZValue,
|
|
7
|
+
} from '../values';
|
|
8
|
+
import { DuckDBVector } from './DuckDBVector';
|
|
9
|
+
import { DuckDBValidity } from './DuckDBValidity';
|
|
10
|
+
import {
|
|
11
|
+
vectorData,
|
|
12
|
+
} from './dataAccessors';
|
|
13
|
+
|
|
14
|
+
export class DuckDBTimeTZVector extends DuckDBVector<DuckDBTimeTZValue> {
|
|
15
|
+
private readonly items: BigUint64Array;
|
|
16
|
+
private readonly validity: DuckDBValidity;
|
|
17
|
+
private readonly vector: duckdb.Vector;
|
|
18
|
+
constructor(
|
|
19
|
+
items: BigUint64Array,
|
|
20
|
+
validity: DuckDBValidity,
|
|
21
|
+
vector: duckdb.Vector
|
|
22
|
+
) {
|
|
23
|
+
super();
|
|
24
|
+
this.items = items;
|
|
25
|
+
this.validity = validity;
|
|
26
|
+
this.vector = vector;
|
|
27
|
+
}
|
|
28
|
+
static fromRawVector(
|
|
29
|
+
vector: duckdb.Vector,
|
|
30
|
+
itemCount: number
|
|
31
|
+
): DuckDBTimeTZVector {
|
|
32
|
+
const data = vectorData(
|
|
33
|
+
vector,
|
|
34
|
+
itemCount * BigUint64Array.BYTES_PER_ELEMENT
|
|
35
|
+
);
|
|
36
|
+
const items = new BigUint64Array(data.buffer, data.byteOffset, itemCount);
|
|
37
|
+
const validity = DuckDBValidity.fromVector(vector, itemCount);
|
|
38
|
+
return new DuckDBTimeTZVector(items, validity, vector);
|
|
39
|
+
}
|
|
40
|
+
public override get type(): DuckDBTimeTZType {
|
|
41
|
+
return DuckDBTimeTZType.instance;
|
|
42
|
+
}
|
|
43
|
+
public override get itemCount(): number {
|
|
44
|
+
return this.items.length;
|
|
45
|
+
}
|
|
46
|
+
public override getItem(itemIndex: number): DuckDBTimeTZValue | null {
|
|
47
|
+
return this.validity.itemValid(itemIndex)
|
|
48
|
+
? DuckDBTimeTZValue.fromBits(this.items[itemIndex])
|
|
49
|
+
: null;
|
|
50
|
+
}
|
|
51
|
+
public override setItem(itemIndex: number, value: DuckDBTimeTZValue | null) {
|
|
52
|
+
if (value != null) {
|
|
53
|
+
// Checked inline for bulk-write throughput; see dataAccessors.ts.
|
|
54
|
+
if (BigInt.asUintN(64, value.bits) !== value.bits) {
|
|
55
|
+
throw new Error(`bigint out of uint64 range`);
|
|
56
|
+
}
|
|
57
|
+
this.items[itemIndex] = value.bits;
|
|
58
|
+
this.validity.setItemValid(itemIndex, true);
|
|
59
|
+
} else {
|
|
60
|
+
this.validity.setItemValid(itemIndex, false);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
public override flush() {
|
|
64
|
+
duckdb.copy_data_to_vector(
|
|
65
|
+
this.vector,
|
|
66
|
+
0,
|
|
67
|
+
this.items.buffer as ArrayBuffer,
|
|
68
|
+
this.items.byteOffset,
|
|
69
|
+
this.items.byteLength
|
|
70
|
+
);
|
|
71
|
+
this.validity.flush(this.vector);
|
|
72
|
+
}
|
|
73
|
+
public override slice(offset: number, length: number): DuckDBTimeTZVector {
|
|
74
|
+
return new DuckDBTimeTZVector(
|
|
75
|
+
this.items.slice(offset, offset + length),
|
|
76
|
+
this.validity.slice(offset, length),
|
|
77
|
+
this.vector
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import duckdb from "../../../../src/bindings/index.ts";
|
|
2
|
+
import {
|
|
3
|
+
DuckDBTimeType,
|
|
4
|
+
} from '../DuckDBType';
|
|
5
|
+
import {
|
|
6
|
+
DuckDBTimeValue,
|
|
7
|
+
} from '../values';
|
|
8
|
+
import { DuckDBVector } from './DuckDBVector';
|
|
9
|
+
import { DuckDBValidity } from './DuckDBValidity';
|
|
10
|
+
import {
|
|
11
|
+
vectorData,
|
|
12
|
+
} from './dataAccessors';
|
|
13
|
+
|
|
14
|
+
export class DuckDBTimeVector extends DuckDBVector<DuckDBTimeValue> {
|
|
15
|
+
private readonly items: BigInt64Array;
|
|
16
|
+
private readonly validity: DuckDBValidity;
|
|
17
|
+
private readonly vector: duckdb.Vector;
|
|
18
|
+
constructor(
|
|
19
|
+
items: BigInt64Array,
|
|
20
|
+
validity: DuckDBValidity,
|
|
21
|
+
vector: duckdb.Vector
|
|
22
|
+
) {
|
|
23
|
+
super();
|
|
24
|
+
this.items = items;
|
|
25
|
+
this.validity = validity;
|
|
26
|
+
this.vector = vector;
|
|
27
|
+
}
|
|
28
|
+
static fromRawVector(
|
|
29
|
+
vector: duckdb.Vector,
|
|
30
|
+
itemCount: number
|
|
31
|
+
): DuckDBTimeVector {
|
|
32
|
+
const data = vectorData(
|
|
33
|
+
vector,
|
|
34
|
+
itemCount * BigInt64Array.BYTES_PER_ELEMENT
|
|
35
|
+
);
|
|
36
|
+
const items = new BigInt64Array(data.buffer, data.byteOffset, itemCount);
|
|
37
|
+
const validity = DuckDBValidity.fromVector(vector, itemCount);
|
|
38
|
+
return new DuckDBTimeVector(items, validity, vector);
|
|
39
|
+
}
|
|
40
|
+
public override get type(): DuckDBTimeType {
|
|
41
|
+
return DuckDBTimeType.instance;
|
|
42
|
+
}
|
|
43
|
+
public override get itemCount(): number {
|
|
44
|
+
return this.items.length;
|
|
45
|
+
}
|
|
46
|
+
public override getItem(itemIndex: number): DuckDBTimeValue | null {
|
|
47
|
+
return this.validity.itemValid(itemIndex)
|
|
48
|
+
? new DuckDBTimeValue(this.items[itemIndex])
|
|
49
|
+
: null;
|
|
50
|
+
}
|
|
51
|
+
public override setItem(itemIndex: number, value: DuckDBTimeValue | null) {
|
|
52
|
+
if (value != null) {
|
|
53
|
+
// Checked inline for bulk-write throughput; see dataAccessors.ts.
|
|
54
|
+
if (BigInt.asIntN(64, value.micros) !== value.micros) {
|
|
55
|
+
throw new Error(`bigint out of int64 range`);
|
|
56
|
+
}
|
|
57
|
+
this.items[itemIndex] = value.micros;
|
|
58
|
+
this.validity.setItemValid(itemIndex, true);
|
|
59
|
+
} else {
|
|
60
|
+
this.validity.setItemValid(itemIndex, false);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
public override flush() {
|
|
64
|
+
duckdb.copy_data_to_vector(
|
|
65
|
+
this.vector,
|
|
66
|
+
0,
|
|
67
|
+
this.items.buffer as ArrayBuffer,
|
|
68
|
+
this.items.byteOffset,
|
|
69
|
+
this.items.byteLength
|
|
70
|
+
);
|
|
71
|
+
this.validity.flush(this.vector);
|
|
72
|
+
}
|
|
73
|
+
public override slice(offset: number, length: number): DuckDBTimeVector {
|
|
74
|
+
return new DuckDBTimeVector(
|
|
75
|
+
this.items.slice(offset, offset + length),
|
|
76
|
+
this.validity.slice(offset, length),
|
|
77
|
+
this.vector
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import duckdb from "../../../../src/bindings/index.ts";
|
|
2
|
+
import {
|
|
3
|
+
DuckDBTimestampMillisecondsType,
|
|
4
|
+
} from '../DuckDBType';
|
|
5
|
+
import {
|
|
6
|
+
DuckDBTimestampMillisecondsValue,
|
|
7
|
+
} from '../values';
|
|
8
|
+
import { DuckDBVector } from './DuckDBVector';
|
|
9
|
+
import { DuckDBValidity } from './DuckDBValidity';
|
|
10
|
+
import {
|
|
11
|
+
vectorData,
|
|
12
|
+
} from './dataAccessors';
|
|
13
|
+
|
|
14
|
+
export class DuckDBTimestampMillisecondsVector extends DuckDBVector<DuckDBTimestampMillisecondsValue> {
|
|
15
|
+
private readonly items: BigInt64Array;
|
|
16
|
+
private readonly validity: DuckDBValidity;
|
|
17
|
+
private readonly vector: duckdb.Vector;
|
|
18
|
+
constructor(
|
|
19
|
+
items: BigInt64Array,
|
|
20
|
+
validity: DuckDBValidity,
|
|
21
|
+
vector: duckdb.Vector
|
|
22
|
+
) {
|
|
23
|
+
super();
|
|
24
|
+
this.items = items;
|
|
25
|
+
this.validity = validity;
|
|
26
|
+
this.vector = vector;
|
|
27
|
+
}
|
|
28
|
+
static fromRawVector(
|
|
29
|
+
vector: duckdb.Vector,
|
|
30
|
+
itemCount: number
|
|
31
|
+
): DuckDBTimestampMillisecondsVector {
|
|
32
|
+
const data = vectorData(
|
|
33
|
+
vector,
|
|
34
|
+
itemCount * BigInt64Array.BYTES_PER_ELEMENT
|
|
35
|
+
);
|
|
36
|
+
const items = new BigInt64Array(data.buffer, data.byteOffset, itemCount);
|
|
37
|
+
const validity = DuckDBValidity.fromVector(vector, itemCount);
|
|
38
|
+
return new DuckDBTimestampMillisecondsVector(items, validity, vector);
|
|
39
|
+
}
|
|
40
|
+
public override get type(): DuckDBTimestampMillisecondsType {
|
|
41
|
+
return DuckDBTimestampMillisecondsType.instance;
|
|
42
|
+
}
|
|
43
|
+
public override get itemCount(): number {
|
|
44
|
+
return this.items.length;
|
|
45
|
+
}
|
|
46
|
+
public override getItem(
|
|
47
|
+
itemIndex: number
|
|
48
|
+
): DuckDBTimestampMillisecondsValue | null {
|
|
49
|
+
return this.validity.itemValid(itemIndex)
|
|
50
|
+
? new DuckDBTimestampMillisecondsValue(this.items[itemIndex])
|
|
51
|
+
: null;
|
|
52
|
+
}
|
|
53
|
+
public override setItem(
|
|
54
|
+
itemIndex: number,
|
|
55
|
+
value: DuckDBTimestampMillisecondsValue | null
|
|
56
|
+
) {
|
|
57
|
+
if (value != null) {
|
|
58
|
+
// Checked inline for bulk-write throughput; see dataAccessors.ts.
|
|
59
|
+
if (BigInt.asIntN(64, value.millis) !== value.millis) {
|
|
60
|
+
throw new Error(`bigint out of int64 range`);
|
|
61
|
+
}
|
|
62
|
+
this.items[itemIndex] = value.millis;
|
|
63
|
+
this.validity.setItemValid(itemIndex, true);
|
|
64
|
+
} else {
|
|
65
|
+
this.validity.setItemValid(itemIndex, false);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
public override flush() {
|
|
69
|
+
duckdb.copy_data_to_vector(
|
|
70
|
+
this.vector,
|
|
71
|
+
0,
|
|
72
|
+
this.items.buffer as ArrayBuffer,
|
|
73
|
+
this.items.byteOffset,
|
|
74
|
+
this.items.byteLength
|
|
75
|
+
);
|
|
76
|
+
this.validity.flush(this.vector);
|
|
77
|
+
}
|
|
78
|
+
public override slice(
|
|
79
|
+
offset: number,
|
|
80
|
+
length: number
|
|
81
|
+
): DuckDBTimestampMillisecondsVector {
|
|
82
|
+
return new DuckDBTimestampMillisecondsVector(
|
|
83
|
+
this.items.slice(offset, offset + length),
|
|
84
|
+
this.validity.slice(offset, length),
|
|
85
|
+
this.vector
|
|
86
|
+
);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import duckdb from "../../../../src/bindings/index.ts";
|
|
2
|
+
import {
|
|
3
|
+
DuckDBTimestampNanosecondsType,
|
|
4
|
+
} from '../DuckDBType';
|
|
5
|
+
import {
|
|
6
|
+
DuckDBTimestampNanosecondsValue,
|
|
7
|
+
} from '../values';
|
|
8
|
+
import { DuckDBVector } from './DuckDBVector';
|
|
9
|
+
import { DuckDBValidity } from './DuckDBValidity';
|
|
10
|
+
import {
|
|
11
|
+
vectorData,
|
|
12
|
+
} from './dataAccessors';
|
|
13
|
+
|
|
14
|
+
export class DuckDBTimestampNanosecondsVector extends DuckDBVector<DuckDBTimestampNanosecondsValue> {
|
|
15
|
+
private readonly items: BigInt64Array;
|
|
16
|
+
private readonly validity: DuckDBValidity;
|
|
17
|
+
private readonly vector: duckdb.Vector;
|
|
18
|
+
constructor(
|
|
19
|
+
items: BigInt64Array,
|
|
20
|
+
validity: DuckDBValidity,
|
|
21
|
+
vector: duckdb.Vector
|
|
22
|
+
) {
|
|
23
|
+
super();
|
|
24
|
+
this.items = items;
|
|
25
|
+
this.validity = validity;
|
|
26
|
+
this.vector = vector;
|
|
27
|
+
}
|
|
28
|
+
static fromRawVector(
|
|
29
|
+
vector: duckdb.Vector,
|
|
30
|
+
itemCount: number
|
|
31
|
+
): DuckDBTimestampNanosecondsVector {
|
|
32
|
+
const data = vectorData(
|
|
33
|
+
vector,
|
|
34
|
+
itemCount * BigInt64Array.BYTES_PER_ELEMENT
|
|
35
|
+
);
|
|
36
|
+
const items = new BigInt64Array(data.buffer, data.byteOffset, itemCount);
|
|
37
|
+
const validity = DuckDBValidity.fromVector(vector, itemCount);
|
|
38
|
+
return new DuckDBTimestampNanosecondsVector(items, validity, vector);
|
|
39
|
+
}
|
|
40
|
+
public override get type(): DuckDBTimestampNanosecondsType {
|
|
41
|
+
return DuckDBTimestampNanosecondsType.instance;
|
|
42
|
+
}
|
|
43
|
+
public override get itemCount(): number {
|
|
44
|
+
return this.items.length;
|
|
45
|
+
}
|
|
46
|
+
public override getItem(
|
|
47
|
+
itemIndex: number
|
|
48
|
+
): DuckDBTimestampNanosecondsValue | null {
|
|
49
|
+
return this.validity.itemValid(itemIndex)
|
|
50
|
+
? new DuckDBTimestampNanosecondsValue(this.items[itemIndex])
|
|
51
|
+
: null;
|
|
52
|
+
}
|
|
53
|
+
public override setItem(
|
|
54
|
+
itemIndex: number,
|
|
55
|
+
value: DuckDBTimestampNanosecondsValue | null
|
|
56
|
+
) {
|
|
57
|
+
if (value != null) {
|
|
58
|
+
// Checked inline for bulk-write throughput; see dataAccessors.ts.
|
|
59
|
+
if (BigInt.asIntN(64, value.nanos) !== value.nanos) {
|
|
60
|
+
throw new Error(`bigint out of int64 range`);
|
|
61
|
+
}
|
|
62
|
+
this.items[itemIndex] = value.nanos;
|
|
63
|
+
this.validity.setItemValid(itemIndex, true);
|
|
64
|
+
} else {
|
|
65
|
+
this.validity.setItemValid(itemIndex, false);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
public override flush() {
|
|
69
|
+
duckdb.copy_data_to_vector(
|
|
70
|
+
this.vector,
|
|
71
|
+
0,
|
|
72
|
+
this.items.buffer as ArrayBuffer,
|
|
73
|
+
this.items.byteOffset,
|
|
74
|
+
this.items.byteLength
|
|
75
|
+
);
|
|
76
|
+
this.validity.flush(this.vector);
|
|
77
|
+
}
|
|
78
|
+
public override slice(
|
|
79
|
+
offset: number,
|
|
80
|
+
length: number
|
|
81
|
+
): DuckDBTimestampNanosecondsVector {
|
|
82
|
+
return new DuckDBTimestampNanosecondsVector(
|
|
83
|
+
this.items.slice(offset, offset + length),
|
|
84
|
+
this.validity.slice(offset, length),
|
|
85
|
+
this.vector
|
|
86
|
+
);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import duckdb from "../../../../src/bindings/index.ts";
|
|
2
|
+
import {
|
|
3
|
+
DuckDBTimestampSecondsType,
|
|
4
|
+
} from '../DuckDBType';
|
|
5
|
+
import {
|
|
6
|
+
DuckDBTimestampSecondsValue,
|
|
7
|
+
} from '../values';
|
|
8
|
+
import { DuckDBVector } from './DuckDBVector';
|
|
9
|
+
import { DuckDBValidity } from './DuckDBValidity';
|
|
10
|
+
import {
|
|
11
|
+
vectorData,
|
|
12
|
+
} from './dataAccessors';
|
|
13
|
+
|
|
14
|
+
export class DuckDBTimestampSecondsVector extends DuckDBVector<DuckDBTimestampSecondsValue> {
|
|
15
|
+
private readonly items: BigInt64Array;
|
|
16
|
+
private readonly validity: DuckDBValidity;
|
|
17
|
+
private readonly vector: duckdb.Vector;
|
|
18
|
+
constructor(
|
|
19
|
+
items: BigInt64Array,
|
|
20
|
+
validity: DuckDBValidity,
|
|
21
|
+
vector: duckdb.Vector
|
|
22
|
+
) {
|
|
23
|
+
super();
|
|
24
|
+
this.items = items;
|
|
25
|
+
this.validity = validity;
|
|
26
|
+
this.vector = vector;
|
|
27
|
+
}
|
|
28
|
+
static fromRawVector(
|
|
29
|
+
vector: duckdb.Vector,
|
|
30
|
+
itemCount: number
|
|
31
|
+
): DuckDBTimestampSecondsVector {
|
|
32
|
+
const data = vectorData(
|
|
33
|
+
vector,
|
|
34
|
+
itemCount * BigInt64Array.BYTES_PER_ELEMENT
|
|
35
|
+
);
|
|
36
|
+
const items = new BigInt64Array(data.buffer, data.byteOffset, itemCount);
|
|
37
|
+
const validity = DuckDBValidity.fromVector(vector, itemCount);
|
|
38
|
+
return new DuckDBTimestampSecondsVector(items, validity, vector);
|
|
39
|
+
}
|
|
40
|
+
public override get type(): DuckDBTimestampSecondsType {
|
|
41
|
+
return DuckDBTimestampSecondsType.instance;
|
|
42
|
+
}
|
|
43
|
+
public override get itemCount(): number {
|
|
44
|
+
return this.items.length;
|
|
45
|
+
}
|
|
46
|
+
public override getItem(
|
|
47
|
+
itemIndex: number
|
|
48
|
+
): DuckDBTimestampSecondsValue | null {
|
|
49
|
+
return this.validity.itemValid(itemIndex)
|
|
50
|
+
? new DuckDBTimestampSecondsValue(this.items[itemIndex])
|
|
51
|
+
: null;
|
|
52
|
+
}
|
|
53
|
+
public override setItem(
|
|
54
|
+
itemIndex: number,
|
|
55
|
+
value: DuckDBTimestampSecondsValue | null
|
|
56
|
+
) {
|
|
57
|
+
if (value != null) {
|
|
58
|
+
// Checked inline for bulk-write throughput; see dataAccessors.ts.
|
|
59
|
+
if (BigInt.asIntN(64, value.seconds) !== value.seconds) {
|
|
60
|
+
throw new Error(`bigint out of int64 range`);
|
|
61
|
+
}
|
|
62
|
+
this.items[itemIndex] = value.seconds;
|
|
63
|
+
this.validity.setItemValid(itemIndex, true);
|
|
64
|
+
} else {
|
|
65
|
+
this.validity.setItemValid(itemIndex, false);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
public override flush() {
|
|
69
|
+
duckdb.copy_data_to_vector(
|
|
70
|
+
this.vector,
|
|
71
|
+
0,
|
|
72
|
+
this.items.buffer as ArrayBuffer,
|
|
73
|
+
this.items.byteOffset,
|
|
74
|
+
this.items.byteLength
|
|
75
|
+
);
|
|
76
|
+
this.validity.flush(this.vector);
|
|
77
|
+
}
|
|
78
|
+
public override slice(
|
|
79
|
+
offset: number,
|
|
80
|
+
length: number
|
|
81
|
+
): DuckDBTimestampSecondsVector {
|
|
82
|
+
return new DuckDBTimestampSecondsVector(
|
|
83
|
+
this.items.slice(offset, offset + length),
|
|
84
|
+
this.validity.slice(offset, length),
|
|
85
|
+
this.vector
|
|
86
|
+
);
|
|
87
|
+
}
|
|
88
|
+
}
|