feat(nodejs): open source-bearing blob descriptors (#5238)

Add `Table.openBlobFile` and `Table.openBlobFiles` for source-bearing
SQL `blob_descriptor` results, matching the existing Rust and Python
APIs.

The TypeScript methods forward the descriptor to the shared Rust opener
instead of reimplementing routing. That keeps the 10 MiB direct-read
threshold, pinned snapshot identity, resolver refresh, and 503
single-shot proxy fallback identical to `fetchBlobFiles` and the other
public Blob V2 entries. Descriptor fields remain the snake_case shape
returned by Arrow/SQL; the wrapper converts unsigned 64-bit values to
`bigint` at the NAPI boundary and returns `null` for null descriptors.
Existing custom `Table` subclasses keep working through a default "not
supported" implementation.

Validation:
- `pnpm tsc`
- `pnpm lint`
- `pnpm test --runInBand __test__/blob_open.test.ts
__test__/blob_ranges.test.ts __test__/remote_blob_snapshot.test.ts` — 65
passed
- focused Rust core tests for direct opens, threshold routing, snapshot
preservation, and 503 fallback — passed

The docs also update the TypeScript cross-row range table and example;
`fetchBlobRanges` was already implemented but was still documented as
unavailable.
This commit is contained in:
Xuanwo
2026-11-27 00:16:29 +08:00
committed by GitHub
parent 85dcf3a3c5
commit 1c0118015c
14 changed files with 692 additions and 36 deletions
+27
View File
@@ -27,6 +27,33 @@ rows = db.execute_query("SELECT id, blob_descriptor(video) AS descriptor FROM vi
with table.open_blob_file(rows[0]["descriptor"]) as reader:
payload = reader.read()
```
```typescript TypeScript icon="typescript"
const rows = await table
.query()
.select({ descriptor: "blob_descriptor(video)" })
.toArray();
const reader = await table.openBlobFile(rows[0].descriptor);
if (reader) {
const payload = await reader.read();
await reader.close();
}
```
```rust Rust icon="rust"
use lancedb::{blob::BlobDescriptor, Table};
async fn read_descriptor(
table: &Table,
descriptor: &BlobDescriptor,
) -> lancedb::Result<()> {
let reader = table.open_blob_file(descriptor).await?;
let payload = reader.read().await?;
println!("{} bytes", payload.len());
reader.close().await?;
Ok(())
}
```
</CodeGroup>
A descriptor is pinned to the table version it was read at: it keeps