@lancedb/lancedb 0.39.0-beta.6 → 0.39.0-beta.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/arrow.d.ts CHANGED
@@ -208,7 +208,7 @@ export declare function makeEmptyTable(schema: SchemaLike, metadata?: Map<string
208
208
  * customized by the `embeddingDataType` property of the embedding function.
209
209
  *
210
210
  * If a schema is provided in `makeTableOptions` then it should include the
211
- * embedding columns. If no schema is provded then embedding columns will
211
+ * embedding columns. If no schema is provided then embedding columns will
212
212
  * be placed at the end of the table, after all of the input columns.
213
213
  */
214
214
  export declare function convertToTable(data: Array<Record<string, unknown>>, embeddings?: EmbeddingFunctionConfig, makeTableOptions?: Partial<MakeArrowTableOptions>): Promise<ArrowTable>;
package/dist/arrow.js CHANGED
@@ -57,6 +57,7 @@ exports.ensureNestedFieldsExist = ensureNestedFieldsExist;
57
57
  exports.dataTypeToJson = dataTypeToJson;
58
58
  const apache_arrow_1 = require("apache-arrow");
59
59
  const arrow_type_1 = require("./arrow_type");
60
+ const blob_1 = require("./blob");
60
61
  const registry_1 = require("./embedding/registry");
61
62
  const sanitize_1 = require("./sanitize");
62
63
  const schema_1 = require("./schema");
@@ -348,17 +349,39 @@ function makeArrowTable(data, options, metadata) {
348
349
  }
349
350
  else {
350
351
  schema = new apache_arrow_1.Schema(schema.fields, schemaMetadata);
352
+ validateBlobSchema(schema);
351
353
  return new apache_arrow_1.Table(schema);
352
354
  }
353
355
  }
354
356
  let inferredSchema = (0, schema_1.inferSchema)(data, schema, opt);
355
357
  inferredSchema = new apache_arrow_1.Schema(inferredSchema.fields, schemaMetadata);
358
+ validateBlobSchema(inferredSchema);
356
359
  const finalColumns = {};
357
360
  for (const field of inferredSchema.fields) {
358
361
  finalColumns[field.name] = transposeData(data, field);
359
362
  }
360
363
  return new apache_arrow_1.Table(inferredSchema, finalColumns);
361
364
  }
