@lancedb/lancedb 0.40.0-beta.12 → 0.40.0-beta.13
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/NODEJS_THIRD_PARTY_LICENSES.md +8 -0
- package/dist/arrow.d.ts +18 -1
- package/dist/arrow.js +182 -13
- package/dist/blob.d.ts +56 -2
- package/dist/blob.js +106 -6
- package/dist/catalog.d.ts +40 -6
- package/dist/catalog.js +58 -9
- package/dist/connection.d.ts +0 -4
- package/dist/connection.js +2 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +2 -1
- package/dist/materialized_view.d.ts +5 -12
- package/dist/materialized_view.js +6 -12
- package/dist/native.d.ts +15 -8
- package/dist/native.js +53 -52
- package/dist/query.d.ts +7 -1
- package/dist/query.js +12 -15
- package/dist/sanitize.d.ts +19 -18
- package/dist/sanitize.js +74 -11
- package/dist/schema.js +31 -3
- package/dist/table.d.ts +2 -2
- package/dist/table.js +2 -2
- package/package.json +13 -9
package/dist/query.js
CHANGED
|
@@ -21,18 +21,6 @@ async function* RecordBatchIterator(promisedInner) {
|
|
|
21
21
|
yield batches[0];
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
|
-
class RecordBatchIterable {
|
|
25
|
-
inner;
|
|
26
|
-
options;
|
|
27
|
-
constructor(inner, options) {
|
|
28
|
-
this.inner = inner;
|
|
29
|
-
this.options = options;
|
|
30
|
-
}
|
|
31
|
-
// biome-ignore lint/suspicious/noExplicitAny: skip
|
|
32
|
-
[Symbol.asyncIterator]() {
|
|
33
|
-
return RecordBatchIterator(this.inner.execute(this.options?.maxBatchLength, this.options?.timeoutMs));
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
24
|
function nearestToNative(inner, vector) {
|
|
37
25
|
const raw = Array.isArray(vector) ? null : (0, arrow_1.extractVectorBuffer)(vector);
|
|
38
26
|
if (raw) {
|
|
@@ -183,13 +171,20 @@ class QueryBase {
|
|
|
183
171
|
[Symbol.asyncIterator]() {
|
|
184
172
|
return RecordBatchIterator(this.nativeExecute());
|
|
185
173
|
}
|
|
186
|
-
/**
|
|
174
|
+
/**
|
|
175
|
+
* Collect the results as an Arrow @see {@link ArrowTable}.
|
|
176
|
+
*
|
|
177
|
+
* Empty results retain the query's output schema.
|
|
178
|
+
*/
|
|
187
179
|
async toArrow(options) {
|
|
188
180
|
const batches = [];
|
|
189
|
-
const
|
|
190
|
-
for await (const batch of
|
|
181
|
+
const iterator = this.nativeExecute(options);
|
|
182
|
+
for await (const batch of RecordBatchIterator(iterator)) {
|
|
191
183
|
batches.push(batch);
|
|
192
184
|
}
|
|
185
|
+
if (batches.length === 0) {
|
|
186
|
+
return (0, arrow_1.tableFromIPC)((await iterator).schema());
|
|
187
|
+
}
|
|
193
188
|
return new arrow_1.Table(batches);
|
|
194
189
|
}
|
|
195
190
|
/** Collect the results as an array of objects. */
|
|
@@ -415,6 +410,8 @@ class VectorQuery extends StandardQueryBase {
|
|
|
415
410
|
/**
|
|
416
411
|
* Set the number of partitions to search (probe)
|
|
417
412
|
*
|
|
413
|
+
* The number of probes must be greater than 0.
|
|
414
|
+
*
|
|
418
415
|
* This argument is only used when the vector column has an IVF PQ index.
|
|
419
416
|
* If there is no index then this value is ignored.
|
|
420
417
|
*
|
package/dist/sanitize.d.ts
CHANGED
|
@@ -1,23 +1,24 @@
|
|
|
1
|
+
import * as arrowModule from "apache-arrow";
|
|
1
2
|
import type { TKeys } from "apache-arrow/type";
|
|
2
|
-
import { DataType,
|
|
3
|
+
import { DataType, DenseUnion, Field, Schema, SchemaLike, SparseUnion, Table, TableLike, TimestampMicrosecond, TimestampMillisecond, TimestampNanosecond, TimestampSecond } from "./arrow";
|
|
3
4
|
export declare function sanitizeMetadata(metadataLike?: unknown): Map<string, string> | undefined;
|
|
4
|
-
export declare function sanitizeInt(typeLike: object): Int<Type.Int | Type.Int8 | Type.Int16 | Type.Int32 | Type.Int64 | Type.Uint8 | Type.Uint16 | Type.Uint32 | Type.Uint64>;
|
|
5
|
-
export declare function sanitizeFloat(typeLike: object): Float<Type.Float | Type.Float16 | Type.Float32 | Type.Float64>;
|
|
6
|
-
export declare function sanitizeDecimal(typeLike: object): Decimal;
|
|
7
|
-
export declare function sanitizeDate(typeLike: object): Date_<import("apache-arrow/type").Dates>;
|
|
8
|
-
export declare function sanitizeTime(typeLike: object): Time<Type.Time | Type.TimeSecond | Type.TimeMillisecond | Type.TimeMicrosecond | Type.TimeNanosecond>;
|
|
9
|
-
export declare function sanitizeTimestamp(typeLike: object): Timestamp<Type.Timestamp | Type.TimestampSecond | Type.TimestampMillisecond | Type.TimestampMicrosecond | Type.TimestampNanosecond>;
|
|
10
|
-
export declare function sanitizeTypedTimestamp(typeLike: object, Datatype: typeof TimestampNanosecond | typeof TimestampMicrosecond | typeof TimestampMillisecond | typeof TimestampSecond):
|
|
11
|
-
export declare function sanitizeInterval(typeLike: object): Interval<Type.Interval | Type.IntervalDayTime | Type.IntervalYearMonth>;
|
|
12
|
-
export declare function sanitizeList(typeLike: object): List<any>;
|
|
13
|
-
export declare function sanitizeStruct(typeLike: object): Struct<any>;
|
|
14
|
-
export declare function sanitizeUnion(typeLike: object): Union<Type.Union | Type.DenseUnion | Type.SparseUnion>;
|
|
15
|
-
export declare function sanitizeTypedUnion(typeLike: object, UnionType: typeof DenseUnion | typeof SparseUnion):
|
|
16
|
-
export declare function sanitizeFixedSizeBinary(typeLike: object): FixedSizeBinary;
|
|
17
|
-
export declare function sanitizeFixedSizeList(typeLike: object): FixedSizeList<any>;
|
|
18
|
-
export declare function sanitizeMap(typeLike: object): Map_<any, any>;
|
|
19
|
-
export declare function sanitizeDuration(typeLike: object): Duration<Type.Duration | Type.DurationSecond | Type.DurationMillisecond | Type.DurationMicrosecond | Type.DurationNanosecond>;
|
|
20
|
-
export declare function sanitizeDictionary(typeLike: object): Dictionary<DataType<Type, any>, TKeys>;
|
|
5
|
+
export declare function sanitizeInt(typeLike: object): arrowModule.Int<arrowModule.Type.Int | arrowModule.Type.Int8 | arrowModule.Type.Int16 | arrowModule.Type.Int32 | arrowModule.Type.Int64 | arrowModule.Type.Uint8 | arrowModule.Type.Uint16 | arrowModule.Type.Uint32 | arrowModule.Type.Uint64>;
|
|
6
|
+
export declare function sanitizeFloat(typeLike: object): arrowModule.Float<arrowModule.Type.Float | arrowModule.Type.Float16 | arrowModule.Type.Float32 | arrowModule.Type.Float64>;
|
|
7
|
+
export declare function sanitizeDecimal(typeLike: object): arrowModule.Decimal;
|
|
8
|
+
export declare function sanitizeDate(typeLike: object): arrowModule.Date_<import("apache-arrow/type").Dates>;
|
|
9
|
+
export declare function sanitizeTime(typeLike: object): arrowModule.Time<arrowModule.Type.Time | arrowModule.Type.TimeSecond | arrowModule.Type.TimeMillisecond | arrowModule.Type.TimeMicrosecond | arrowModule.Type.TimeNanosecond>;
|
|
10
|
+
export declare function sanitizeTimestamp(typeLike: object): arrowModule.Timestamp<arrowModule.Type.Timestamp | arrowModule.Type.TimestampSecond | arrowModule.Type.TimestampMillisecond | arrowModule.Type.TimestampMicrosecond | arrowModule.Type.TimestampNanosecond>;
|
|
11
|
+
export declare function sanitizeTypedTimestamp(typeLike: object, Datatype: typeof TimestampNanosecond | typeof TimestampMicrosecond | typeof TimestampMillisecond | typeof TimestampSecond): arrowModule.TimestampNanosecond | arrowModule.TimestampMicrosecond | arrowModule.TimestampMillisecond | arrowModule.TimestampSecond;
|
|
12
|
+
export declare function sanitizeInterval(typeLike: object): arrowModule.Interval<arrowModule.Type.Interval | arrowModule.Type.IntervalDayTime | arrowModule.Type.IntervalYearMonth | arrowModule.Type.IntervalMonthDayNano>;
|
|
13
|
+
export declare function sanitizeList(typeLike: object): arrowModule.List<any>;
|
|
14
|
+
export declare function sanitizeStruct(typeLike: object): arrowModule.Struct<any>;
|
|
15
|
+
export declare function sanitizeUnion(typeLike: object): arrowModule.Union<arrowModule.Type.Union | arrowModule.Type.DenseUnion | arrowModule.Type.SparseUnion>;
|
|
16
|
+
export declare function sanitizeTypedUnion(typeLike: object, UnionType: typeof DenseUnion | typeof SparseUnion): arrowModule.DenseUnion | arrowModule.SparseUnion;
|
|
17
|
+
export declare function sanitizeFixedSizeBinary(typeLike: object): arrowModule.FixedSizeBinary;
|
|
18
|
+
export declare function sanitizeFixedSizeList(typeLike: object): arrowModule.FixedSizeList<any>;
|
|
19
|
+
export declare function sanitizeMap(typeLike: object): arrowModule.Map_<any, any>;
|
|
20
|
+
export declare function sanitizeDuration(typeLike: object): arrowModule.Duration<arrowModule.Type.Duration | arrowModule.Type.DurationSecond | arrowModule.Type.DurationMillisecond | arrowModule.Type.DurationMicrosecond | arrowModule.Type.DurationNanosecond>;
|
|
21
|
+
export declare function sanitizeDictionary(typeLike: object): arrowModule.Dictionary<arrowModule.DataType<arrowModule.Type, any>, TKeys>;
|
|
21
22
|
export declare function sanitizeType(typeLike: unknown): DataType<any>;
|
|
22
23
|
export declare function sanitizeField(fieldLike: unknown): Field;
|
|
23
24
|
/**
|
package/dist/sanitize.js
CHANGED
|
@@ -32,8 +32,42 @@ exports.dataTypeFromName = dataTypeFromName;
|
|
|
32
32
|
// time. However, arrow-js uses instanceof which expected that the input
|
|
33
33
|
// comes from the exact same library instance. This is not always the case
|
|
34
34
|
// and so we must sanitize the input to ensure that it is compatible.
|
|
35
|
+
const arrowModule = require("apache-arrow");
|
|
35
36
|
const apache_arrow_1 = require("apache-arrow");
|
|
36
37
|
const arrow_1 = require("./arrow");
|
|
38
|
+
/**
|
|
39
|
+
* Whether `value` was created by *this* copy of apache-arrow's `ctor`.
|
|
40
|
+
*
|
|
41
|
+
* Arrow 21 overrides `Symbol.hasInstance` on `Schema`, `Field`, `Table`,
|
|
42
|
+
* `RecordBatch`, `Vector` and `Data` so that `instanceof` also matches objects
|
|
43
|
+
* built by a different copy of the library. Those are exactly the objects
|
|
44
|
+
* this module has to rebuild: the `DataType` instances nested inside them are
|
|
45
|
+
* deliberately *not* given that treatment upstream, so Arrow's own builders and
|
|
46
|
+
* writers reject them. Walk the real prototype chain instead of trusting
|
|
47
|
+
* `instanceof`.
|
|
48
|
+
*/
|
|
49
|
+
function isOwnInstance(value,
|
|
50
|
+
// biome-ignore lint/suspicious/noExplicitAny: matches any class constructor
|
|
51
|
+
ctor) {
|
|
52
|
+
return (typeof value === "object" &&
|
|
53
|
+
value !== null &&
|
|
54
|
+
Object.prototype.isPrototypeOf.call(ctor.prototype, value));
|
|
55
|
+
}
|
|
56
|
+
const NEWER_TYPES = [
|
|
57
|
+
{ name: "IntervalMonthDayNano", typeId: -31, since: 20 },
|
|
58
|
+
{ name: "LargeList", typeId: 21, since: 21 },
|
|
59
|
+
{ name: "BinaryView", typeId: 23, since: 21 },
|
|
60
|
+
{ name: "Utf8View", typeId: 24, since: 21 },
|
|
61
|
+
];
|
|
62
|
+
function newerTypeConstructor(name) {
|
|
63
|
+
const ctor = arrowModule[name];
|
|
64
|
+
if (typeof ctor !== "function") {
|
|
65
|
+
const since = NEWER_TYPES.find((t) => t.name === name)?.since;
|
|
66
|
+
throw new Error(`The Arrow type ${name} requires apache-arrow ${since} or newer, ` +
|
|
67
|
+
"but the installed apache-arrow does not provide it");
|
|
68
|
+
}
|
|
69
|
+
return ctor;
|
|
70
|
+
}
|
|
37
71
|
function createSanitizationContext() {
|
|
38
72
|
return {
|
|
39
73
|
types: new WeakMap(),
|
|
@@ -130,14 +164,21 @@ function sanitizeInterval(typeLike) {
|
|
|
130
164
|
function sanitizeList(typeLike) {
|
|
131
165
|
return sanitizeListWithContext(typeLike, createSanitizationContext());
|
|
132
166
|
}
|
|
133
|
-
function
|
|
167
|
+
function sanitizeListChildWithContext(typeLike, context, typeName) {
|
|
134
168
|
if (!("children" in typeLike) || !Array.isArray(typeLike.children)) {
|
|
135
|
-
throw Error(
|
|
169
|
+
throw Error(`Expected a ${typeName} type to have an array-like \`children\` property`);
|
|
136
170
|
}
|
|
137
171
|
if (typeLike.children.length !== 1) {
|
|
138
|
-
throw Error(
|
|
172
|
+
throw Error(`Expected a ${typeName} type to have exactly one child`);
|
|
139
173
|
}
|
|
140
|
-
return
|
|
174
|
+
return sanitizeFieldWithContext(typeLike.children[0], context);
|
|
175
|
+
}
|
|
176
|
+
function sanitizeListWithContext(typeLike, context) {
|
|
177
|
+
return new arrow_1.List(sanitizeListChildWithContext(typeLike, context, "List"));
|
|
178
|
+
}
|
|
179
|
+
function sanitizeLargeListWithContext(typeLike, context) {
|
|
180
|
+
const LargeList = newerTypeConstructor("LargeList");
|
|
181
|
+
return new LargeList(sanitizeListChildWithContext(typeLike, context, "LargeList"));
|
|
141
182
|
}
|
|
142
183
|
function sanitizeStruct(typeLike) {
|
|
143
184
|
return sanitizeStructWithContext(typeLike, createSanitizationContext());
|
|
@@ -274,7 +315,21 @@ function sanitizeTypeWithContext(typeLike, context) {
|
|
|
274
315
|
context.types.set(typeLike, type);
|
|
275
316
|
return type;
|
|
276
317
|
}
|
|
318
|
+
function sanitizeNewerTypeById(typeLike, typeId, context) {
|
|
319
|
+
const entry = NEWER_TYPES.find((t) => t.typeId === typeId);
|
|
320
|
+
if (entry === undefined) {
|
|
321
|
+
return undefined;
|
|
322
|
+
}
|
|
323
|
+
if (entry.name === "LargeList") {
|
|
324
|
+
return sanitizeLargeListWithContext(typeLike, context);
|
|
325
|
+
}
|
|
326
|
+
return new (newerTypeConstructor(entry.name))();
|
|
327
|
+
}
|
|
277
328
|
function sanitizeTypeById(typeLike, typeId, context) {
|
|
329
|
+
const newer = sanitizeNewerTypeById(typeLike, typeId, context);
|
|
330
|
+
if (newer !== undefined) {
|
|
331
|
+
return newer;
|
|
332
|
+
}
|
|
278
333
|
switch (typeId) {
|
|
279
334
|
case arrow_1.Type.NONE:
|
|
280
335
|
throw Error("Received a Type with a typeId of NONE");
|
|
@@ -386,7 +441,7 @@ function sanitizeField(fieldLike) {
|
|
|
386
441
|
return sanitizeFieldWithContext(fieldLike, createSanitizationContext());
|
|
387
442
|
}
|
|
388
443
|
function sanitizeFieldWithContext(fieldLike, context) {
|
|
389
|
-
if (fieldLike
|
|
444
|
+
if (isOwnInstance(fieldLike, arrow_1.Field)) {
|
|
390
445
|
return fieldLike;
|
|
391
446
|
}
|
|
392
447
|
if (typeof fieldLike !== "object" || fieldLike === null) {
|
|
@@ -429,7 +484,7 @@ function sanitizeSchema(schemaLike) {
|
|
|
429
484
|
return sanitizeSchemaWithContext(schemaLike, createSanitizationContext());
|
|
430
485
|
}
|
|
431
486
|
function sanitizeSchemaWithContext(schemaLike, context) {
|
|
432
|
-
if (schemaLike
|
|
487
|
+
if (isOwnInstance(schemaLike, arrow_1.Schema)) {
|
|
433
488
|
return schemaLike;
|
|
434
489
|
}
|
|
435
490
|
if (typeof schemaLike !== "object" || schemaLike === null) {
|
|
@@ -449,7 +504,7 @@ function sanitizeSchemaWithContext(schemaLike, context) {
|
|
|
449
504
|
return new arrow_1.Schema(sanitizedFields, metadata);
|
|
450
505
|
}
|
|
451
506
|
function sanitizeTable(tableLike) {
|
|
452
|
-
if (tableLike
|
|
507
|
+
if (isOwnInstance(tableLike, arrow_1.Table)) {
|
|
453
508
|
return tableLike;
|
|
454
509
|
}
|
|
455
510
|
if (typeof tableLike !== "object" || tableLike === null) {
|
|
@@ -467,7 +522,7 @@ function sanitizeTable(tableLike) {
|
|
|
467
522
|
return new arrow_1.Table(schema, batches);
|
|
468
523
|
}
|
|
469
524
|
function sanitizeRecordBatch(batchLike, context) {
|
|
470
|
-
if (batchLike
|
|
525
|
+
if (isOwnInstance(batchLike, arrow_1.RecordBatch)) {
|
|
471
526
|
return batchLike;
|
|
472
527
|
}
|
|
473
528
|
if (typeof batchLike !== "object" || batchLike === null) {
|
|
@@ -484,7 +539,7 @@ function sanitizeRecordBatch(batchLike, context) {
|
|
|
484
539
|
return new arrow_1.RecordBatch(schema, data);
|
|
485
540
|
}
|
|
486
541
|
function sanitizeData(dataLike, context) {
|
|
487
|
-
if (dataLike
|
|
542
|
+
if (isOwnInstance(dataLike, apache_arrow_1.Data)) {
|
|
488
543
|
return dataLike;
|
|
489
544
|
}
|
|
490
545
|
const cachedData = context.data.get(dataLike);
|
|
@@ -500,19 +555,26 @@ function sanitizeData(dataLike, context) {
|
|
|
500
555
|
context.vectors.set(dictionaryLike, dictionary);
|
|
501
556
|
}
|
|
502
557
|
}
|
|
503
|
-
|
|
558
|
+
// Arrow 21 added an eighth constructor parameter (`variadicBuffers`); older
|
|
559
|
+
// releases ignore the extra argument but their typings do not declare it.
|
|
560
|
+
const DataCtor = apache_arrow_1.Data;
|
|
561
|
+
const data = new DataCtor(sanitizeTypeWithContext(dataLike.type, context), dataLike.offset, dataLike.length, dataLike.nullCount, {
|
|
504
562
|
[apache_arrow_1.BufferType.OFFSET]: dataLike.valueOffsets,
|
|
505
563
|
[apache_arrow_1.BufferType.DATA]: dataLike.values,
|
|
506
564
|
[apache_arrow_1.BufferType.VALIDITY]: dataLike.nullBitmap,
|
|
507
565
|
[apache_arrow_1.BufferType.TYPE]: dataLike.typeIds,
|
|
508
|
-
}, dataLike.children.map((child) => sanitizeData(child, context)), dictionary);
|
|
566
|
+
}, dataLike.children.map((child) => sanitizeData(child, context)), dictionary, dataLike.variadicBuffers);
|
|
509
567
|
context.data.set(dataLike, data);
|
|
510
568
|
return data;
|
|
511
569
|
}
|
|
512
570
|
const constructorsByTypeName = {
|
|
513
571
|
null: () => new arrow_1.Null(),
|
|
514
572
|
binary: () => new arrow_1.Binary(),
|
|
573
|
+
largebinary: () => new arrow_1.LargeBinary(),
|
|
574
|
+
binaryview: () => new (newerTypeConstructor("BinaryView"))(),
|
|
515
575
|
utf8: () => new arrow_1.Utf8(),
|
|
576
|
+
largeutf8: () => new arrow_1.LargeUtf8(),
|
|
577
|
+
utf8view: () => new (newerTypeConstructor("Utf8View"))(),
|
|
516
578
|
bool: () => new arrow_1.Bool(),
|
|
517
579
|
int8: () => new arrow_1.Int8(),
|
|
518
580
|
int16: () => new arrow_1.Int16(),
|
|
@@ -533,6 +595,7 @@ const constructorsByTypeName = {
|
|
|
533
595
|
timesecond: () => new arrow_1.TimeSecond(),
|
|
534
596
|
intervaldaytime: () => new arrow_1.IntervalDayTime(),
|
|
535
597
|
intervalyearmonth: () => new arrow_1.IntervalYearMonth(),
|
|
598
|
+
intervalmonthdaynano: () => new (newerTypeConstructor("IntervalMonthDayNano"))(),
|
|
536
599
|
durationnanosecond: () => new arrow_1.DurationNanosecond(),
|
|
537
600
|
durationmicrosecond: () => new arrow_1.DurationMicrosecond(),
|
|
538
601
|
durationmillisecond: () => new arrow_1.DurationMillisecond(),
|
package/dist/schema.js
CHANGED
|
@@ -43,10 +43,18 @@ class SchemaInferrer {
|
|
|
43
43
|
else if (this.providedSchema === undefined) {
|
|
44
44
|
this.updateInferredField(path, value, row, current);
|
|
45
45
|
}
|
|
46
|
+
else if (current instanceof DeferredTypeEvidence) {
|
|
47
|
+
if (value != null) {
|
|
48
|
+
this.addSchemaField(this.providedSchema, path, value, row);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
else if (current instanceof FieldTree || apache_arrow_1.DataType.isStruct(current)) {
|
|
52
|
+
assertStructValue(path, value, row);
|
|
53
|
+
}
|
|
46
54
|
}
|
|
47
55
|
addField(path, value, row) {
|
|
48
56
|
if (this.providedSchema !== undefined) {
|
|
49
|
-
this.addSchemaField(this.providedSchema, path, row);
|
|
57
|
+
this.addSchemaField(this.providedSchema, path, value, row);
|
|
50
58
|
return;
|
|
51
59
|
}
|
|
52
60
|
const evidence = this.inferType(value, path) ?? DeferredTypeEvidence.from(value, row);
|
|
@@ -58,12 +66,18 @@ class SchemaInferrer {
|
|
|
58
66
|
throw branchConflictError(conflict, row, "Struct");
|
|
59
67
|
}
|
|
60
68
|
}
|
|
61
|
-
addSchemaField(schema, path, row) {
|
|
69
|
+
addSchemaField(schema, path, value, row) {
|
|
62
70
|
const field = fieldAtPath(schema, path);
|
|
63
71
|
if (field === undefined) {
|
|
64
72
|
throw new Error(`Found field not in schema: ${path.join(".")} at row ${row}`);
|
|
65
73
|
}
|
|
66
|
-
|
|
74
|
+
if (apache_arrow_1.DataType.isStruct(field.type)) {
|
|
75
|
+
assertStructValue(path, value, row);
|
|
76
|
+
}
|
|
77
|
+
// Nulls are kept as deferred evidence so that a struct field seen first as
|
|
78
|
+
// null can be replaced by a record in a later row, just as a record seen
|
|
79
|
+
// first already ignores later nulls.
|
|
80
|
+
const conflict = this.fields.set(path, DeferredTypeEvidence.from(value, row) ?? field.type, (existing) => existing instanceof DeferredTypeEvidence && existing.isOnlyNulls());
|
|
67
81
|
if (conflict !== undefined) {
|
|
68
82
|
throw branchConflictError(conflict, row, "Struct");
|
|
69
83
|
}
|
|
@@ -332,6 +346,20 @@ function assertSupportedValue(value, field, row) {
|
|
|
332
346
|
throw new Error(`Unsupported object value for field ${field} at row ${row}.`);
|
|
333
347
|
}
|
|
334
348
|
}
|
|
349
|
+
/**
|
|
350
|
+
* Rejects primitives, arrays, and typed arrays given for a struct field, which
|
|
351
|
+
* would otherwise be written as a struct with every child null.
|
|
352
|
+
*/
|
|
353
|
+
function assertStructValue(path, value, row) {
|
|
354
|
+
if (value == null ||
|
|
355
|
+
(typeof value === "object" &&
|
|
356
|
+
!Array.isArray(value) &&
|
|
357
|
+
!ArrayBuffer.isView(value))) {
|
|
358
|
+
return;
|
|
359
|
+
}
|
|
360
|
+
const kind = typeof value === "object" ? value.constructor.name : typeof value;
|
|
361
|
+
throw new Error(`Expected a struct value for field ${path.join(".")} at row ${row}, got ${kind}.`);
|
|
362
|
+
}
|
|
335
363
|
function fieldAtPath(schema, path) {
|
|
336
364
|
let fields = schema.fields;
|
|
337
365
|
let field;
|
package/dist/table.d.ts
CHANGED
|
@@ -556,7 +556,7 @@ export declare abstract class Table {
|
|
|
556
556
|
* it: rejects tables that carry no view definition.
|
|
557
557
|
* @ignore
|
|
558
558
|
*/
|
|
559
|
-
abstract refreshMaterializedView(
|
|
559
|
+
abstract refreshMaterializedView(sourceVersion?: number): Promise<RefreshMaterializedViewResult>;
|
|
560
560
|
/** @ignore */
|
|
561
561
|
abstract materializedViewDefinition(): Promise<string>;
|
|
562
562
|
/**
|
|
@@ -929,7 +929,7 @@ export declare class LocalTable extends Table {
|
|
|
929
929
|
refreshColumn(column: string): Promise<RefreshColumnResult>;
|
|
930
930
|
refreshColumnAsync(column: string): Promise<Job>;
|
|
931
931
|
functionErrors(options?: FunctionErrorsOptions): Promise<FunctionErrors>;
|
|
932
|
-
refreshMaterializedView(
|
|
932
|
+
refreshMaterializedView(sourceVersion?: number): Promise<RefreshMaterializedViewResult>;
|
|
933
933
|
materializedViewDefinition(): Promise<string>;
|
|
934
934
|
alterColumns(columnAlterations: ColumnAlteration[]): Promise<AlterColumnsResult>;
|
|
935
935
|
updateFieldMetadata(updates: FieldMetadataUpdate[]): Promise<UpdateFieldMetadataResult>;
|
package/dist/table.js
CHANGED
|
@@ -280,8 +280,8 @@ class LocalTable extends Table {
|
|
|
280
280
|
(0, materialized_view_1.validateNonNegativeInteger)(options?.limit, "limit");
|
|
281
281
|
return await this.inner.functionErrors(options);
|
|
282
282
|
}
|
|
283
|
-
async refreshMaterializedView(
|
|
284
|
-
return await this.inner.refreshMaterializedView(
|
|
283
|
+
async refreshMaterializedView(sourceVersion) {
|
|
284
|
+
return await this.inner.refreshMaterializedView(sourceVersion);
|
|
285
285
|
}
|
|
286
286
|
async materializedViewDefinition() {
|
|
287
287
|
return await this.inner.materializedViewDefinition();
|
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"ann"
|
|
12
12
|
],
|
|
13
13
|
"private": false,
|
|
14
|
-
"version": "0.40.0-beta.
|
|
14
|
+
"version": "0.40.0-beta.13",
|
|
15
15
|
"main": "dist/index.js",
|
|
16
16
|
"exports": {
|
|
17
17
|
".": "./dist/index.js",
|
|
@@ -49,10 +49,14 @@
|
|
|
49
49
|
"@types/jest": "^29.1.2",
|
|
50
50
|
"@types/node": "22.7.4",
|
|
51
51
|
"@types/tmp": "^0.2.6",
|
|
52
|
+
"apache-arrow": "21.2.0",
|
|
52
53
|
"apache-arrow-15": "npm:apache-arrow@15.0.0",
|
|
53
54
|
"apache-arrow-16": "npm:apache-arrow@16.0.0",
|
|
54
55
|
"apache-arrow-17": "npm:apache-arrow@17.0.0",
|
|
55
56
|
"apache-arrow-18": "npm:apache-arrow@18.0.0",
|
|
57
|
+
"apache-arrow-19": "npm:apache-arrow@19.0.1",
|
|
58
|
+
"apache-arrow-20": "npm:apache-arrow@20.0.0",
|
|
59
|
+
"apache-arrow-21": "npm:apache-arrow@21.2.0",
|
|
56
60
|
"eslint": "^8.57.0",
|
|
57
61
|
"jest": "^29.7.0",
|
|
58
62
|
"shx": "^0.3.4",
|
|
@@ -106,17 +110,17 @@
|
|
|
106
110
|
"optionalDependencies": {
|
|
107
111
|
"@huggingface/transformers": "3.0.2",
|
|
108
112
|
"openai": "4.29.2",
|
|
109
|
-
"@lancedb/lancedb-darwin-arm64": "0.40.0-beta.
|
|
110
|
-
"@lancedb/lancedb-linux-x64-gnu": "0.40.0-beta.
|
|
111
|
-
"@lancedb/lancedb-linux-arm64-gnu": "0.40.0-beta.
|
|
112
|
-
"@lancedb/lancedb-linux-x64-musl": "0.40.0-beta.
|
|
113
|
-
"@lancedb/lancedb-linux-arm64-musl": "0.40.0-beta.
|
|
114
|
-
"@lancedb/lancedb-win32-x64-msvc": "0.40.0-beta.
|
|
115
|
-
"@lancedb/lancedb-win32-arm64-msvc": "0.40.0-beta.
|
|
113
|
+
"@lancedb/lancedb-darwin-arm64": "0.40.0-beta.13",
|
|
114
|
+
"@lancedb/lancedb-linux-x64-gnu": "0.40.0-beta.13",
|
|
115
|
+
"@lancedb/lancedb-linux-arm64-gnu": "0.40.0-beta.13",
|
|
116
|
+
"@lancedb/lancedb-linux-x64-musl": "0.40.0-beta.13",
|
|
117
|
+
"@lancedb/lancedb-linux-arm64-musl": "0.40.0-beta.13",
|
|
118
|
+
"@lancedb/lancedb-win32-x64-msvc": "0.40.0-beta.13",
|
|
119
|
+
"@lancedb/lancedb-win32-arm64-msvc": "0.40.0-beta.13"
|
|
116
120
|
},
|
|
117
121
|
"peerDependencies": {
|
|
118
122
|
"@types/node": ">=22",
|
|
119
|
-
"apache-arrow": ">=15.0.0
|
|
123
|
+
"apache-arrow": ">=15.0.0 <22.0.0"
|
|
120
124
|
},
|
|
121
125
|
"peerDependenciesMeta": {
|
|
122
126
|
"@types/node": {
|