@lancedb/lancedb 0.41.0-beta.6 → 0.41.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/query.js CHANGED
@@ -21,6 +21,62 @@ async function* RecordBatchIterator(promisedInner) {
21
21
  yield batches[0];
22
22
  }
23
23
  }
24
+ const BLOB_BYTES_ATTEMPTS = 3;
25
+ function blobSources(blobColumns, projection) {
26
+ const columns = new Set(blobColumns);
27
+ const pairs = projection ??
28
+ blobColumns.map((column) => [column, column]);
29
+ return new Map(pairs.filter(([, source]) => columns.has(source)));
30
+ }
31
+ async function readBlobBytes(table, sources, snapshot, dropRowId) {
32
+ const rowIdColumn = table.getChild("_rowid");
33
+ if (table.numRows > 0 && rowIdColumn === null) {
34
+ throw new Error('blobMode "bytes" needs _rowid in the query result');
35
+ }
36
+ const rowIds = rowIdColumn === null
37
+ ? []
38
+ : Array.from(rowIdColumn.toArray());
39
+ const replacements = new Map();
40
+ for (const [output, source] of sources) {
41
+ const index = table.schema.fields.findIndex((field) => field.name === output);
42
+ if (index < 0) {
43
+ continue;
44
+ }
45
+ const values = rowIds.length === 0 ? [] : await snapshot.fetchBlobs(source, rowIds);
46
+ replacements.set(index, values.map((value) => value ?? null));
47
+ }
48
+ const result = withBinaryColumns(table, replacements);
49
+ if (!dropRowId) {
50
+ return result;
51
+ }
52
+ return result.select(result.schema.fields
53
+ .map((field) => field.name)
54
+ .filter((name) => name !== "_rowid"));
55
+ }
56
+ // A fresh field, not a clone: the descriptor field's metadata must not follow
57
+ // the bytes.
58
+ function withBinaryColumns(table, replacements) {
59
+ if (replacements.size === 0) {
60
+ return table;
61
+ }
62
+ const fields = table.schema.fields.map((field, index) => replacements.has(index)
63
+ ? new arrow_1.Field(field.name, new arrow_1.LargeBinary(), true)
64
+ : field);
65
+ const schema = new arrow_1.Schema(fields, table.schema.metadata);
66
+ let offset = 0;
67
+ const batches = table.batches.map((batch) => {
68
+ const children = batch.data.children.map((child, index) => {
69
+ const values = replacements.get(index);
70
+ if (values === undefined) {
71
+ return child;
72
+ }
73
+ return (0, arrow_1.vectorFromArray)(values.slice(offset, offset + batch.numRows), new arrow_1.LargeBinary()).data[0];
74
+ });
75
+ offset += batch.numRows;
76
+ return new arrow_1.RecordBatch(schema, (0, arrow_1.makeData)({ type: new arrow_1.Struct(fields), length: batch.numRows, children }));
77
+ });
78
+ return new arrow_1.Table(schema, batches);
79
+ }
24
80
  function nearestToNative(inner, vector) {
25
81
  const raw = Array.isArray(vector) ? null : (0, arrow_1.extractVectorBuffer)(vector);
26
82
  if (raw) {
@@ -49,10 +105,15 @@ class QueryBase {
49
105
  /**
50
106
  * @hidden
51
107
  */
52
- constructor(inner) {
108
+ blobContext;
109
+ /**
110
+ * @hidden
111
+ */
112
+ constructor(inner, blobContext) {
53
113
  if (inner !== undefined) {
54
114
  this.inner = inner;
55
115
  }
116
+ this.blobContext = blobContext;
56
117
  }
57
118
  // call a function on the inner (either a promise or the actual object)
58
119
  /**
@@ -118,17 +179,25 @@ class QueryBase {
118
179
  inner.select(columnTuples);
119
180
  });
120
181
  };
182
+ let projection;
121
183
  if (typeof columns === "string") {
122
184
  selectColumns([columns]);
185
+ projection = [[columns, columns]];
123
186
  }
124
187
  else if (Array.isArray(columns)) {
125
188
  selectColumns(columns);
189
+ projection = columns.map((column) => [column, column]);
126
190
  }
127
191
  else if (columns instanceof Map) {
128
- selectMapping(Array.from(columns.entries()));
192
+ projection = Array.from(columns.entries());
193
+ selectMapping(projection);
129
194
  }
130
195
  else {
131
- selectMapping(Object.entries(columns));
196
+ projection = Object.entries(columns);
197
+ selectMapping(projection);
198
+ }
199
+ if (this.blobContext !== undefined) {
200
+ this.blobContext = { ...this.blobContext, projection };
132
201
  }
133
202
  return this;
134
203
  }
@@ -141,14 +210,17 @@ class QueryBase {
141
210
  */
142
211
  withRowId() {
143
212
  this.doCall((inner) => inner.withRowId());
213
+ if (this.blobContext !== undefined) {
214
+ this.blobContext = { ...this.blobContext, withRowId: true };
215
+ }
144
216
  return this;
145
217
  }
146
218
  /**
147
219
  * @hidden
148
220
  */
149
- async nativeExecute(options) {
221
+ async nativeExecute(options, withRowId = false) {
150
222
  const inner = await this.getInner();
151
- return inner.execute(options?.maxBatchLength, options?.timeoutMs);
223
+ return inner.execute(options?.maxBatchLength, options?.timeoutMs, withRowId);
152
224
  }
153
225
  /**
154
226
  * Execute the query and return the results as an @see {@link AsyncIterator}
@@ -177,8 +249,32 @@ class QueryBase {
177
249
  * Empty results retain the query's output schema.
178
250
  */
179
251
  async toArrow(options) {
252
+ const context = this.blobBytesContext(options?.blobMode);
253
+ if (context === undefined) {
254
+ return this.collect(options, false);
255
+ }
256
+ for (let attempt = 1;; attempt++) {
257
+ // The snapshot pins the bytes. The query runs on the live table, so an
258
+ // unchanged version afterwards proves it read the snapshot's version.
259
+ const snapshot = await context.table.querySnapshot();
260
+ const version = await snapshot.version();
261
+ const sources = blobSources(await snapshot.blobColumns(), context.projection);
262
+ if (sources.size === 0) {
263
+ return this.collect(options, false);
264
+ }
265
+ const addRowId = !context.withRowId;
266
+ const table = await this.collect(options, addRowId);
267
+ if ((await context.table.version()) === version) {
268
+ return readBlobBytes(table, sources, snapshot, addRowId);
269
+ }
270
+ if (attempt === BLOB_BYTES_ATTEMPTS) {
271
+ throw new Error(`blobMode "bytes": the table changed during each of ${BLOB_BYTES_ATTEMPTS} attempts to read it`);
272
+ }
273
+ }
274
+ }
275
+ async collect(options, withRowId) {
180
276
  const batches = [];
181
- const iterator = this.nativeExecute(options);
277
+ const iterator = this.nativeExecute(options, withRowId);
182
278
  for await (const batch of RecordBatchIterator(iterator)) {
183
279
  batches.push(batch);
184
280
  }
@@ -187,6 +283,18 @@ class QueryBase {
187
283
  }
188
284
  return new arrow_1.Table(batches);
189
285
  }
286
+ blobBytesContext(mode) {
287
+ if (mode === undefined || mode === "descriptions") {
288
+ return undefined;
289
+ }
290
+ if (mode !== "bytes") {
291
+ throw new Error(`blobMode must be "descriptions" or "bytes", got "${String(mode)}"`);
292
+ }
293
+ if (this.blobContext === undefined) {
294
+ throw new Error('blobMode "bytes" is not supported for this query');
295
+ }
296
+ return this.blobContext;
297
+ }
190
298
  /** Collect the results as an array of objects. */
191
299
  // biome-ignore lint/suspicious/noExplicitAny: arrow.toArrow() returns any[]
192
300
  async toArray(options) {
@@ -264,8 +372,8 @@ class QueryBase {
264
372
  }
265
373
  exports.QueryBase = QueryBase;
266
374
  class StandardQueryBase extends QueryBase {
267
- constructor(inner) {
268
- super(inner);
375
+ constructor(inner, blobContext) {
376
+ super(inner, blobContext);
269
377
  }
270
378
  /**
271
379
  * A filter statement to be applied to this query.
@@ -364,10 +472,10 @@ class StandardQueryBase extends QueryBase {
364
472
  * Control MemWAL read routing for this query.
365
473
  *
366
474
  * By default (unset), when the table carries a MemWAL write spec (see
367
- * {@link Table#setLsmWriteSpec}), reads are routed through the LSM scanner so
475
+ * {@link Table#enableMemWal}), reads are routed through the LSM scanner so
368
476
  * they also return data written via the `mergeInsert` LSM path that has not yet
369
477
  * been compacted into the base table (the active/frozen in-memory memtables and
370
- * the flushed generations), deduplicated by primary key; a table without a spec
478
+ * the SSTables), deduplicated by primary key; a table without a spec
371
479
  * reads the base table.
372
480
  *
373
481
  * @param enable - `true` forces the LSM scanner and errors if the table has no
@@ -376,11 +484,11 @@ class StandardQueryBase extends QueryBase {
376
484
  *
377
485
  * Note: the LSM scanner does not support every query shape (e.g. reranking,
378
486
  * hybrid search, `orderBy`). On a MemWAL table those shapes error unless
379
- * `useLsm(false)` is set, because a base-only read would silently exclude
487
+ * `useMemWal(false)` is set, because a base-only read would silently exclude
380
488
  * un-compacted MemWAL data.
381
489
  */
382
- useLsm(enable) {
383
- this.doCall((inner) => inner.useLsm(enable));
490
+ useMemWal(enable) {
491
+ this.doCall((inner) => inner.useMemWal(enable));
384
492
  return this;
385
493
  }
386
494
  }
@@ -398,8 +506,8 @@ class VectorQuery extends StandardQueryBase {
398
506
  /**
399
507
  * @hidden
400
508
  */
401
- constructor(inner) {
402
- super(inner);
509
+ constructor(inner, blobContext) {
510
+ super(inner, blobContext);
403
511
  }
404
512
  /**
405
513
  * @hidden
@@ -634,7 +742,7 @@ class VectorQuery extends StandardQueryBase {
634
742
  addQueryVectorToNative(inner, outcome.value);
635
743
  return inner;
636
744
  })();
637
- return new VectorQuery(res);
745
+ return new VectorQuery(res, this.blobContext);
638
746
  }
639
747
  else {
640
748
  this.doVectorCall((inner) => addQueryVectorToNative(inner, vector));
@@ -696,7 +804,7 @@ function createAutoQuery(table, query, columns, getVector) {
696
804
  }
697
805
  return nearestToNative(route.table.query(), vector);
698
806
  };
699
- return new AutoQuery(createInner);
807
+ return new AutoQuery(createInner, { table, withRowId: false });
700
808
  }
701
809
  /**
702
810
  * A query that returns a subset of the rows in the table.
@@ -704,8 +812,8 @@ function createAutoQuery(table, query, columns, getVector) {
704
812
  * @hideconstructor
705
813
  */
706
814
  class TakeQuery extends QueryBase {
707
- constructor(inner) {
708
- super(inner);
815
+ constructor(inner, blobContext) {
816
+ super(inner, blobContext);
709
817
  }
710
818
  /**
711
819
  * Control MemWAL read routing for this take query.
@@ -716,8 +824,8 @@ class TakeQuery extends QueryBase {
716
824
  *
717
825
  * @param enable - `false` reads the base table only.
718
826
  */
719
- useLsm(enable) {
720
- this.doCall((inner) => inner.useLsm(enable));
827
+ useMemWal(enable) {
828
+ this.doCall((inner) => inner.useMemWal(enable));
721
829
  return this;
722
830
  }
723
831
  }
@@ -735,8 +843,8 @@ class AutoQuery extends StandardQueryBase {
735
843
  createInner;
736
844
  calls = [];
737
845
  /** @hidden */
738
- constructor(createInner) {
739
- super();
846
+ constructor(createInner, blobContext) {
847
+ super(undefined, blobContext);
740
848
  this.createInner = createInner;
741
849
  }
742
850
  /** @hidden */
@@ -765,7 +873,7 @@ class Query extends StandardQueryBase {
765
873
  * @hidden
766
874
  */
767
875
  constructor(tbl) {
768
- super(tbl.query());
876
+ super(tbl.query(), { table: tbl, withRowId: false });
769
877
  }
770
878
  /**
771
879
  * Find the nearest vectors to the given query vector.
@@ -808,12 +916,12 @@ class Query extends StandardQueryBase {
808
916
  const inner = this.inner;
809
917
  if (inner instanceof Promise) {
810
918
  const nativeQuery = inner.then(async (resolvedInner) => nearestToNative(resolvedInner, await vector));
811
- return new VectorQuery(nativeQuery);
919
+ return new VectorQuery(nativeQuery, this.blobContext);
812
920
  }
813
921
  if (vector instanceof Promise) {
814
- return new VectorQuery(vector.then((resolvedVector) => nearestToNative(inner, resolvedVector)));
922
+ return new VectorQuery(vector.then((resolvedVector) => nearestToNative(inner, resolvedVector)), this.blobContext);
815
923
  }
816
- return new VectorQuery(nearestToNative(inner, vector));
924
+ return new VectorQuery(nearestToNative(inner, vector), this.blobContext);
817
925
  }
818
926
  nearestToText(query, columns) {
819
927
  this.doCall((inner) => {
package/dist/table.d.ts CHANGED
@@ -3,11 +3,11 @@ import { BlobFile, BlobReadOptions } from "./blob";
3
3
  import { IndexOptions } from "./indices";
4
4
  import { Job } from "./job";
5
5
  import { MergeInsertBuilder } from "./merge";
6
- import { AddColumnsResult, AddColumnsSql, AddResult, AlterColumnsResult, BranchContents, DeleteResult, DropColumnsResult, FunctionErrors, FunctionErrorsOptions, IndexConfig, IndexStatistics, LsmStats, Branches as NativeBranches, OptimizeStats, RefreshColumnResult, RefreshMaterializedViewResult, TableStatistics, Tags, UpdateFieldMetadataResult, UpdateResult, Table as _NativeTable } from "./native";
6
+ import { AddColumnsResult, AddColumnsSql, AddResult, AlterColumnsResult, BranchContents, DeleteResult, DropColumnsResult, FunctionErrors, FunctionErrorsOptions, IndexConfig, IndexStatistics, MemWalStats, Branches as NativeBranches, OptimizeStats, RefreshColumnResult, RefreshMaterializedViewResult, TableStatistics, Tags, UpdateFieldMetadataResult, UpdateResult, Table as _NativeTable } from "./native";
7
7
  import { AutoQuery, FullTextQuery, Query, TakeQuery, VectorQuery } from "./query";
8
8
  import { IntoSql } from "./util";
9
9
  export { IndexConfig } from "./native";
10
- export { BucketStats, GenerationStats, LsmStats, MemtableStats, } from "./native";
10
+ export { TableShardStats, SsTableStats, MemWalStats, MemtableStats, } from "./native";
11
11
  /**
12
12
  * Progress snapshot for a write operation, delivered to the `progress`
13
13
  * callback passed to {@link Table.add}.
@@ -149,7 +149,7 @@ export type TokenizeTableOptions = {
149
149
  * `column` value, or upserts of that key can land in different shards and a
150
150
  * stale version can win).
151
151
  */
152
- export interface LsmWriteSpec {
152
+ export interface MemWalWriteSpec {
153
153
  /** One of `"bucket"`, `"identity"`, or `"unsharded"`. */
154
154
  specType: "bucket" | "identity" | "unsharded";
155
155
  /** Bucket and identity variants: the sharding column. */
@@ -424,7 +424,8 @@ export declare abstract class Table {
424
424
  */
425
425
  abstract takeRowIds(rowIds: readonly (bigint | number)[]): TakeQuery;
426
426
  /**
427
- * Blob v2 columns, including nested dotted paths.
427
+ * Blob v2 columns addressable by row ID, including struct-nested dotted paths.
428
+ * Blobs inside lists are omitted because a row ID does not identify an element.
428
429
  */
429
430
  abstract blobColumns(): Promise<string[]>;
430
431
  /**
@@ -433,6 +434,10 @@ export declare abstract class Table {
433
434
  * Reads the table's current checkout. IDs from another version can fail after
434
435
  * compaction unless stable row ids are enabled. Results keep input order and
435
436
  * duplicates. Null blobs are `null`. Empty blobs are empty buffers.
437
+ * One missing or deleted row ID rejects the entire batch, including on remote
438
+ * tables; no partial results are returned.
439
+ * Blobs inside lists cannot be fetched by row ID.
440
+ *
436
441
  * Remote servers limit each request to 1024 row IDs and 64 MiB of blob bytes.
437
442
  * The client splits requests automatically and reads an individual larger
438
443
  * blob through the Range route. This method still materializes all bytes in
@@ -445,6 +450,8 @@ export declare abstract class Table {
445
450
  *
446
451
  * Preserves input order, duplicates, and nulls. Use this for large payloads.
447
452
  * See {@link Table.fetchBlobs} for row-ID validity across versions.
453
+ * One missing or deleted row ID rejects the entire batch, including on remote
454
+ * tables; no partial handles are returned.
448
455
  */
449
456
  abstract fetchBlobFiles(column: string, rowIds: readonly (bigint | number)[], options?: BlobReadOptions): Promise<(BlobFile | null)[]>;
450
457
  /**
@@ -613,10 +620,10 @@ export declare abstract class Table {
613
620
  */
614
621
  abstract setUnenforcedPrimaryKey(columns: string | string[]): Promise<void>;
615
622
  /**
616
- * Install an {@link LsmWriteSpec} on this table, selecting Lance's MemWAL
623
+ * Install an {@link MemWalWriteSpec} on this table, selecting Lance's MemWAL
617
624
  * LSM-style write path for future `mergeInsert` calls.
618
625
  *
619
- * `LsmWriteSpec` chooses one of three sharding strategies via `specType`:
626
+ * `MemWalWriteSpec` chooses one of three sharding strategies via `specType`:
620
627
  *
621
628
  * - `"bucket"` — hash-bucket writes by the single-column unenforced primary
622
629
  * key (`column` and `numBuckets` required).
@@ -631,12 +638,12 @@ export declare abstract class Table {
631
638
  * including ones created later, and skips a kind the MemWAL cannot maintain.
632
639
  * Naming them pins an exact set, and a still-building index is rejected
633
640
  * rather than quietly omitted.
634
- * @param {LsmWriteSpec} spec The sharding spec to install.
641
+ * @param {MemWalWriteSpec} spec The sharding spec to install.
635
642
  * @returns {Promise<void>}
636
643
  * @example
637
644
  * ```ts
638
645
  * await table.setUnenforcedPrimaryKey("id");
639
- * await table.setLsmWriteSpec({
646
+ * await table.enableMemWal({
640
647
  * specType: "bucket",
641
648
  * column: "id",
642
649
  * numBuckets: 16,
@@ -644,59 +651,59 @@ export declare abstract class Table {
644
651
  * });
645
652
  * ```
646
653
  */
647
- abstract setLsmWriteSpec(spec: LsmWriteSpec): Promise<void>;
654
+ abstract enableMemWal(spec: MemWalWriteSpec): Promise<void>;
648
655
  /**
649
- * Remove the {@link LsmWriteSpec} from this table, reverting to the standard
656
+ * Remove the {@link MemWalWriteSpec} from this table, reverting to the standard
650
657
  * `mergeInsert` write path.
651
658
  *
652
659
  * Errors if no spec is currently set.
653
660
  * @returns {Promise<void>}
654
661
  */
655
- abstract unsetLsmWriteSpec(): Promise<void>;
662
+ abstract disableMemWal(): Promise<void>;
656
663
  /**
657
- * Read the {@link LsmWriteSpec} currently installed on this table.
664
+ * Read the {@link MemWalWriteSpec} currently installed on this table.
658
665
  *
659
- * Resolves to `undefined` when the MemWAL LSM write path is not enabled (no
660
- * spec has been set, or it was removed with {@link Table#unsetLsmWriteSpec}).
666
+ * Resolves to `undefined` when the MemWAL write path is not enabled (no
667
+ * spec has been set, or it was removed with {@link Table#disableMemWal}).
661
668
  * The spec is the one installed, including its maintained-index selection:
662
669
  * an absent `maintainedIndexes` for every index the table has, an empty
663
670
  * array for none.
664
- * @returns {Promise<LsmWriteSpec | undefined>}
671
+ * @returns {Promise<MemWalWriteSpec | undefined>}
665
672
  */
666
- abstract getLsmWriteSpec(): Promise<LsmWriteSpec | undefined>;
673
+ abstract getMemWalSpec(): Promise<MemWalWriteSpec | undefined>;
667
674
  /**
668
675
  * Drain and close any cached MemWAL shard writers held for this table.
669
676
  *
670
- * When an {@link LsmWriteSpec} is installed, `mergeInsert` opens MemWAL
677
+ * When an {@link MemWalWriteSpec} is installed, `mergeInsert` opens MemWAL
671
678
  * shard writers and caches them for reuse across calls. This closes them,
672
679
  * flushing pending data; writers reopen lazily on the next `mergeInsert`.
673
680
  * It is a no-op when no writers are cached.
674
681
  * @returns {Promise<void>}
675
682
  */
676
- abstract closeLsmWriters(): Promise<void>;
683
+ abstract closeMemWalWriters(): Promise<void>;
677
684
  /**
678
- * Seal every bucket's active memtable into a new L0 generation.
685
+ * Freeze every table shard's active memtable into a new SSTable.
679
686
  *
680
- * Returns once the seal is committed. Sealing an empty memtable is a no-op,
687
+ * Returns once the freeze is committed. Freezing an empty memtable is a no-op,
681
688
  * so this is safe to call repeatedly.
682
689
  * @returns {Promise<void>}
683
690
  */
684
- abstract flushLsm(): Promise<void>;
691
+ abstract flushMemWal(): Promise<void>;
685
692
  /**
686
- * Trigger a background L0 → base compaction pass per bucket.
693
+ * Trigger a background SSTable compaction pass per table shard.
687
694
  *
688
695
  * Returns once the passes are *dispatched*, not once they finish — watch
689
- * {@link Table#getLsmStats} for progress, or use
690
- * {@link Table#checkpointLsm} to wait for convergence.
696
+ * {@link Table#getMemWalStats} for progress, or use
697
+ * {@link Table#checkpointMemWal} to wait for convergence.
691
698
  * @returns {Promise<void>}
692
699
  */
693
- abstract compactLsm(): Promise<void>;
700
+ abstract compactMemWal(): Promise<void>;
694
701
  /**
695
- * Converge this table's LSM write path into its base table.
702
+ * Converge this table's MemWAL write path into its base table.
696
703
  *
697
- * Seals once, then triggers compaction and polls until the L0 that existed
704
+ * Freezes once, then triggers compaction and polls until the SSTables that existed
698
705
  * at the start is gone. The target set is fixed at the start, so
699
- * generations created *during* the checkpoint are ignored — that is what
706
+ * SSTables created *during* the checkpoint are ignored — that is what
700
707
  * lets it terminate under write load, and what makes it best-effort: it
701
708
  * converges the fresh tier as of some instant. Idempotent, abandonable at
702
709
  * any point, and safe to run on a cadence.
@@ -707,24 +714,24 @@ export declare abstract class Table {
707
714
  * @returns {Promise<void>}
708
715
  * @example
709
716
  * ```ts
710
- * const before = await table.getLsmStats();
711
- * await table.checkpointLsm();
712
- * const after = await table.getLsmStats();
717
+ * const before = await table.getMemWalStats();
718
+ * await table.checkpointMemWal();
719
+ * const after = await table.getMemWalStats();
713
720
  * ```
714
721
  */
715
- abstract checkpointLsm(): Promise<void>;
722
+ abstract checkpointMemWal(): Promise<void>;
716
723
  /**
717
- * Read live per-bucket LSM state.
724
+ * Read live per-table-shard MemWAL state.
718
725
  *
719
- * Answers "how far behind is my fresh tier", "which bucket is hot", and
726
+ * Answers "how far behind is my fresh tier", "which table shard is hot", and
720
727
  * "why is my fresh-tier vector search brute-force". Mutates no table state.
721
728
  *
722
- * Resolves to `undefined` only when the LSM write path is not enabled.
723
- * @param {boolean} includeGenerationRows Also count rows per L0 generation.
729
+ * Resolves to `undefined` only when the MemWAL write path is not enabled.
730
+ * @param {boolean} includeSstableRows Also count rows per SSTable.
724
731
  * Off by default because each count opens an uncached Lance dataset.
725
- * @returns {Promise<LsmStats | undefined>}
732
+ * @returns {Promise<MemWalStats | undefined>}
726
733
  */
727
- abstract getLsmStats(includeGenerationRows?: boolean): Promise<LsmStats | undefined>;
734
+ abstract getMemWalStats(includeSstableRows?: boolean): Promise<MemWalStats | undefined>;
728
735
  /** Retrieve the version of the table */
729
736
  abstract version(): Promise<number>;
730
737
  /**
@@ -933,14 +940,14 @@ export declare class LocalTable extends Table {
933
940
  updateFieldMetadata(updates: FieldMetadataUpdate[]): Promise<UpdateFieldMetadataResult>;
934
941
  dropColumns(columnNames: string[]): Promise<DropColumnsResult>;
935
942
  setUnenforcedPrimaryKey(columns: string | string[]): Promise<void>;
936
- setLsmWriteSpec(spec: LsmWriteSpec): Promise<void>;
937
- unsetLsmWriteSpec(): Promise<void>;
938
- getLsmWriteSpec(): Promise<LsmWriteSpec | undefined>;
939
- closeLsmWriters(): Promise<void>;
940
- flushLsm(): Promise<void>;
941
- compactLsm(): Promise<void>;
942
- checkpointLsm(): Promise<void>;
943
- getLsmStats(includeGenerationRows?: boolean): Promise<LsmStats | undefined>;
943
+ enableMemWal(spec: MemWalWriteSpec): Promise<void>;
944
+ disableMemWal(): Promise<void>;
945
+ getMemWalSpec(): Promise<MemWalWriteSpec | undefined>;
946
+ closeMemWalWriters(): Promise<void>;
947
+ flushMemWal(): Promise<void>;
948
+ compactMemWal(): Promise<void>;
949
+ checkpointMemWal(): Promise<void>;
950
+ getMemWalStats(includeSstableRows?: boolean): Promise<MemWalStats | undefined>;
944
951
  version(): Promise<number>;
945
952
  checkout(version: number | string): Promise<void>;
946
953
  checkoutLatest(): Promise<void>;
package/dist/table.js CHANGED
@@ -161,10 +161,16 @@ class LocalTable extends Table {
161
161
  await this.inner.waitForIndex(indexNames, timeoutSeconds);
162
162
  }
163
163
  takeOffsets(offsets) {
164
- return new query_1.TakeQuery(this.inner.takeOffsets(offsets));
164
+ return new query_1.TakeQuery(this.inner.takeOffsets(offsets), {
165
+ table: this.inner,
166
+ withRowId: false,
167
+ });
165
168
  }
166
169
  takeRowIds(rowIds) {
167
- return new query_1.TakeQuery(this.inner.takeRowIds(rowIdsToBigInts(rowIds)));
170
+ return new query_1.TakeQuery(this.inner.takeRowIds(rowIdsToBigInts(rowIds)), {
171
+ table: this.inner,
172
+ withRowId: false,
173
+ });
168
174
  }
169
175
  blobColumns() {
170
176
  return this.inner.blobColumns();
@@ -320,32 +326,32 @@ class LocalTable extends Table {
320
326
  const cols = typeof columns === "string" ? [columns] : columns;
321
327
  return await this.inner.setUnenforcedPrimaryKey(cols);
322
328
  }
323
- async setLsmWriteSpec(spec) {
324
- return await this.inner.setLsmWriteSpec(spec);
329
+ async enableMemWal(spec) {
330
+ return await this.inner.enableMemWal(spec);
325
331
  }
326
- async unsetLsmWriteSpec() {
327
- return await this.inner.unsetLsmWriteSpec();
332
+ async disableMemWal() {
333
+ return await this.inner.disableMemWal();
328
334
  }
329
- async getLsmWriteSpec() {
335
+ async getMemWalSpec() {
330
336
  // The native binding types `specType` as a plain `string`; narrow it back
331
337
  // to the public union. The Rust `From` impl only ever emits one of the
332
338
  // three valid values, so the cast is safe.
333
- return ((await this.inner.getLsmWriteSpec()) ?? undefined);
339
+ return ((await this.inner.getMemWalSpec()) ?? undefined);
334
340
  }
335
- async closeLsmWriters() {
336
- return await this.inner.closeLsmWriters();
341
+ async closeMemWalWriters() {
342
+ return await this.inner.closeMemWalWriters();
337
343
  }
338
- async flushLsm() {
339
- return await this.inner.flushLsm();
344
+ async flushMemWal() {
345
+ return await this.inner.flushMemWal();
340
346
  }
341
- async compactLsm() {
342
- return await this.inner.compactLsm();
347
+ async compactMemWal() {
348
+ return await this.inner.compactMemWal();
343
349
  }
344
- async checkpointLsm() {
345
- return await this.inner.checkpointLsm();
350
+ async checkpointMemWal() {
351
+ return await this.inner.checkpointMemWal();
346
352
  }
347
- async getLsmStats(includeGenerationRows = false) {
348
- return (await this.inner.getLsmStats(includeGenerationRows)) ?? undefined;
353
+ async getMemWalStats(includeSstableRows = false) {
354
+ return (await this.inner.getMemWalStats(includeSstableRows)) ?? undefined;
349
355
  }
350
356
  async version() {
351
357
  return await this.inner.version();
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "ann"
12
12
  ],
13
13
  "private": false,
14
- "version": "0.41.0-beta.6",
14
+ "version": "0.41.0-beta.8",
15
15
  "main": "dist/index.js",
16
16
  "exports": {
17
17
  ".": "./dist/index.js",
@@ -110,13 +110,13 @@
110
110
  "optionalDependencies": {
111
111
  "@huggingface/transformers": "3.0.2",
112
112
  "openai": "4.29.2",
113
- "@lancedb/lancedb-darwin-arm64": "0.41.0-beta.6",
114
- "@lancedb/lancedb-linux-x64-gnu": "0.41.0-beta.6",
115
- "@lancedb/lancedb-linux-arm64-gnu": "0.41.0-beta.6",
116
- "@lancedb/lancedb-linux-x64-musl": "0.41.0-beta.6",
117
- "@lancedb/lancedb-linux-arm64-musl": "0.41.0-beta.6",
118
- "@lancedb/lancedb-win32-x64-msvc": "0.41.0-beta.6",
119
- "@lancedb/lancedb-win32-arm64-msvc": "0.41.0-beta.6"
113
+ "@lancedb/lancedb-darwin-arm64": "0.41.0-beta.8",
114
+ "@lancedb/lancedb-linux-x64-gnu": "0.41.0-beta.8",
115
+ "@lancedb/lancedb-linux-arm64-gnu": "0.41.0-beta.8",
116
+ "@lancedb/lancedb-linux-x64-musl": "0.41.0-beta.8",
117
+ "@lancedb/lancedb-linux-arm64-musl": "0.41.0-beta.8",
118
+ "@lancedb/lancedb-win32-x64-msvc": "0.41.0-beta.8",
119
+ "@lancedb/lancedb-win32-arm64-msvc": "0.41.0-beta.8"
120
120
  },
121
121
  "peerDependencies": {
122
122
  "@types/node": ">=22",