@lancedb/lancedb 0.22.3-beta.3 → 0.22.3-beta.4

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.d.ts CHANGED
@@ -2,12 +2,7 @@ import { Table as ArrowTable, type IntoVector, RecordBatch } from "./arrow";
2
2
  import { type IvfPqOptions } from "./indices";
3
3
  import { JsFullTextQuery, RecordBatchIterator as NativeBatchIterator, Query as NativeQuery, Table as NativeTable, TakeQuery as NativeTakeQuery, VectorQuery as NativeVectorQuery } from "./native";
4
4
  import { Reranker } from "./rerankers";
5
- export declare class RecordBatchIterator implements AsyncIterator<RecordBatch> {
6
- private promisedInner?;
7
- private inner?;
8
- constructor(promise?: Promise<NativeBatchIterator>);
9
- next(): Promise<IteratorResult<RecordBatch<any>>>;
10
- }
5
+ export declare function RecordBatchIterator(promisedInner: Promise<NativeBatchIterator>): AsyncGenerator<RecordBatch<any>, void, unknown>;
11
6
  /**
12
7
  * Options that control the behavior of a particular query execution
13
8
  */
@@ -107,7 +102,7 @@ export declare class QueryBase<NativeQueryType extends NativeQuery | NativeVecto
107
102
  * single query)
108
103
  *
109
104
  */
110
- protected execute(options?: Partial<QueryExecutionOptions>): RecordBatchIterator;
105
+ protected execute(options?: Partial<QueryExecutionOptions>): AsyncGenerator<RecordBatch<any>, void, unknown>;
111
106
  /**
112
107
  * @hidden
113
108
  */
package/dist/query.js CHANGED
@@ -2,38 +2,24 @@
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.BooleanQuery = exports.MultiMatchQuery = exports.BoostQuery = exports.PhraseQuery = exports.MatchQuery = exports.Occur = exports.Operator = exports.FullTextQueryType = exports.Query = exports.TakeQuery = exports.VectorQuery = exports.StandardQueryBase = exports.QueryBase = exports.RecordBatchIterator = void 0;
5
+ exports.BooleanQuery = exports.MultiMatchQuery = exports.BoostQuery = exports.PhraseQuery = exports.MatchQuery = exports.Occur = exports.Operator = exports.FullTextQueryType = exports.Query = exports.TakeQuery = exports.VectorQuery = exports.StandardQueryBase = exports.QueryBase = void 0;
6
+ exports.RecordBatchIterator = RecordBatchIterator;
6
7
  exports.instanceOfFullTextQuery = instanceOfFullTextQuery;
7
8
  const arrow_1 = require("./arrow");
8
9
  const native_1 = require("./native");
9
- class RecordBatchIterator {
10
- promisedInner;
11
- inner;
12
- constructor(promise) {
13
- // TODO: check promise reliably so we dont need to pass two arguments.
14
- this.promisedInner = promise;
15
- }
16
- // biome-ignore lint/suspicious/noExplicitAny: skip
17
- async next() {
18
- if (this.inner === undefined) {
19
- this.inner = await this.promisedInner;
20
- }
21
- if (this.inner === undefined) {
22
- throw new Error("Invalid iterator state state");
23
- }
24
- const n = await this.inner.next();
25
- if (n == null) {
26
- return Promise.resolve({ done: true, value: null });
27
- }
28
- const tbl = (0, arrow_1.tableFromIPC)(n);
29
- if (tbl.batches.length != 1) {
10
+ async function* RecordBatchIterator(promisedInner) {
11
+ const inner = await promisedInner;
12
+ if (inner === undefined) {
13
+ throw new Error("Invalid iterator state");
14
+ }
15
+ for (let buffer = await inner.next(); buffer; buffer = await inner.next()) {
16
+ const { batches } = (0, arrow_1.tableFromIPC)(buffer);
17
+ if (batches.length !== 1) {
30
18
  throw new Error("Expected only one batch");
31
19
  }
32
- return Promise.resolve({ done: false, value: tbl.batches[0] });
20
+ yield batches[0];
33
21
  }
34
22
  }
35
- exports.RecordBatchIterator = RecordBatchIterator;
36
- /* eslint-enable */
37
23
  class RecordBatchIterable {
38
24
  inner;
39
25
  options;
@@ -43,7 +29,7 @@ class RecordBatchIterable {
43
29
  }
44
30
  // biome-ignore lint/suspicious/noExplicitAny: skip
45
31
  [Symbol.asyncIterator]() {
46
- return new RecordBatchIterator(this.inner.execute(this.options?.maxBatchLength, this.options?.timeoutMs));
32
+ return RecordBatchIterator(this.inner.execute(this.options?.maxBatchLength, this.options?.timeoutMs));
47
33
  }
48
34
  }
49
35
  /** Common methods supported by all query types
@@ -166,15 +152,14 @@ class QueryBase {
166
152
  *
167
153
  */
168
154
  execute(options) {
169
- return new RecordBatchIterator(this.nativeExecute(options));
155
+ return RecordBatchIterator(this.nativeExecute(options));
170
156
  }
171
157
  /**
172
158
  * @hidden
173
159
  */
174
160
  // biome-ignore lint/suspicious/noExplicitAny: skip
175
161
  [Symbol.asyncIterator]() {
176
- const promise = this.nativeExecute();
177
- return new RecordBatchIterator(promise);
162
+ return RecordBatchIterator(this.nativeExecute());
178
163
  }
179
164
  /** Collect the results as an Arrow @see {@link ArrowTable}. */
180
165
  async toArrow(options) {
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "ann"
12
12
  ],
13
13
  "private": false,
14
- "version": "0.22.3-beta.3",
14
+ "version": "0.22.3-beta.4",
15
15
  "main": "dist/index.js",
16
16
  "exports": {
17
17
  ".": "./dist/index.js",
@@ -100,14 +100,14 @@
100
100
  "reflect-metadata": "^0.2.2"
101
101
  },
102
102
  "optionalDependencies": {
103
- "@lancedb/lancedb-darwin-x64": "0.22.3-beta.3",
104
- "@lancedb/lancedb-darwin-arm64": "0.22.3-beta.3",
105
- "@lancedb/lancedb-linux-x64-gnu": "0.22.3-beta.3",
106
- "@lancedb/lancedb-linux-arm64-gnu": "0.22.3-beta.3",
107
- "@lancedb/lancedb-linux-x64-musl": "0.22.3-beta.3",
108
- "@lancedb/lancedb-linux-arm64-musl": "0.22.3-beta.3",
109
- "@lancedb/lancedb-win32-x64-msvc": "0.22.3-beta.3",
110
- "@lancedb/lancedb-win32-arm64-msvc": "0.22.3-beta.3"
103
+ "@lancedb/lancedb-darwin-x64": "0.22.3-beta.4",
104
+ "@lancedb/lancedb-darwin-arm64": "0.22.3-beta.4",
105
+ "@lancedb/lancedb-linux-x64-gnu": "0.22.3-beta.4",
106
+ "@lancedb/lancedb-linux-arm64-gnu": "0.22.3-beta.4",
107
+ "@lancedb/lancedb-linux-x64-musl": "0.22.3-beta.4",
108
+ "@lancedb/lancedb-linux-arm64-musl": "0.22.3-beta.4",
109
+ "@lancedb/lancedb-win32-x64-msvc": "0.22.3-beta.4",
110
+ "@lancedb/lancedb-win32-arm64-msvc": "0.22.3-beta.4"
111
111
  },
112
112
  "peerDependencies": {
113
113
  "apache-arrow": ">=15.0.0 <=18.1.0"
File without changes