365
+ function validateBlobSchema(schema) {
366
+ for (const field of schema.fields) {
367
+ validateBlobField(field);
368
+ }
369
+ }
370
+ function validateBlobField(field) {
371
+ if (isFixedSizeList(field.type) &&
372
+ containsBlobField(field.type.children[0])) {
373
+ throw new Error("Blob fields inside FixedSizeList are not supported. Use List instead.");
374
+ }
375
+ for (const child of field.type.children ?? []) {
376
+ validateBlobField(child);
377
+ }
378
+ }
379
+ function containsBlobField(field) {
380
+ if ((0, blob_1.isBlobField)(field)) {
381
+ return true;
382
+ }
383
+ return (field.type.children ?? []).some((child) => containsBlobField(child));
384
+ }
362
385
  function isObject(value) {
363
386
  return (typeof value === "object" &&
364
387
  value !== null &&
@@ -387,6 +410,27 @@ function valueAtPath(datum, path) {
387
410
  }
388
411
  function transposeData(data, field, path = []) {
389
412
  const valuesPath = [...path, field.name];
413
+ if ((0, blob_1.isBlobField)(field) && field.type instanceof apache_arrow_1.Struct) {
414
+ const blobRows = data.map((datum) => (0, blob_1.coerceBlobValue)(valueAtPath(datum, valuesPath)));
415
+ const childVectors = field.type.children.map((child) => {
416
+ const values = blobRows.map((row) => row == null ? null : (row[child.name] ?? null));
417
+ return makeVector(values, child.type, undefined, child.nullable);
418
+ });
419
+ const nullCount = blobRows.filter((row) => row === null).length;
420
+ const structData = (0, apache_arrow_1.makeData)({
421
+ type: field.type,
422
+ length: blobRows.length,
423
+ nullCount,
424
+ nullBitmap: nullCount > 0
425
+ ? apache_arrow_1.util.packBools(blobRows.map((row) => row !== null))
426
+ : undefined,
427
+ children: childVectors.map((v) => v.data[0]),
428
+ });
429
+ return (0, apache_arrow_1.makeVector)(structData);
430
+ }
431
+ if (isList(field.type) && containsBlobField(field.type.children[0])) {
432
+ return transposeListData(data, field, valuesPath);
433
+ }
390
434
  const values = data.map((datum) => valueAtPath(datum, valuesPath));
391
435
  if (field.type instanceof apache_arrow_1.Struct) {
392
436
  const childFields = field.type.children;
@@ -401,7 +445,7 @@ function transposeData(data, field, path = []) {
401
445
  nullBitmap: nullCount > 0
402
446
  ? apache_arrow_1.util.packBools(values.map((value) => value !== null))
403
447
  : undefined,
404
- children: childVectors,
448
+ children: childVectors.map((v) => v.data[0]),
405
449
  });
406
450
  return (0, apache_arrow_1.makeVector)(structData);
407
451
  }
@@ -409,6 +453,39 @@ function transposeData(data, field, path = []) {
409
453
  return makeVector(values, field.type, undefined, field.nullable);
410
454
  }
411
455
  }
456
+ function transposeListData(data, field, valuesPath) {
457
+ const listType = field.type;
458
+ const childField = listType.children[0];
459
+ const lists = data.map((datum) => valueAtPath(datum, valuesPath));
460
+ const flattened = [];
461
+ const validity = [];
462
+ const offsets = [0];
463
+ for (const list of lists) {
464
+ if (list == null) {
465
+ validity.push(false);
466
+ offsets.push(flattened.length);
467
+ continue;
468
+ }
469
+ if (!Array.isArray(list)) {
470
+ throw new Error(`expected an array for list field '${field.name}'`);
471
+ }
472
+ validity.push(true);
473
+ for (const element of list) {
474
+ flattened.push({ [childField.name]: element });
475
+ }
476
+ offsets.push(flattened.length);
477
+ }
478
+ const childVector = transposeData(flattened, childField, []);
479
+ const nullCount = validity.filter((valid) => !valid).length;
480
+ return (0, apache_arrow_1.makeVector)((0, apache_arrow_1.makeData)({
481
+ type: listType,
482
+ length: lists.length,
483
+ nullCount,
484
+ nullBitmap: nullCount > 0 ? apache_arrow_1.util.packBools(validity) : undefined,
485
+ valueOffsets: Int32Array.from(offsets),
486
+ child: childVector.data[0],
487
+ }));
488
+ }
412
489
  /**
413
490
  * Create an empty Arrow table with the provided schema
414
491
  */
@@ -497,7 +574,7 @@ function makeVector(values, type, stringAsDictionary, nullable) {
497
574
  return vectorFromArray(values, type);
498
575
  }
499
576
  if (values.length === 0) {
500
- throw Error("makeVector requires at least one value or the type must be specfied");
577
+ throw Error("makeVector requires at least one value or the type must be specified");
501
578
  }
502
579
  const sampleValue = values.find((val) => val !== null && val !== undefined);
503
580
  if (sampleValue === undefined) {
@@ -688,7 +765,7 @@ async function applyEmbeddings(table, embeddings, schema) {
688
765
  * customized by the `embeddingDataType` property of the embedding function.
689
766
  *
690
767
  * If a schema is provided in `makeTableOptions` then it should include the
691
- * embedding columns. If no schema is provded then embedding columns will
768
+ * embedding columns. If no schema is provided then embedding columns will
692
769
  * be placed at the end of the table, after all of the input columns.
693
770
  */
694
771
  async function convertToTable(data, embeddings, makeTableOptions) {
@@ -752,6 +829,7 @@ async function fromTableToBuffer(table, embeddings, schema) {
752
829
  schema = (0, sanitize_1.sanitizeSchema)(schema);
753
830
  }
754
831
  const tableWithEmbeddings = await applyEmbeddings(table, embeddings, schema);
832
+ validateBlobSchema(tableWithEmbeddings.schema);
755
833
  const writer = apache_arrow_1.RecordBatchFileWriter.writeAll(tableWithEmbeddings);
756
834
  return Buffer.from(await writer.toUint8Array());
757
835
  }
package/dist/blob.d.ts ADDED
@@ -0,0 +1,92 @@
1
+ import { Field } from "apache-arrow";
2
+ import { BlobFile as NativeBlobFile } from "./native";
3
+ export type BlobInput = {
4
+ data: Buffer | Uint8Array | null;
5
+ uri: string | null;
6
+ };
7
+ export type BlobOptions = {
8
+ /** Defaults to true. */
9
+ nullable?: boolean;
10
+ /**
11
+ * Max payload bytes kept inline in the data file. Zero is allowed. Must be a
12
+ * safe integer.
13
+ */
14
+ inlineSizeThreshold?: number;
15
+ /**
16
+ * Max payload bytes stored in a packed sidecar before a dedicated file. Must
17
+ * be a positive safe integer.
18
+ */
19
+ dedicatedSizeThreshold?: number;
20
+ /**
21
+ * Max bytes in one packed sidecar before starting another. Must be a positive
22
+ * safe integer.
23
+ */
24
+ packFileSizeThreshold?: number;
25
+ };
26
+ /**
27
+ * Declares a `lance.blob.v2` column.
28
+ *
29
+ * Query results are descriptors, not payload bytes. Use {@link Table.fetchBlobs}
30
+ * or {@link Table.fetchBlobFiles} to read bytes.
31
+ *
32
+ * @example
33
+ * ```ts
34
+ * import { readFile } from "node:fs/promises";
35
+ * import { Field, Int64, Schema } from "apache-arrow";
36
+ * import { blob, connect } from "@lancedb/lancedb";
37
+ *
38
+ * const db = await connect("./data");
39
+ * const video = await readFile("clip.mp4");
40
+ * const table = await db.createTable(
41
+ * "videos",
42
+ * [{ id: 1n, video }],
43
+ * {
44
+ * schema: new Schema([
45
+ * new Field("id", new Int64()),
46
+ * blob("video"),
47
+ * ]),
48
+ * },
49
+ * );
50
+ *
51
+ * const rows = await table.query().select(["id"]).withRowId().toArray();
52
+ * const rowIds = rows.map((row) => row._rowid as bigint);
53
+ * const bytes = await table.fetchBlobs("video", rowIds);
54
+ *
55
+ * const [handle] = await table.fetchBlobFiles("video", rowIds);
56
+ * const size = handle!.size();
57
+ * const header = await handle!.readRange(0n, size < 65536n ? size : 65536n);
58
+ * ```
59
+ */
60
+ export declare function blob(name: string, options?: BlobOptions): Field;
61
+ /**
62
+ * Checks for the `lance.blob.v2` extension marker. Does not validate the
63
+ * field's storage type.
64
+ */
65
+ export declare function isBlobField(field: Field): boolean;
66
+ /**
67
+ * A lazy handle to blob bytes. Create one with {@link Table.fetchBlobFiles}.
68
+ *
69
+ * @hideconstructor
70
+ */
71
+ export declare class BlobFile {
72
+ private readonly inner;
73
+ private constructor();
74
+ /** @ignore */
75
+ static fromNative(inner: NativeBlobFile): BlobFile;
76
+ /** Returns the blob size in bytes. */
77
+ size(): bigint;
78
+ /**
79
+ * Reads from the cursor to the end and advances the cursor.
80
+ *
81
+ * A second call returns an empty buffer. {@link BlobFile.readRange} does
82
+ * not move the cursor.
83
+ */
84
+ read(): Promise<Buffer>;
85
+ /**
86
+ * Reads the half-open byte range `[start, end)`.
87
+ *
88
+ * Fails when `end` is past the blob size. Does not move the cursor.
89
+ */
90
+ readRange(start: bigint, end: bigint): Promise<Buffer>;
91
+ }
92
+ export declare function coerceBlobValue(value: unknown): BlobInput | null;
package/dist/blob.js ADDED
@@ -0,0 +1,165 @@
1
+ "use strict";
2
+ // SPDX-License-Identifier: Apache-2.0
3
+ // SPDX-FileCopyrightText: Copyright The LanceDB Authors
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.BlobFile = void 0;
6
+ exports.blob = blob;
7
+ exports.isBlobField = isBlobField;
8
+ exports.coerceBlobValue = coerceBlobValue;
9
+ const apache_arrow_1 = require("apache-arrow");
10
+ const native_1 = require("./native");
11
+ const BLOB_V2_EXTENSION_NAME = "lance.blob.v2";
12
+ const INLINE_SIZE_THRESHOLD_KEY = "lance-encoding:blob-inline-size-threshold";
13
+ const DEDICATED_SIZE_THRESHOLD_KEY = "lance-encoding:blob-dedicated-size-threshold";
14
+ const PACK_FILE_SIZE_THRESHOLD_KEY = "lance-encoding:blob-pack-file-size-threshold";
15
+ /**
16
+ * Declares a `lance.blob.v2` column.
17
+ *
18
+ * Query results are descriptors, not payload bytes. Use {@link Table.fetchBlobs}
19
+ * or {@link Table.fetchBlobFiles} to read bytes.
20
+ *
21
+ * @example
22
+ * ```ts
23
+ * import { readFile } from "node:fs/promises";
24
+ * import { Field, Int64, Schema } from "apache-arrow";
25
+ * import { blob, connect } from "@lancedb/lancedb";
26
+ *
27
+ * const db = await connect("./data");
28
+ * const video = await readFile("clip.mp4");
29
+ * const table = await db.createTable(
30
+ * "videos",
31
+ * [{ id: 1n, video }],
32
+ * {
33
+ * schema: new Schema([
34
+ * new Field("id", new Int64()),
35
+ * blob("video"),
36
+ * ]),
37
+ * },
38
+ * );
39
+ *
40
+ * const rows = await table.query().select(["id"]).withRowId().toArray();
41
+ * const rowIds = rows.map((row) => row._rowid as bigint);
42
+ * const bytes = await table.fetchBlobs("video", rowIds);
43
+ *
44
+ * const [handle] = await table.fetchBlobFiles("video", rowIds);
45
+ * const size = handle!.size();
46
+ * const header = await handle!.readRange(0n, size < 65536n ? size : 65536n);
47
+ * ```
48
+ */
49
+ function blob(name, options = {}) {
50
+ const metadata = new Map([
51
+ ["ARROW:extension:name", BLOB_V2_EXTENSION_NAME],
52
+ ]);
53
+ setThreshold(metadata, INLINE_SIZE_THRESHOLD_KEY, "inlineSizeThreshold", options.inlineSizeThreshold, 0);
54
+ setThreshold(metadata, DEDICATED_SIZE_THRESHOLD_KEY, "dedicatedSizeThreshold", options.dedicatedSizeThreshold, 1);
55
+ setThreshold(metadata, PACK_FILE_SIZE_THRESHOLD_KEY, "packFileSizeThreshold", options.packFileSizeThreshold, 1);
56
+ return new apache_arrow_1.Field(name, new apache_arrow_1.Struct([
57
+ new apache_arrow_1.Field("data", new apache_arrow_1.LargeBinary(), true),
58
+ new apache_arrow_1.Field("uri", new apache_arrow_1.Utf8(), true),
59
+ ]), options.nullable ?? true, metadata);
60
+ }
61
+ /**
62
+ * Checks for the `lance.blob.v2` extension marker. Does not validate the
63
+ * field's storage type.
64
+ */
65
+ function isBlobField(field) {
66
+ return field.metadata?.get("ARROW:extension:name") === BLOB_V2_EXTENSION_NAME;
67
+ }
68
+ /**
69
+ * A lazy handle to blob bytes. Create one with {@link Table.fetchBlobFiles}.
70
+ *
71
+ * @hideconstructor
72
+ */
73
+ class BlobFile {
74
+ inner;
75
+ constructor(inner) {
76
+ if (!(inner instanceof native_1.BlobFile)) {
77
+ throw new Error("BlobFile handles come from Table.fetchBlobFiles");
78
+ }
79
+ this.inner = inner;
80
+ }
81
+ /** @ignore */
82
+ static fromNative(inner) {
83
+ return new BlobFile(inner);
84
+ }
85
+ /** Returns the blob size in bytes. */
86
+ size() {
87
+ return this.inner.size();
88
+ }
89
+ /**
90
+ * Reads from the cursor to the end and advances the cursor.
91
+ *
92
+ * A second call returns an empty buffer. {@link BlobFile.readRange} does
93
+ * not move the cursor.
94
+ */
95
+ read() {
96
+ return this.inner.read();
97
+ }
98
+ /**
99
+ * Reads the half-open byte range `[start, end)`.
100
+ *
101
+ * Fails when `end` is past the blob size. Does not move the cursor.
102
+ */
103
+ readRange(start, end) {
104
+ return this.inner.readRange(start, end);
105
+ }
106
+ }
107
+ exports.BlobFile = BlobFile;
108
+ function coerceBlobValue(value) {
109
+ if (value == null) {
110
+ return null;
111
+ }
112
+ if (isBlobBytes(value)) {
113
+ return { data: value, uri: null };
114
+ }
115
+ if (ArrayBuffer.isView(value)) {
116
+ throw new Error("Blob data must be Buffer or Uint8Array");
117
+ }
118
+ if (typeof value === "string") {
119
+ if (value === "") {
120
+ throw new Error("Blob uri cannot be empty");
121
+ }
122
+ return { data: null, uri: value };
123
+ }
124
+ if (typeof value === "object") {
125
+ const record = value;
126
+ if (!("data" in record) && !("uri" in record)) {
127
+ throw new Error("Blob struct values must include a 'data' or 'uri' field");
128
+ }
129
+ const uri = record.uri;
130
+ if (uri === "") {
131
+ throw new Error("Blob uri cannot be empty");
132
+ }
133
+ if (uri != null && typeof uri !== "string") {
134
+ throw new Error(`Blob uri must be a string or null, got ${typeof uri}`);
135
+ }
136
+ const data = record.data;
137
+ if (data != null && !isBlobBytes(data)) {
138
+ throw new Error("Blob data must be Buffer, Uint8Array, or null");
139
+ }
140
+ const bytes = data ?? null;
141
+ const uriValue = uri ?? null;
142
+ if ((bytes == null) === (uriValue == null)) {
143
+ throw new Error("Blob struct values must set exactly one of 'data' or 'uri'");
144
+ }
145
+ return { data: bytes, uri: uriValue };
146
+ }
147
+ throw new Error("Blob column values must be Buffer, Uint8Array, a URI string, null, or { data?, uri? }");
148
+ }
149
+ function isBlobBytes(value) {
150
+ return Buffer.isBuffer(value) || value instanceof Uint8Array;
151
+ }
152
+ function setThreshold(metadata, key, optionName, value, minimum) {
153
+ if (value === undefined) {
154
+ return;
155
+ }
156
+ if (!Number.isSafeInteger(value)) {
157
+ throw new Error(`${optionName} must be a safe integer`);
158
+ }
159
+ if (value < minimum) {
160
+ throw new Error(minimum <= 0
161
+ ? `${optionName} must be non-negative`
162
+ : `${optionName} must be positive`);
163
+ }
164
+ metadata.set(key, String(value));
165
+ }
package/dist/index.d.ts CHANGED
@@ -8,6 +8,8 @@ export { JsHeaderProvider as NativeJsHeaderProvider } from "./native.js";
8
8
  export { instrumentLanceDbMetrics } from "./otel";
9
9
  export { AddColumnsSql, ConnectionOptions, ConnectNamespaceOptions, IndexStatistics, IndexConfig, ClientConfig, TimeoutConfig, RetryConfig, TlsConfig, OptimizeStats, CompactionStats, RemovalStats, TableStatistics, FragmentStatistics, FragmentSummaryStats, Tags, TagContents, BranchContents, MergeResult, AddResult, AddColumnsResult, RefreshColumnResult, RefreshMaterializedViewResult, AlterColumnsResult, UpdateFieldMetadataResult, DeleteResult, DropColumnsResult, UpdateResult, SplitCalculatedOptions, SplitRandomOptions, SplitHashOptions, SplitSequentialOptions, ShuffleOptions, OAuthConfig as NativeOAuthConfig, } from "./native.js";
10
10
  export { makeArrowTable, MakeArrowTableOptions, Data, VectorColumnOptions, } from "./arrow";
11
+ export { blob, isBlobField, BlobFile } from "./blob";
12
+ export type { BlobOptions } from "./blob";
11
13
  export { Connection, CreateTableOptions, TableNamesOptions, ListTablesOptions, OpenTableOptions, ListNamespacesOptions, CreateNamespaceOptions, DropNamespaceOptions, ListNamespacesResponse, ListTablesResponse, CreateNamespaceResponse, DropNamespaceResponse, DescribeNamespaceResponse, RenameTableOptions, } from "./connection";
12
14
  export { JobFailureInfo, JobInfo, Session } from "./native.js";
13
15
  export { Job, JobEventsOptions } from "./job";
package/dist/index.js CHANGED
@@ -2,7 +2,7 @@
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
  // SPDX-FileCopyrightText: Copyright The LanceDB Authors
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
- exports.packBits = exports.rerankers = exports.Scannable = exports.PermutationBuilder = exports.permutationBuilder = exports.embedding = exports.MergeInsertBuilder = exports.OAuthFlowType = exports.OAuthHeaderProvider = exports.StaticHeaderProvider = exports.HeaderProvider = exports.Branches = exports.Table = exports.Index = exports.Occur = exports.Operator = exports.FullTextQueryType = exports.BooleanQuery = exports.MultiMatchQuery = exports.BoostQuery = exports.PhraseQuery = exports.MatchQuery = exports.RecordBatchIterator = exports.TakeQuery = exports.VectorQuery = exports.QueryBase = exports.Query = exports.AutoQuery = exports.Job = exports.Session = exports.Connection = exports.VectorColumnOptions = exports.MakeArrowTableOptions = exports.makeArrowTable = exports.BranchContents = exports.TagContents = exports.Tags = exports.instrumentLanceDbMetrics = exports.NativeJsHeaderProvider = exports.MaterializedView = void 0;
5
+ exports.packBits = exports.rerankers = exports.Scannable = exports.PermutationBuilder = exports.permutationBuilder = exports.embedding = exports.MergeInsertBuilder = exports.OAuthFlowType = exports.OAuthHeaderProvider = exports.StaticHeaderProvider = exports.HeaderProvider = exports.Branches = exports.Table = exports.Index = exports.Occur = exports.Operator = exports.FullTextQueryType = exports.BooleanQuery = exports.MultiMatchQuery = exports.BoostQuery = exports.PhraseQuery = exports.MatchQuery = exports.RecordBatchIterator = exports.TakeQuery = exports.VectorQuery = exports.QueryBase = exports.Query = exports.AutoQuery = exports.Job = exports.Session = exports.Connection = exports.BlobFile = exports.isBlobField = exports.blob = exports.VectorColumnOptions = exports.MakeArrowTableOptions = exports.makeArrowTable = exports.BranchContents = exports.TagContents = exports.Tags = exports.instrumentLanceDbMetrics = exports.NativeJsHeaderProvider = exports.MaterializedView = void 0;
6
6
  exports.tokenize = tokenize;
7
7
  exports.connect = connect;
8
8
  exports.connectNamespace = connectNamespace;
@@ -26,6 +26,10 @@ var arrow_1 = require("./arrow");
26
26
  Object.defineProperty(exports, "makeArrowTable", { enumerable: true, get: function () { return arrow_1.makeArrowTable; } });
27
27
  Object.defineProperty(exports, "MakeArrowTableOptions", { enumerable: true, get: function () { return arrow_1.MakeArrowTableOptions; } });
28
28
  Object.defineProperty(exports, "VectorColumnOptions", { enumerable: true, get: function () { return arrow_1.VectorColumnOptions; } });
29
+ var blob_1 = require("./blob");
30
+ Object.defineProperty(exports, "blob", { enumerable: true, get: function () { return blob_1.blob; } });
31
+ Object.defineProperty(exports, "isBlobField", { enumerable: true, get: function () { return blob_1.isBlobField; } });
32
+ Object.defineProperty(exports, "BlobFile", { enumerable: true, get: function () { return blob_1.BlobFile; } });
29
33
  var connection_2 = require("./connection");
30
34
  Object.defineProperty(exports, "Connection", { enumerable: true, get: function () { return connection_2.Connection; } });
31
35
  var native_js_4 = require("./native.js");
package/dist/indices.d.ts CHANGED
@@ -20,7 +20,7 @@ export interface IvfPqOptions {
20
20
  * This value controls how much the vector is compressed during the quantization step.
21
21
  * The more sub vectors there are the less the vector is compressed. The default is
22
22
  * the dimension of the vector divided by 16. If the dimension is not evenly divisible
23
- * by 16 we use the dimension divded by 8.
23
+ * by 16 we use the dimension divided by 8.
24
24
  *
25
25
  * The above two cases are highly preferred. Having 8 or 16 values per subvector allows
26
26
  * us to use efficient SIMD instructions.
@@ -210,7 +210,7 @@ export interface HnswPqOptions {
210
210
  * This value controls how much the vector is compressed during the quantization step.
211
211
  * The more sub vectors there are the less the vector is compressed. The default is
212
212
  * the dimension of the vector divided by 16. If the dimension is not evenly divisible
213
- * by 16 we use the dimension divded by 8.
213
+ * by 16 we use the dimension divided by 8.
214
214
  *
215
215
  * The above two cases are highly preferred. Having 8 or 16 values per subvector allows
216
216
  * us to use efficient SIMD instructions.
@@ -678,7 +678,7 @@ export interface IndexOptions {
678
678
  /**
679
679
  * Advanced index configuration
680
680
  *
681
- * This option allows you to specify a specfic index to create and also
681
+ * This option allows you to specify a specific index to create and also
682
682
  * allows you to pass in configuration for training the index.
683
683
  *
684
684
  * See the static methods on Index for details on the various index types.
package/dist/merge.d.ts CHANGED
@@ -15,7 +15,7 @@ export declare class MergeInsertBuilder {
15
15
  * but that behavior is subject to change.
16
16
  *
17
17
  * An optional condition may be specified. If it is, then only
18
- * matched rows that satisfy the condtion will be updated. Any
18
+ * matched rows that satisfy the condition will be updated. Any
19
19
  * rows that do not satisfy the condition will be left as they
20
20
  * are. Failing to satisfy the condition does not cause a
21
21
  * "matched row" to become a "not matched" row.
package/dist/merge.js CHANGED
@@ -23,7 +23,7 @@ class MergeInsertBuilder {
23
23
  * but that behavior is subject to change.
24
24
  *
25
25
  * An optional condition may be specified. If it is, then only
26
- * matched rows that satisfy the condtion will be updated. Any
26
+ * matched rows that satisfy the condition will be updated. Any
27
27
  * rows that do not satisfy the condition will be left as they
28
28
  * are. Failing to satisfy the condition does not cause a
29
29
  * "matched row" to become a "not matched" row.
package/dist/native.d.ts CHANGED
@@ -1,5 +1,11 @@
1
1
  /* auto-generated by NAPI-RS */
2
2
  /* eslint-disable */
3
+ export declare class BlobFile {
4
+ size(): bigint
5
+ read(): Promise<Buffer>
6
+ readRange(start: bigint, end: bigint): Promise<Buffer>
7
+ }
8
+
3
9
  export declare class BranchContents {
4
10
  parentBranch?: string
5
11
  parentVersion: number
@@ -310,6 +316,9 @@ export declare class Table {
310
316
  querySnapshot(): Promise<Table>
311
317
  takeOffsets(offsets: Array<number>): TakeQuery
312
318
  takeRowIds(rowIds: Array<bigint>): TakeQuery
319
+ blobColumns(): Promise<Array<string>>
320
+ fetchBlobs(column: string, rowIds: Array<bigint>): Promise<Array<Buffer | undefined | null>>
321
+ fetchBlobFiles(column: string, rowIds: Array<bigint>): Promise<Array<BlobFile | undefined | null>>
313
322
  vectorSearch(vector: Float32Array): VectorQuery
314
323
  addColumns(transforms: Array<AddColumnsSql>): Promise<AddColumnsResult>
315
324
  addComputedColumns(columns: Array<AddColumnsSql>): Promise<AddColumnsResult>
package/dist/native.js CHANGED
@@ -76,8 +76,8 @@ function requireNative() {
76
76
  try {
77
77
  const binding = require('@lancedb/lancedb-android-arm64');
78
78
  const bindingPackageVersion = require('@lancedb/lancedb-android-arm64/package.json').version;
79
- if (bindingPackageVersion !== '0.39.0-beta.6' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
80
- throw new Error(`Native binding package version mismatch, expected 0.39.0-beta.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
79
+ if (bindingPackageVersion !== '0.39.0-beta.8' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
80
+ throw new Error(`Native binding package version mismatch, expected 0.39.0-beta.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
81
81
  }
82
82
  return binding;
83
83
  }
@@ -95,8 +95,8 @@ function requireNative() {
95
95
  try {
96
96
  const binding = require('@lancedb/lancedb-android-arm-eabi');
97
97
  const bindingPackageVersion = require('@lancedb/lancedb-android-arm-eabi/package.json').version;
98
- if (bindingPackageVersion !== '0.39.0-beta.6' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
99
- throw new Error(`Native binding package version mismatch, expected 0.39.0-beta.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
98
+ if (bindingPackageVersion !== '0.39.0-beta.8' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
99
+ throw new Error(`Native binding package version mismatch, expected 0.39.0-beta.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
100
100
  }
101
101
  return binding;
102
102
  }
@@ -120,8 +120,8 @@ function requireNative() {
120
120
  try {
121
121
  const binding = require('@lancedb/lancedb-win32-x64-gnu');
122
122
  const bindingPackageVersion = require('@lancedb/lancedb-win32-x64-gnu/package.json').version;
123
- if (bindingPackageVersion !== '0.39.0-beta.6' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
124
- throw new Error(`Native binding package version mismatch, expected 0.39.0-beta.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
123
+ if (bindingPackageVersion !== '0.39.0-beta.8' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
124
+ throw new Error(`Native binding package version mismatch, expected 0.39.0-beta.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
125
125
  }
126
126
  return binding;
127
127
  }
@@ -139,8 +139,8 @@ function requireNative() {
139
139
  try {
140
140
  const binding = require('@lancedb/lancedb-win32-x64-msvc');
141
141
  const bindingPackageVersion = require('@lancedb/lancedb-win32-x64-msvc/package.json').version;
142
- if (bindingPackageVersion !== '0.39.0-beta.6' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
143
- throw new Error(`Native binding package version mismatch, expected 0.39.0-beta.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
142
+ if (bindingPackageVersion !== '0.39.0-beta.8' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
143
+ throw new Error(`Native binding package version mismatch, expected 0.39.0-beta.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
144
144
  }
145
145
  return binding;
146
146
  }
@@ -159,8 +159,8 @@ function requireNative() {
159
159
  try {
160
160
  const binding = require('@lancedb/lancedb-win32-ia32-msvc');
161
161
  const bindingPackageVersion = require('@lancedb/lancedb-win32-ia32-msvc/package.json').version;
162
- if (bindingPackageVersion !== '0.39.0-beta.6' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
163
- throw new Error(`Native binding package version mismatch, expected 0.39.0-beta.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
162
+ if (bindingPackageVersion !== '0.39.0-beta.8' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
163
+ throw new Error(`Native binding package version mismatch, expected 0.39.0-beta.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
164
164
  }
165
165
  return binding;
166
166
  }
@@ -178,8 +178,8 @@ function requireNative() {
178
178
  try {
179
179
  const binding = require('@lancedb/lancedb-win32-arm64-msvc');
180
180
  const bindingPackageVersion = require('@lancedb/lancedb-win32-arm64-msvc/package.json').version;
181
- if (bindingPackageVersion !== '0.39.0-beta.6' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
182
- throw new Error(`Native binding package version mismatch, expected 0.39.0-beta.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
181
+ if (bindingPackageVersion !== '0.39.0-beta.8' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
182
+ throw new Error(`Native binding package version mismatch, expected 0.39.0-beta.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
183
183
  }
184
184
  return binding;
185
185
  }
@@ -201,8 +201,8 @@ function requireNative() {
201
201
  try {
202
202
  const binding = require('@lancedb/lancedb-darwin-universal');
203
203
  const bindingPackageVersion = require('@lancedb/lancedb-darwin-universal/package.json').version;
204
- if (bindingPackageVersion !== '0.39.0-beta.6' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
205
- throw new Error(`Native binding package version mismatch, expected 0.39.0-beta.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
204
+ if (bindingPackageVersion !== '0.39.0-beta.8' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
205
+ throw new Error(`Native binding package version mismatch, expected 0.39.0-beta.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
206
206
  }
207
207
  return binding;
208
208
  }
@@ -219,8 +219,8 @@ function requireNative() {
219
219
  try {
220
220
  const binding = require('@lancedb/lancedb-darwin-x64');
221
221
  const bindingPackageVersion = require('@lancedb/lancedb-darwin-x64/package.json').version;
222
- if (bindingPackageVersion !== '0.39.0-beta.6' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
223
- throw new Error(`Native binding package version mismatch, expected 0.39.0-beta.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
222
+ if (bindingPackageVersion !== '0.39.0-beta.8' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
223
+ throw new Error(`Native binding package version mismatch, expected 0.39.0-beta.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
224
224
  }
225
225
  return binding;
226
226
  }
@@ -238,8 +238,8 @@ function requireNative() {
238
238
  try {
239
239
  const binding = require('@lancedb/lancedb-darwin-arm64');
240
240
  const bindingPackageVersion = require('@lancedb/lancedb-darwin-arm64/package.json').version;
241
- if (bindingPackageVersion !== '0.39.0-beta.6' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
242
- throw new Error(`Native binding package version mismatch, expected 0.39.0-beta.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
241
+ if (bindingPackageVersion !== '0.39.0-beta.8' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
242
+ throw new Error(`Native binding package version mismatch, expected 0.39.0-beta.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
243
243
  }
244
244
  return binding;
245
245
  }
@@ -262,8 +262,8 @@ function requireNative() {
262
262
  try {
263
263
  const binding = require('@lancedb/lancedb-freebsd-x64');
264
264
  const bindingPackageVersion = require('@lancedb/lancedb-freebsd-x64/package.json').version;
265
- if (bindingPackageVersion !== '0.39.0-beta.6' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
266
- throw new Error(`Native binding package version mismatch, expected 0.39.0-beta.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
265
+ if (bindingPackageVersion !== '0.39.0-beta.8' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
266
+ throw new Error(`Native binding package version mismatch, expected 0.39.0-beta.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
267
267
  }
268
268
  return binding;
269
269
  }
@@ -281,8 +281,8 @@ function requireNative() {
281
281
  try {
282
282
  const binding = require('@lancedb/lancedb-freebsd-arm64');
283
283
  const bindingPackageVersion = require('@lancedb/lancedb-freebsd-arm64/package.json').version;
284
- if (bindingPackageVersion !== '0.39.0-beta.6' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
285
- throw new Error(`Native binding package version mismatch, expected 0.39.0-beta.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
284
+ if (bindingPackageVersion !== '0.39.0-beta.8' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
285
+ throw new Error(`Native binding package version mismatch, expected 0.39.0-beta.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
286
286
  }
287
287
  return binding;
288
288
  }
@@ -306,8 +306,8 @@ function requireNative() {
306
306
  try {
307
307
  const binding = require('@lancedb/lancedb-linux-x64-musl');
308
308
  const bindingPackageVersion = require('@lancedb/lancedb-linux-x64-musl/package.json').version;
309
- if (bindingPackageVersion !== '0.39.0-beta.6' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
310
- throw new Error(`Native binding package version mismatch, expected 0.39.0-beta.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
309
+ if (bindingPackageVersion !== '0.39.0-beta.8' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
310
+ throw new Error(`Native binding package version mismatch, expected 0.39.0-beta.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
311
311
  }
312
312
  return binding;
313
313
  }
@@ -325,8 +325,8 @@ function requireNative() {
325
325
  try {
326
326
  const binding = require('@lancedb/lancedb-linux-x64-gnu');
327
327
  const bindingPackageVersion = require('@lancedb/lancedb-linux-x64-gnu/package.json').version;
328
- if (bindingPackageVersion !== '0.39.0-beta.6' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
329
- throw new Error(`Native binding package version mismatch, expected 0.39.0-beta.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
328
+ if (bindingPackageVersion !== '0.39.0-beta.8' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
329
+ throw new Error(`Native binding package version mismatch, expected 0.39.0-beta.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
330
330
  }
331
331
  return binding;
332
332
  }
@@ -346,8 +346,8 @@ function requireNative() {
346
346
  try {
347
347
  const binding = require('@lancedb/lancedb-linux-arm64-musl');
348
348
  const bindingPackageVersion = require('@lancedb/lancedb-linux-arm64-musl/package.json').version;
349
- if (bindingPackageVersion !== '0.39.0-beta.6' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
350
- throw new Error(`Native binding package version mismatch, expected 0.39.0-beta.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
349
+ if (bindingPackageVersion !== '0.39.0-beta.8' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
350
+ throw new Error(`Native binding package version mismatch, expected 0.39.0-beta.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
351
351
  }
352
352
  return binding;
353
353
  }
@@ -365,8 +365,8 @@ function requireNative() {
365
365
  try {
366
366
  const binding = require('@lancedb/lancedb-linux-arm64-gnu');
367
367
  const bindingPackageVersion = require('@lancedb/lancedb-linux-arm64-gnu/package.json').version;
368
- if (bindingPackageVersion !== '0.39.0-beta.6' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
369
- throw new Error(`Native binding package version mismatch, expected 0.39.0-beta.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
368
+ if (bindingPackageVersion !== '0.39.0-beta.8' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
369
+ throw new Error(`Native binding package version mismatch, expected 0.39.0-beta.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
370
370
  }
371
371
  return binding;
372
372
  }
@@ -386,8 +386,8 @@ function requireNative() {
386
386
  try {
387
387
  const binding = require('@lancedb/lancedb-linux-arm-musleabihf');
388
388
  const bindingPackageVersion = require('@lancedb/lancedb-linux-arm-musleabihf/package.json').version;
389
- if (bindingPackageVersion !== '0.39.0-beta.6' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
390
- throw new Error(`Native binding package version mismatch, expected 0.39.0-beta.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
389
+ if (bindingPackageVersion !== '0.39.0-beta.8' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
390
+ throw new Error(`Native binding package version mismatch, expected 0.39.0-beta.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
391
391
  }
392
392
  return binding;
393
393
  }
@@ -405,8 +405,8 @@ function requireNative() {
405
405
  try {
406
406
  const binding = require('@lancedb/lancedb-linux-arm-gnueabihf');
407
407
  const bindingPackageVersion = require('@lancedb/lancedb-linux-arm-gnueabihf/package.json').version;
408
- if (bindingPackageVersion !== '0.39.0-beta.6' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
409
- throw new Error(`Native binding package version mismatch, expected 0.39.0-beta.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
408
+ if (bindingPackageVersion !== '0.39.0-beta.8' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
409
+ throw new Error(`Native binding package version mismatch, expected 0.39.0-beta.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
410
410
  }
411
411
  return binding;
412
412
  }
@@ -426,8 +426,8 @@ function requireNative() {
426
426
  try {
427
427
  const binding = require('@lancedb/lancedb-linux-loong64-musl');
428
428
  const bindingPackageVersion = require('@lancedb/lancedb-linux-loong64-musl/package.json').version;
429
- if (bindingPackageVersion !== '0.39.0-beta.6' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
430
- throw new Error(`Native binding package version mismatch, expected 0.39.0-beta.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
429
+ if (bindingPackageVersion !== '0.39.0-beta.8' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
430
+ throw new Error(`Native binding package version mismatch, expected 0.39.0-beta.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
431
431
  }
432
432
  return binding;
433
433
  }
@@ -445,8 +445,8 @@ function requireNative() {
445
445
  try {
446
446
  const binding = require('@lancedb/lancedb-linux-loong64-gnu');
447
447
  const bindingPackageVersion = require('@lancedb/lancedb-linux-loong64-gnu/package.json').version;
448
- if (bindingPackageVersion !== '0.39.0-beta.6' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
449
- throw new Error(`Native binding package version mismatch, expected 0.39.0-beta.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
448
+ if (bindingPackageVersion !== '0.39.0-beta.8' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
449
+ throw new Error(`Native binding package version mismatch, expected 0.39.0-beta.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
450
450
  }
451
451
  return binding;
452
452
  }
@@ -466,8 +466,8 @@ function requireNative() {
466
466
  try {
467
467
  const binding = require('@lancedb/lancedb-linux-riscv64-musl');
468
468
  const bindingPackageVersion = require('@lancedb/lancedb-linux-riscv64-musl/package.json').version;
469
- if (bindingPackageVersion !== '0.39.0-beta.6' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
470
- throw new Error(`Native binding package version mismatch, expected 0.39.0-beta.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
469
+ if (bindingPackageVersion !== '0.39.0-beta.8' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
470
+ throw new Error(`Native binding package version mismatch, expected 0.39.0-beta.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
471
471
  }
472
472
  return binding;
473
473
  }
@@ -485,8 +485,8 @@ function requireNative() {
485
485
  try {
486
486
  const binding = require('@lancedb/lancedb-linux-riscv64-gnu');
487
487
  const bindingPackageVersion = require('@lancedb/lancedb-linux-riscv64-gnu/package.json').version;
488
- if (bindingPackageVersion !== '0.39.0-beta.6' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
489
- throw new Error(`Native binding package version mismatch, expected 0.39.0-beta.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
488
+ if (bindingPackageVersion !== '0.39.0-beta.8' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
489
+ throw new Error(`Native binding package version mismatch, expected 0.39.0-beta.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
490
490
  }
491
491
  return binding;
492
492
  }
@@ -505,8 +505,8 @@ function requireNative() {
505
505
  try {
506
506
  const binding = require('@lancedb/lancedb-linux-ppc64-gnu');
507
507
  const bindingPackageVersion = require('@lancedb/lancedb-linux-ppc64-gnu/package.json').version;
508
- if (bindingPackageVersion !== '0.39.0-beta.6' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
509
- throw new Error(`Native binding package version mismatch, expected 0.39.0-beta.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
508
+ if (bindingPackageVersion !== '0.39.0-beta.8' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
509
+ throw new Error(`Native binding package version mismatch, expected 0.39.0-beta.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
510
510
  }
511
511
  return binding;
512
512
  }
@@ -524,8 +524,8 @@ function requireNative() {
524
524
  try {
525
525
  const binding = require('@lancedb/lancedb-linux-s390x-gnu');
526
526
  const bindingPackageVersion = require('@lancedb/lancedb-linux-s390x-gnu/package.json').version;
527
- if (bindingPackageVersion !== '0.39.0-beta.6' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
528
- throw new Error(`Native binding package version mismatch, expected 0.39.0-beta.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
527
+ if (bindingPackageVersion !== '0.39.0-beta.8' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
528
+ throw new Error(`Native binding package version mismatch, expected 0.39.0-beta.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
529
529
  }
530
530
  return binding;
531
531
  }
@@ -548,8 +548,8 @@ function requireNative() {
548
548
  try {
549
549
  const binding = require('@lancedb/lancedb-openharmony-arm64');
550
550
  const bindingPackageVersion = require('@lancedb/lancedb-openharmony-arm64/package.json').version;
551
- if (bindingPackageVersion !== '0.39.0-beta.6' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
552
- throw new Error(`Native binding package version mismatch, expected 0.39.0-beta.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
551
+ if (bindingPackageVersion !== '0.39.0-beta.8' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
552
+ throw new Error(`Native binding package version mismatch, expected 0.39.0-beta.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
553
553
  }
554
554
  return binding;
555
555
  }
@@ -567,8 +567,8 @@ function requireNative() {
567
567
  try {
568
568
  const binding = require('@lancedb/lancedb-openharmony-x64');
569
569
  const bindingPackageVersion = require('@lancedb/lancedb-openharmony-x64/package.json').version;
570
- if (bindingPackageVersion !== '0.39.0-beta.6' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
571
- throw new Error(`Native binding package version mismatch, expected 0.39.0-beta.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
570
+ if (bindingPackageVersion !== '0.39.0-beta.8' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
571
+ throw new Error(`Native binding package version mismatch, expected 0.39.0-beta.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
572
572
  }
573
573
  return binding;
574
574
  }
@@ -586,8 +586,8 @@ function requireNative() {
586
586
  try {
587
587
  const binding = require('@lancedb/lancedb-openharmony-arm');
588
588
  const bindingPackageVersion = require('@lancedb/lancedb-openharmony-arm/package.json').version;
589
- if (bindingPackageVersion !== '0.39.0-beta.6' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
590
- throw new Error(`Native binding package version mismatch, expected 0.39.0-beta.6 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
589
+ if (bindingPackageVersion !== '0.39.0-beta.8' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
590
+ throw new Error(`Native binding package version mismatch, expected 0.39.0-beta.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
591
591
  }
592
592
  return binding;
593
593
  }
@@ -661,6 +661,7 @@ if (!nativeBinding) {
661
661
  throw new Error(`Failed to load native binding`);
662
662
  }
663
663
  module.exports = nativeBinding;
664
+ module.exports.BlobFile = nativeBinding.BlobFile;
664
665
  module.exports.BranchContents = nativeBinding.BranchContents;
665
666
  module.exports.Branches = nativeBinding.Branches;
666
667
  module.exports.Connection = nativeBinding.Connection;
package/dist/sanitize.js CHANGED
@@ -27,7 +27,7 @@ exports.sanitizeTable = sanitizeTable;
27
27
  exports.dataTypeFromName = dataTypeFromName;
28
28
  // The utilities in this file help sanitize data from the user's arrow
29
29
  // library into the types expected by vectordb's arrow library. Node
30
- // generally allows for mulitple versions of the same library (and sometimes
30
+ // generally allows for multiple versions of the same library (and sometimes
31
31
  // even multiple copies of the same version) to be installed at the same
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
package/dist/table.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { Table as ArrowTable, Data, DataType, Field, IntoVector, MultiVector, Schema } from "./arrow";
2
+ import { BlobFile } from "./blob";
2
3
  import { IndexOptions } from "./indices";
3
4
  import { Job } from "./job";
4
5
  import { MergeInsertBuilder } from "./merge";
@@ -237,7 +238,7 @@ export declare abstract class Table {
237
238
  * Note: if your condition is something like "some_id_column == 7" and
238
239
  * you are updating many rows (with different ids) then you will get
239
240
  * better performance with a single [`merge_insert`] call instead of
240
- * repeatedly calilng this method.
241
+ * repeatedly calling this method.
241
242
  * @param {Map<string, string> | Record<string, string>} updates - the
242
243
  * columns to update
243
244
  * @returns {Promise<UpdateResult>} A promise that resolves to an object
@@ -412,6 +413,26 @@ export declare abstract class Table {
412
413
  * @returns A builder that can be used to parameterize the query.
413
414
  */
414
415
  abstract takeRowIds(rowIds: readonly (bigint | number)[]): TakeQuery;
416
+ /**
417
+ * Blob v2 columns, including nested dotted paths.
418
+ */
419
+ abstract blobColumns(): Promise<string[]>;
420
+ /**
421
+ * Bytes for `column` at row IDs from {@link Query.withRowId}.
422
+ *
423
+ * Reads the table's current checkout. IDs from another version can fail after
424
+ * compaction unless stable row ids are enabled. Results keep input order and
425
+ * duplicates. Null blobs are `null`. Empty blobs are empty buffers.
426
+ */
427
+ abstract fetchBlobs(column: string, rowIds: readonly (bigint | number)[]): Promise<(Buffer | null)[]>;
428
+ /**
429
+ * Opens lazy blob handles for `column` at the given row IDs using the
430
+ * table's current checkout.
431
+ *
432
+ * Preserves input order, duplicates, and nulls. Use this for large payloads.
433
+ * See {@link Table.fetchBlobs} for row-ID validity across versions.
434
+ */
435
+ abstract fetchBlobFiles(column: string, rowIds: readonly (bigint | number)[]): Promise<(BlobFile | null)[]>;
415
436
  /**
416
437
  * Create a search query to find the nearest neighbors
417
438
  * of the given query
@@ -440,10 +461,10 @@ export declare abstract class Table {
440
461
  * {@link Table#refreshColumn}. Declaring one therefore costs the same on a
441
462
  * large table as on an empty one.
442
463
  *
443
- * A refresh does not revisit rows it has already filled, so mutating an
444
- * input leaves the value computed at fill time; recomputing means dropping
445
- * the column and declaring it again. While a declaration reads a column,
446
- * that column cannot be renamed, retyped or dropped.
464
+ * A refresh also recomputes the rows whose inputs changed since they were
465
+ * computed, so a mutated input is reflected by the next refresh. While a
466
+ * declaration reads a column, that column cannot be renamed, retyped or
467
+ * dropped.
447
468
  *
448
469
  * On LanceDB Cloud and Enterprise the expression is planned by the
449
470
  * server, and the refresh runs as a server job -- see
@@ -468,10 +489,10 @@ export declare abstract class Table {
468
489
  /**
469
490
  * Fill the rows of a computed column that hold no value yet.
470
491
  *
471
- * Rows appended since the last refresh are filled by the next one; rows
472
- * already filled are left as they are, so the call is idempotent and does
473
- * not observe a mutated input. Local tables only: a remote refresh runs
474
- * as a server job, through {@link Table#refreshColumnAsync}.
492
+ * Rows appended since the last refresh are filled by the next one, and
493
+ * rows whose inputs changed since they were computed are recomputed;
494
+ * everything else is left as it is. Local tables only: a remote refresh
495
+ * runs as a server job, through {@link Table#refreshColumnAsync}.
475
496
  * @param {string} column The name of the computed column to fill.
476
497
  * @returns {Promise<RefreshColumnResult>} A promise that resolves to the
477
498
  * number of rows filled and the new version number of the table.
@@ -861,6 +882,9 @@ export declare class LocalTable extends Table {
861
882
  waitForIndex(indexNames: string[], timeoutSeconds: number): Promise<void>;
862
883
  takeOffsets(offsets: number[]): TakeQuery;
863
884
  takeRowIds(rowIds: readonly (bigint | number)[]): TakeQuery;
885
+ blobColumns(): Promise<string[]>;
886
+ fetchBlobs(column: string, rowIds: readonly (bigint | number)[]): Promise<(Buffer | null)[]>;
887
+ fetchBlobFiles(column: string, rowIds: readonly (bigint | number)[]): Promise<(BlobFile | null)[]>;
864
888
  query(): Query;
865
889
  search(query: string | IntoVector | MultiVector | FullTextQuery, queryType?: string, ftsColumns?: string | string[]): VectorQuery | Query | AutoQuery;
866
890
  vectorSearch(vector: IntoVector | MultiVector): VectorQuery;
package/dist/table.js CHANGED
@@ -4,6 +4,7 @@
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
5
  exports.Branches = exports.LocalTable = exports.Table = void 0;
6
6
  const arrow_1 = require("./arrow");
7
+ const blob_1 = require("./blob");
7
8
  const registry_1 = require("./embedding/registry");
8
9
  const job_1 = require("./job");
9
10
  const merge_1 = require("./merge");
@@ -162,22 +163,20 @@ class LocalTable extends Table {
162
163
  return new query_1.TakeQuery(this.inner.takeOffsets(offsets));
163
164
  }
164
165
  takeRowIds(rowIds) {
165
- const ids = rowIds.map((id) => {
166
- if (typeof id === "bigint") {
167
- return id;
168
- }
169
- if (!Number.isInteger(id)) {
170
- throw new Error("Row id must be an integer (or bigint)");
171
- }
172
- if (id < 0) {
173
- throw new Error("Row id cannot be negative");
174
- }
175
- if (!Number.isSafeInteger(id)) {
176
- throw new Error("Row id is too large for number; use bigint instead");
177
- }
178
- return BigInt(id);
179
- });
180
- return new query_1.TakeQuery(this.inner.takeRowIds(ids));
166
+ return new query_1.TakeQuery(this.inner.takeRowIds(rowIdsToBigInts(rowIds)));
167
+ }
168
+ blobColumns() {
169
+ return this.inner.blobColumns();
170
+ }
171
+ async fetchBlobs(column, rowIds) {
172
+ const values = await this.inner.fetchBlobs(column, rowIdsToBigInts(rowIds));
173
+ // N-API Option maps missing values to undefined. Collapse those to null.
174
+ return values.map((value) => value ?? null);
175
+ }
176
+ async fetchBlobFiles(column, rowIds) {
177
+ const files = await this.inner.fetchBlobFiles(column, rowIdsToBigInts(rowIds));
178
+ // N-API Option maps missing values to undefined. Collapse those to null.
179
+ return files.map((file) => file == null ? null : blob_1.BlobFile.fromNative(file));
181
180
  }
182
181
  query() {
183
182
  return new query_1.Query(this.inner);
@@ -497,3 +496,20 @@ class Branches {
497
496
  }
498
497
  }
499
498
  exports.Branches = Branches;
499
+ function rowIdsToBigInts(rowIds) {
500
+ return rowIds.map((id) => {
501
+ if (typeof id === "bigint") {
502
+ return id;
503
+ }
504
+ if (!Number.isInteger(id)) {
505
+ throw new Error("Row id must be an integer (or bigint)");
506
+ }
507
+ if (id < 0) {
508
+ throw new Error("Row id cannot be negative");
509
+ }
510
+ if (!Number.isSafeInteger(id)) {
511
+ throw new Error("Row id is too large for number; use bigint instead");
512
+ }
513
+ return BigInt(id);
514
+ });
515
+ }
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "ann"
12
12
  ],
13
13
  "private": false,
14
- "version": "0.39.0-beta.6",
14
+ "version": "0.39.0-beta.8",
15
15
  "main": "dist/index.js",
16
16
  "exports": {
17
17
  ".": "./dist/index.js",
@@ -106,13 +106,13 @@
106
106
  "optionalDependencies": {
107
107
  "@huggingface/transformers": "3.0.2",
108
108
  "openai": "4.29.2",
109
- "@lancedb/lancedb-darwin-arm64": "0.39.0-beta.6",
110
- "@lancedb/lancedb-linux-x64-gnu": "0.39.0-beta.6",
111
- "@lancedb/lancedb-linux-arm64-gnu": "0.39.0-beta.6",
112
- "@lancedb/lancedb-linux-x64-musl": "0.39.0-beta.6",
113
- "@lancedb/lancedb-linux-arm64-musl": "0.39.0-beta.6",
114
- "@lancedb/lancedb-win32-x64-msvc": "0.39.0-beta.6",
115
- "@lancedb/lancedb-win32-arm64-msvc": "0.39.0-beta.6"
109
+ "@lancedb/lancedb-darwin-arm64": "0.39.0-beta.8",
110
+ "@lancedb/lancedb-linux-x64-gnu": "0.39.0-beta.8",
111
+ "@lancedb/lancedb-linux-arm64-gnu": "0.39.0-beta.8",
112
+ "@lancedb/lancedb-linux-x64-musl": "0.39.0-beta.8",
113
+ "@lancedb/lancedb-linux-arm64-musl": "0.39.0-beta.8",
114
+ "@lancedb/lancedb-win32-x64-msvc": "0.39.0-beta.8",
115
+ "@lancedb/lancedb-win32-arm64-msvc": "0.39.0-beta.8"
116
116
  },
117
117
  "peerDependencies": {
118
118
  "@types/node": ">=22",