@lancedb/lancedb 0.18.3-beta.0 → 0.19.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/native.d.ts +3 -1
- package/dist/query.d.ts +30 -0
- package/dist/query.js +37 -0
- package/package.json +8 -8
package/dist/native.d.ts
CHANGED
|
@@ -208,7 +208,7 @@ export interface ConnectionOptions {
|
|
|
208
208
|
* Note: this consistency only applies to read operations. Write operations are
|
|
209
209
|
* always consistent.
|
|
210
210
|
*/
|
|
211
|
-
readConsistencyInterval?: number
|
|
211
|
+
readConsistencyInterval?: number | null
|
|
212
212
|
/**
|
|
213
213
|
* (For LanceDB OSS only): configuration for object storage.
|
|
214
214
|
*
|
|
@@ -293,6 +293,7 @@ export class Query {
|
|
|
293
293
|
withRowId(): void
|
|
294
294
|
execute(maxBatchLength?: number | undefined | null): Promise<RecordBatchIterator>
|
|
295
295
|
explainPlan(verbose: boolean): Promise<string>
|
|
296
|
+
analyzePlan(): Promise<string>
|
|
296
297
|
}
|
|
297
298
|
export class VectorQuery {
|
|
298
299
|
column(column: string): void
|
|
@@ -315,6 +316,7 @@ export class VectorQuery {
|
|
|
315
316
|
rerank(callbacks: RerankerCallbacks): void
|
|
316
317
|
execute(maxBatchLength?: number | undefined | null): Promise<RecordBatchIterator>
|
|
317
318
|
explainPlan(verbose: boolean): Promise<string>
|
|
319
|
+
analyzePlan(): Promise<string>
|
|
318
320
|
}
|
|
319
321
|
/**
|
|
320
322
|
* Reranker implementation that "wraps" a NodeJS Reranker implementation.
|
package/dist/query.d.ts
CHANGED
|
@@ -162,6 +162,36 @@ export declare class QueryBase<NativeQueryType extends NativeQuery | NativeVecto
|
|
|
162
162
|
* @returns A Promise that resolves to a string containing the query execution plan explanation.
|
|
163
163
|
*/
|
|
164
164
|
explainPlan(verbose?: boolean): Promise<string>;
|
|
165
|
+
/**
|
|
166
|
+
* Executes the query and returns the physical query plan annotated with runtime metrics.
|
|
167
|
+
*
|
|
168
|
+
* This is useful for debugging and performance analysis, as it shows how the query was executed
|
|
169
|
+
* and includes metrics such as elapsed time, rows processed, and I/O statistics.
|
|
170
|
+
*
|
|
171
|
+
* @example
|
|
172
|
+
* import * as lancedb from "@lancedb/lancedb"
|
|
173
|
+
*
|
|
174
|
+
* const db = await lancedb.connect("./.lancedb");
|
|
175
|
+
* const table = await db.createTable("my_table", [
|
|
176
|
+
* { vector: [1.1, 0.9], id: "1" },
|
|
177
|
+
* ]);
|
|
178
|
+
*
|
|
179
|
+
* const plan = await table.query().nearestTo([0.5, 0.2]).analyzePlan();
|
|
180
|
+
*
|
|
181
|
+
* Example output (with runtime metrics inlined):
|
|
182
|
+
* AnalyzeExec verbose=true, metrics=[]
|
|
183
|
+
* ProjectionExec: expr=[id@3 as id, vector@0 as vector, _distance@2 as _distance], metrics=[output_rows=1, elapsed_compute=3.292µs]
|
|
184
|
+
* Take: columns="vector, _rowid, _distance, (id)", metrics=[output_rows=1, elapsed_compute=66.001µs, batches_processed=1, bytes_read=8, iops=1, requests=1]
|
|
185
|
+
* CoalesceBatchesExec: target_batch_size=1024, metrics=[output_rows=1, elapsed_compute=3.333µs]
|
|
186
|
+
* GlobalLimitExec: skip=0, fetch=10, metrics=[output_rows=1, elapsed_compute=167ns]
|
|
187
|
+
* FilterExec: _distance@2 IS NOT NULL, metrics=[output_rows=1, elapsed_compute=8.542µs]
|
|
188
|
+
* SortExec: TopK(fetch=10), expr=[_distance@2 ASC NULLS LAST], metrics=[output_rows=1, elapsed_compute=63.25µs, row_replacements=1]
|
|
189
|
+
* KNNVectorDistance: metric=l2, metrics=[output_rows=1, elapsed_compute=114.333µs, output_batches=1]
|
|
190
|
+
* LanceScan: uri=/path/to/data, projection=[vector], row_id=true, row_addr=false, ordered=false, metrics=[output_rows=1, elapsed_compute=103.626µs, bytes_read=549, iops=2, requests=2]
|
|
191
|
+
*
|
|
192
|
+
* @returns A query execution plan with runtime metrics for each step.
|
|
193
|
+
*/
|
|
194
|
+
analyzePlan(): Promise<string>;
|
|
165
195
|
}
|
|
166
196
|
/**
|
|
167
197
|
* An interface for a query that can be executed
|
package/dist/query.js
CHANGED
|
@@ -278,6 +278,43 @@ class QueryBase {
|
|
|
278
278
|
return this.inner.explainPlan(verbose);
|
|
279
279
|
}
|
|
280
280
|
}
|
|
281
|
+
/**
|
|
282
|
+
* Executes the query and returns the physical query plan annotated with runtime metrics.
|
|
283
|
+
*
|
|
284
|
+
* This is useful for debugging and performance analysis, as it shows how the query was executed
|
|
285
|
+
* and includes metrics such as elapsed time, rows processed, and I/O statistics.
|
|
286
|
+
*
|
|
287
|
+
* @example
|
|
288
|
+
* import * as lancedb from "@lancedb/lancedb"
|
|
289
|
+
*
|
|
290
|
+
* const db = await lancedb.connect("./.lancedb");
|
|
291
|
+
* const table = await db.createTable("my_table", [
|
|
292
|
+
* { vector: [1.1, 0.9], id: "1" },
|
|
293
|
+
* ]);
|
|
294
|
+
*
|
|
295
|
+
* const plan = await table.query().nearestTo([0.5, 0.2]).analyzePlan();
|
|
296
|
+
*
|
|
297
|
+
* Example output (with runtime metrics inlined):
|
|
298
|
+
* AnalyzeExec verbose=true, metrics=[]
|
|
299
|
+
* ProjectionExec: expr=[id@3 as id, vector@0 as vector, _distance@2 as _distance], metrics=[output_rows=1, elapsed_compute=3.292µs]
|
|
300
|
+
* Take: columns="vector, _rowid, _distance, (id)", metrics=[output_rows=1, elapsed_compute=66.001µs, batches_processed=1, bytes_read=8, iops=1, requests=1]
|
|
301
|
+
* CoalesceBatchesExec: target_batch_size=1024, metrics=[output_rows=1, elapsed_compute=3.333µs]
|
|
302
|
+
* GlobalLimitExec: skip=0, fetch=10, metrics=[output_rows=1, elapsed_compute=167ns]
|
|
303
|
+
* FilterExec: _distance@2 IS NOT NULL, metrics=[output_rows=1, elapsed_compute=8.542µs]
|
|
304
|
+
* SortExec: TopK(fetch=10), expr=[_distance@2 ASC NULLS LAST], metrics=[output_rows=1, elapsed_compute=63.25µs, row_replacements=1]
|
|
305
|
+
* KNNVectorDistance: metric=l2, metrics=[output_rows=1, elapsed_compute=114.333µs, output_batches=1]
|
|
306
|
+
* LanceScan: uri=/path/to/data, projection=[vector], row_id=true, row_addr=false, ordered=false, metrics=[output_rows=1, elapsed_compute=103.626µs, bytes_read=549, iops=2, requests=2]
|
|
307
|
+
*
|
|
308
|
+
* @returns A query execution plan with runtime metrics for each step.
|
|
309
|
+
*/
|
|
310
|
+
async analyzePlan() {
|
|
311
|
+
if (this.inner instanceof Promise) {
|
|
312
|
+
return this.inner.then((inner) => inner.analyzePlan());
|
|
313
|
+
}
|
|
314
|
+
else {
|
|
315
|
+
return this.inner.analyzePlan();
|
|
316
|
+
}
|
|
317
|
+
}
|
|
281
318
|
}
|
|
282
319
|
exports.QueryBase = QueryBase;
|
|
283
320
|
/**
|
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"ann"
|
|
12
12
|
],
|
|
13
13
|
"private": false,
|
|
14
|
-
"version": "0.
|
|
14
|
+
"version": "0.19.0-beta.0",
|
|
15
15
|
"main": "dist/index.js",
|
|
16
16
|
"exports": {
|
|
17
17
|
".": "./dist/index.js",
|
|
@@ -99,13 +99,13 @@
|
|
|
99
99
|
"reflect-metadata": "^0.2.2"
|
|
100
100
|
},
|
|
101
101
|
"optionalDependencies": {
|
|
102
|
-
"@lancedb/lancedb-darwin-x64": "0.
|
|
103
|
-
"@lancedb/lancedb-darwin-arm64": "0.
|
|
104
|
-
"@lancedb/lancedb-linux-x64-gnu": "0.
|
|
105
|
-
"@lancedb/lancedb-linux-arm64-gnu": "0.
|
|
106
|
-
"@lancedb/lancedb-linux-arm64-musl": "0.
|
|
107
|
-
"@lancedb/lancedb-win32-x64-msvc": "0.
|
|
108
|
-
"@lancedb/lancedb-win32-arm64-msvc": "0.
|
|
102
|
+
"@lancedb/lancedb-darwin-x64": "0.19.0-beta.0",
|
|
103
|
+
"@lancedb/lancedb-darwin-arm64": "0.19.0-beta.0",
|
|
104
|
+
"@lancedb/lancedb-linux-x64-gnu": "0.19.0-beta.0",
|
|
105
|
+
"@lancedb/lancedb-linux-arm64-gnu": "0.19.0-beta.0",
|
|
106
|
+
"@lancedb/lancedb-linux-arm64-musl": "0.19.0-beta.0",
|
|
107
|
+
"@lancedb/lancedb-win32-x64-msvc": "0.19.0-beta.0",
|
|
108
|
+
"@lancedb/lancedb-win32-arm64-msvc": "0.19.0-beta.0"
|
|
109
109
|
},
|
|
110
110
|
"peerDependencies": {
|
|
111
111
|
"apache-arrow": ">=15.0.0 <=18.1.0"
|