Commit Graph
859 Commits
Author SHA1 Message Date
Lance Release 585e598092 Bump version: 0.43.0-beta.0 → 0.43.0-beta.1 2026-12-02 07:20:55 +00:00
lancedb-gatefixer[bot]andXuanwo 43d28def80 docs(node): clarify full-text search filtering (#3813)
## Summary

- Replace the website's TypeScript full-text filtering examples with a
snippet generated from `docs/web-tests/ts/full_text_search.test.ts`. In
a full-text-only query, `where(...)` filters rows before the search
selects candidates.
- Update the guide and regenerate the Node API reference. Vector and
hybrid queries also prefilter by default and can use
`VectorQuery.postfilter()`. In hybrid search, it filters candidates from
both searches before reranking.

## Root cause

The website's TypeScript examples used the legacy `vectordb` method
`.prefilter(...)`, which is absent from `@lancedb/lancedb`. The Node API
reference left full-text and hybrid filter timing implicit.

## Validation

- Ran `full_text_search.test.ts`, `filtering.test.ts`, and
`search_examples.test.ts` in `docs/web-tests/ts` with the locked npm
SDK. All eight tests passed, as did a targeted TypeScript check of those
files.
- Ran the exact snippet imported by the guide against the locked npm SDK
and the SDK built from this branch. Both runs returned the expected
full-text match and confirmed prefiltering and postfiltering behavior
for vector and hybrid queries.
- Built the Node native binding, compiled the SDK, and regenerated the
TypeDoc reference. Biome passed for the SDK, SDK examples, and the
changed website test. The full website test directory produced the same
existing Biome and TypeScript diagnostics as `main`.

Fixes #2237

<!-- lance-gatekeeper-fix:v1 agent=1e80a282d1024d8eadf8e0ff33d83c9d
generation=1 -->

---------

Co-authored-by: Gatefixer <313497061+lancedb-gatefixer[bot]@users.noreply.github.com>
Co-authored-by: Xuanwo <github@xuanwo.io>
2026-12-02 13:42:46 +08:00
b3a8e6f08d fix: read LANCEDB_API_KEY when connecting to remote without api_key (#5166)
## Summary

- Rust remote connect reads `LANCEDB_API_KEY` when a `db://` connection
has no `api_key` and no `oauth_config`. Python already does this in its
own wrapper; Node and Rust callers did not.
- An explicit API key still wins. An empty `LANCEDB_API_KEY` is treated
as present, matching Python's `is None` check, and the connection sends
no `x-api-key` header.
- OAuth does not read the variable, so an ambient key cannot turn an
OAuth connect into an invalid API-key-plus-OAuth configuration. The
fallback lives in Rust `execute_remote`, so Node does not write the
credential into the caller's options object.

Supersedes #3797, which is stale and conflicting. This addresses the
Gatekeeper requests there: do not apply the environment key when
`oauthConfig` is set, and do not write it into the caller-owned options.

## Test plan

- [x] `cargo test --features remote -p lancedb --lib connection::` (each
env case re-runs the test binary as a child process with
`LANCEDB_API_KEY` set or removed on the child `Command`; no in-process
`set_var`/`remove_var`)
- [x] `cargo clippy -p lancedb --all-targets --features remote -- -D
warnings`
- [x] `cargo fmt --all -- --check`
- [x] `cd nodejs && pnpm build`
- [x] `cd nodejs && pnpm exec jest __test__/remote_api_key_env.test.ts`
(env set only in a child process; missing-key case asserts `connect()`
itself rejects against the loopback endpoint; OAuth case asserts
`x-api-key` is absent)
- [x] `cd nodejs && pnpm lint-ci`; `pnpm run docs` leaves `docs/src/js`
unchanged

Written with Cursor (Grok).

---------

Co-authored-by: Preston Zhao <195942578+canyang25@users.noreply.github.com>
Co-authored-by: Xuanwo <github@xuanwo.io>
2026-12-02 13:04:57 +08:00
0abc7d48be fix(node): preserve incoming Arrow schema on overwrite (#5276)
## Summary

- Use the incoming Arrow schema and metadata for Arrow overwrite input,
even if the previous table had automatic embeddings.
- Preserve current schema conversion for append and row-object
overwrite.

- Resolve the incoming schema's embedding provider only when its vector
column needs generation. Compute missing vectors across every Arrow
batch.

## Validation

- Native regression creates an embedding table, verifies that a row
overwrite computes its vector, then replaces the table with a different
Arrow schema and checks its metadata and stored row. The test fails on
main when the SDK passes a null value to the previous embedding
function.
- Embedding Jest suite with the 0.42.0-beta.38 native binding: 15
passed, 1 skipped (requires an OpenAI key). TypeScript compilation with
`--noEmit` and Biome checks passed.

- Reopened two-batch imports preserve both precomputed vectors with no
provider registered and generate vectors for both rows when inputs are
missing. Both regressions failed before the follow-up. Across
`embedding.test.ts` and `arrow.test.ts`, 511 passed and one OpenAI
integration was skipped. TypeScript and Biome passed.

Fixes https://github.com/lancedb/lancedb/issues/5275

---------

Co-authored-by: Divyam Talwar <DivyamTalwar@users.noreply.github.com>
Co-authored-by: Divyam Talwar <194859478+DivyamTalwar@users.noreply.github.com>
2026-12-02 07:06:30 +08:00
3129573909 fix(node): materialize blobs selected with quoted SQL names (#5286)
Fixes #5285.

## Summary

- Decode a backtick-quoted SQL column name for the Blob bytes lookup.
Continue passing the original SQL through to query execution.
- Cover direct Blob aliases and a quoted struct containing a nested
Blob, alongside unchanged unquoted projections and SQL string literals.

- Preserve the existing descriptor output in Embedded queries when a
quoted identifier itself contains a dot. A separate projection of the
actual nested Blob still returns its bytes.

## Testing

- Reproduced the descriptor output with the published Node package and
saw the new native Embedded regression fail on main.
- 206 tests passed across the native nested Blob, Blob, expression, and
query suites. Independently reran the new regression.
- TypeScript build, targeted Biome checks, and `git diff --check`
passed. Tests use the release-matched native module.

AI assistance was used to identify, implement, and review the change.

---------

Co-authored-by: Divyam Talwar <152021174+DivyamTalwar@users.noreply.github.com>
Co-authored-by: Divyam Talwar <194859478+DivyamTalwar@users.noreply.github.com>
2026-12-02 07:05:51 +08:00
193c9d8e2e docs: fail docs build on warnings (#3707)
## Summary

- run the existing MkDocs deployment build in strict mode
- turn documentation warnings, including unresolved references, into CI
failures instead of deploying them

## Why

The docs workflow currently completes when MkDocs emits warnings. Using
MkDocs' built-in strict mode makes the deployment stop on those warnings
and surfaces documentation problems immediately. This addresses the
warning-detection portion of #572 without adding another dependency or
duplicating the docs build.

## Validation

- `git diff --check`
- parsed `.github/workflows/docs.yml` with PyYAML
- full `mkdocs build --strict` was not run locally because MkDocs is not
installed; the existing docs workflow has the required dependencies

---------

Co-authored-by: Will Jones <willjones127@gmail.com>
Co-authored-by: Xuanwo <github@xuanwo.io>
2026-12-02 02:03:26 +08:00
BHAWESHBHASKARandXuanwo fb853bae75 feat(nodejs): expose the NGram scalar index (#4908)
The Rust core (lancedb::index::scalar::NGramIndexBuilder) and the Python
SDK already support the NGram scalar index, and the Node.js SDK can
create one on Embedded with `Index.plugin("ngram")`. This change adds a
dedicated `Index.ngram()` factory. NGram is a scalar index on a UTF-8
string column that accelerates substring filters such as contains(col,
'needle'), along with some LIKE and regular-expression predicates, by
narrowing a scan to rows that share the query's trigrams.

Add an ngram() napi factory and Index.ngram() in the TypeScript SDK,
mirroring the existing btree and fm scalar index factories, with tests
for both factories. On Embedded, the query plan uses the index and the
exact substring filter excludes rows that only share the query’s
trigrams. On Enterprise, `Index.ngram()` sends `index_type: "NGRAM"`,
while `Index.plugin("ngram")` sends `index_type: "PLUGIN"` with
`plugin_type: "NGRAM"`.

---------

Co-authored-by: Xuanwo <github@xuanwo.io>
2026-12-01 21:39:01 +08:00
SHAIK SHIVAJIandXuanwo 144c07cee3 feat(nodejs): expose code analyzer options on FtsOptions and tokenize (#4889)
Completes #4364 together with #4756, which did the Python side.

## Changes

- `Index.fts()` / `FtsOptions` and `tokenize()` gain `analyzer`
(`"text"` or `"code"`), `splitIdentifiers`, `splitOnNumerics`,
`preserveOriginal` and `indexOperators`. All are optional, so existing
indexes and calls behave as before.
- Validation matches the Python SDK: `analyzer: "code"` with a
`baseTokenizer` other than `"code"` or `"simple"` is rejected,
`analyzer: "text"` with `baseTokenizer: "code"` is rejected, and turning
on a code flag without the code analyzer is rejected. Passing a flag as
`false` is always allowed. The checks live in one helper used by both
`fts` and `tokenize`.
- The option docs state the defaults (`analyzer: "code"` alone keeps
identifiers whole; `splitOnNumerics` and `preserveOriginal` only matter
with `splitIdentifiers: true`) and link the two Lance limitations noted
on #4756 (lance#9674 and lance#9658).

Shared presets can still include extra fields. For example, a preset can
carry the index name for `createIndex()` alongside the analyzer options
used by `Index.fts()` and `tokenize()`.

## Tests

The Node tests check exact tokens from both the named index and
standalone tokenization, whole identifiers, subword matches, shared
presets and invalid combinations of known options. With the rebuilt
native addon, the full local Jest run passed 2,045 tests across 37
suites, with 27 tests skipped. TypeScript checks, lint and API reference
regeneration also passed.

---------

Co-authored-by: Xuanwo <github@xuanwo.io>
2026-12-01 20:58:15 +08:00
Lance Release 2cc9cdfac4 Bump version: 0.42.0-beta.38 → 0.43.0-beta.0 2026-12-01 12:43:00 +00:00
Yang Cen 155457d0e5 feat(query): allow unordered vector and full-text search results (#5328)
## Summary

Callers that consume every selected hit can relax the final output order
with `ordered_results(false)` in Rust, `ordered_results(False)` in
Python, or `orderedResults(false)` in TypeScript. Ranked output remains
the default. The option preserves top-k selection, each hit’s score and
projected columns, and the existing rules for ties at the cutoff.

Embedded passes eligible queries to the Lance scanner. Enterprise sends
`"ordered": false` for eligible searches and omits the field by default.
Explicit sorting, positive offsets, batch vector queries and inputs to
hybrid fusion or reranking keep their existing order.

## Validation

A managed Linux preview passed 8 Rust wire cases, 4 Embedded Python
cases, 10 HTTP mock cases and all 52 TypeScript query tests. The preview
used a candidate Lance revision. Project CI on this PR validates the
integration with the official Lance `v16.0.0-beta.6`.

Uses the official Lance dependency from #5327, now merged into `main`.
2026-12-01 20:41:37 +08:00
DogerW 2c094ac4e6 fix(node): accept shared and cross-realm ArrayBuffers in table updates (#5325)
`Table.update({ values })` accepts `ArrayBufferLike` in TypeScript, but
passing a `SharedArrayBuffer` to update a binary column throws
`Unsupported value type: object value: ([object SharedArrayBuffer])`. An
ordinary `ArrayBuffer` created in another Node.js VM context also fails
the serializer's `instanceof ArrayBuffer` check.

Use Node's `isAnyArrayBuffer` to recognize both kinds of buffer across
contexts, then pass their bytes through the existing SQL binary literal
encoder.

The table regression writes `00 80 ff` from shared memory and reads the
bytes back on each supported Arrow major (15–21). A separate serializer
test covers an `ArrayBuffer` from another VM context. All eight cases
failed before the fix.

### Validation

- Node 22 on macOS arm64, using the upstream native build from
`0d735c9`: both complete Jest files passed (701 passed, 3 skipped).
- Node SDK Biome checks and strict TypeScript checks for the serializer
and its unit tests passed. The full SDK type check reported the same ten
diagnostics on the base commit and patched tree with this local setup
(optional embedding packages and older native reranker declarations).
2026-12-01 18:24:19 +08:00
Tomwang.ethandtomwangcn 76c8bf335a fix: expose branch create_at and metadata in branches.list() for node and python (#4914)
Fixes #4849.

**Problem**
- TypeScript SDK: `Branches.list()` returned napi class instances whose
fields live on the prototype, so `console.log`, spread and
`JSON.stringify` showed `{}` (the exact symptom in the docs example).
`create_at` and `metadata`, which Lance already stores for every branch,
were not exposed at all.
- Python SDK: the `Branches.list()` dicts also dropped `create_at` and
`metadata`.

**Change**
- `nodejs/src/table.rs`: `BranchContents` stays a runtime napi class
export and gains `create_at` (Unix seconds) and `metadata`, populated
from the stored Lance branch contents. The `metadata` getter defines
every key as an own enumerable data property (`napi_define_properties`),
so keys like `__proto__` that ordinary map conversion would route to the
prototype setter are preserved.
- `nodejs/lancedb/table.ts`: the `Branches.list()` wrapper promotes all
fields (`parentBranch`, `parentVersion`, `createAt`, `manifestSize`,
`metadata`) to own enumerable properties on each returned instance by
reusing the class getters and setters, so spread and `JSON.stringify`
see them while `instanceof` keeps working. Its return type is
`ListedBranchContents`, which guarantees `createAt` and `metadata`.
- Public typing: the exported `BranchContents` type keeps its released
shape (`parentBranch`/`parentVersion`/`manifestSize` only), so values
and interfaces written against it stay assignable and extendable,
including a view whose `createAt` is a `Date` and an interface that
extends `BranchContents` with its own `metadata`. `ListedBranchContents
extends BranchContents` adds `createAt` and `metadata` as required
fields, and the exported `BranchContents` constructor value has its
`prototype` typed as `BranchContents`, so the class value and
`instanceof` checks are unchanged.
- `python/src/table.rs`: `Branches.list()` dicts now include `create_at`
and `metadata`.
- Docs: regenerated TypeScript API reference for the new shape, and the
branching guide now documents `createAt`/`create_at` (Unix seconds) and
`metadata`.

**Tests**
- `nodejs/__test__/table.test.ts`: a branch whose stored ref file
carries non-empty metadata (including a `__proto__` key) and a known
creation time in Unix seconds is listed with both, as a `BranchContents`
instance with own enumerable fields, surviving spread and a JSON
round-trip with every metadata key intact. A second test covers the
consumer type contracts with `tsc`: a released-shape value with an extra
`createAt: Date` stays assignable to `BranchContents`, an interface
extending `BranchContents` can declare its own `metadata` shape, the
exported constructor's `prototype` is typed as `BranchContents`, and
`branches.list()` results guarantee `createAt` and `metadata`.
- `python/python/tests/test_table.py::test_branches`: same
non-empty-metadata (with `__proto__`) and known-`create_at` coverage.
- Verified locally on Linux x86_64: `tsc -b`, Biome checks, regenerated
docs diff limited to the `BranchContents` pages, node branches suite (34
passed), python `test_branches` (4 passed, 1 skipped).

---------

Co-authored-by: tomwangcn <tomwangcn@users.noreply.github.com>
2026-12-01 17:29:44 +08:00
KeeProMiseandXuanwo a85cb92ffd feat: support vector-only and FTS-only reranking (#3024)
Add rerank_vector() and rerank_fts() methods to Reranker trait, allowing
rerankers to work with single search modes instead of only hybrid
search.

Implemented for:
- RRFReranker (Rust and Python)
- LinearCombinationReranker (Python)

Resolves TODO at rust/lancedb/src/rerankers.rs:55

Changes:
- Extended Reranker trait with default implementations
- Added unit tests for new methods
- Updated documentation with examples

---------

Co-authored-by: Xuanwo <github@xuanwo.io>
2026-12-01 17:07:02 +08:00
lipeh1andlipeih 45718a938c test(node): speed up Jest transforms with SWC (#5182)
Jest now uses SWC to transpile the Node SDK tests, with the same ES2022
target and legacy decorator semantics as the SDK. The Node and Arrow
compatibility jobs run the existing test TypeScript project through `tsc
--noEmit` after building the SDK. Contributors can run that check with
`pnpm run typecheck:tests`.

Closes #2234.

Measured on Windows x64 with Node 22.23.4, Jest 29.7, the default native
features and one Jest process (`--runInBand --silent`). Both runs used
the same 0.42.0-beta.26 Windows native binary. Times below are
wall-clock seconds.

| Workload | ts-jest | SWC |
| --- | ---: | ---: |
| Six suites, empty Jest cache (median of three) | 8.31 | 4.22 |
| Same six suites, populated cache (median of three) | 4.45 | 3.52 |
| Full default suite, empty Jest cache (one run each) | 50.10 | 38.55 |

The six suites were `arrow`, `expr`, `materialized_view`, `package`,
`registry` and `sanitize`. Each pair started with a fresh Jest cache
directory and immediately reused it on the second run. The separate test
type check took 3.39 s, bringing the full SWC run plus type checking to
41.94 s on this machine.

Both full runs passed the same 1,882 tests with 28 skipped. The SDK
TypeScript build, test type check, Biome checks and TypeDoc build also
passed.

---------

Co-authored-by: lipeih <lipeihan@eazytec.com>
2026-12-01 14:04:35 +08:00
Xuanwo 4e7d5c0d1a fix(node): link standalone Rust tests without Node (#5321)
The Node binding's Rust tests construct and drop `napi::Error`. Its
cleanup code references Node-API symbols, which Node supplies when it
loads the addon. Standalone Rust test executables have no Node host, so
`lancedb-nodejs` fails at link time. [Linux
`build-no-lock`](https://github.com/lancedb/lancedb/actions/runs/46573309068/job/142389591633)
· [macOS 15 `--locked` test
job](https://github.com/lancedb/lancedb/actions/runs/46574143498/job/142392302720)

Enable napi-rs `dyn-symbols` through the dev dependency. Cargo activates
it when building the existing Rust tests and uses the original linkage
for ordinary addon builds.

On `08911d637`, deleting `Cargo.lock` and running `cargo +stable build
--profile ci --all-features --tests -p lancedb-nodejs --jobs 2`
reproduced the three missing symbols. With the same freshly resolved
dependencies, `cargo +stable test --profile ci --all-features --tests -p
lancedb-nodejs --jobs 2` linked and passed all 10 tests, including the
cause chain and resource metadata assertions.

---------

Signed-off-by: Xuanwo <github@xuanwo.io>
2026-12-01 13:16:02 +08:00
yuzhouandXuanwo b3ad97a28d feat(node): surface Rust errors as typed JavaScript errors (#4901)
## Summary
The Node SDK now throws typed `LanceError` subclasses instead of one
generic `Error` with an indented `Caused by` string.

Fixes #222

## Before / after
```ts
try {
  await db.openTable(\"missing\");
} catch (error) {
  if (error instanceof TableNotFoundError) {
    error.code;       // \"TableNotFound\"
    error.tableName;  // \"missing\"
    error.message;    // \"Table 'missing' was not found\"
    error.cause;      // underlying dataset error
  }
}
```

## Changes
- `nodejs/src/error.rs` — map each `lancedb::Error` variant to a
one-line header + `error.cause`
- `nodejs/src/query.rs`, `nodejs/src/merge.rs` — pass errors through
instead of stringifying
- `nodejs/lancedb/errors.ts`, `errors_install.ts` — real subclasses when
the package loads
- Tests + generated API docs under `docs/src/js/`

## Test plan
- [x] Native debug build, `tsc`, Biome, `cargo clippy -p lancedb-nodejs`
- [x] Jest: new error tests, remote retry, connection/query/table (594
passed)

## Notes
Node-API cannot construct a custom `Error` subclass from an async Rust
rejection, so translation happens in JS when `@lancedb/lancedb` loads.
Calling the raw native addon without that entrypoint still shows the
header line.

---------

Signed-off-by: ZYZ666-RGB <1991039819@qq.com>
Signed-off-by: yuzhou <1991039819@qq.com>
Co-authored-by: Xuanwo <github@xuanwo.io>
2026-12-01 11:28:22 +08:00
Tomwang.ethandXuanwo 7efeb06bc5 fix(node): reject non-integer values for integer-only numeric options (#4916)
## Problem
Several Node APIs accept integer-only options but pass JavaScript
numbers straight to integer N-API parameters. Fractional values are
silently truncated, so `checkout(1.5)` checks out version 1,
`tags.create("v1", 1.5)` pins version 1, `limit(2.5)` returns two rows,
and bucket `numBuckets: 2.5` enables two buckets instead of rejecting
the input. Negative or out-of-range values also reach Rust after lossy
conversion.

## Change
- The native `Tags` export is kept: code registering `Tags` as a `new ()
=> Tags` constructor still compiles. Validation for tag versions happens
in `Tags.prototype.create`/`update` wrappers, and #5145's
`tags.create(name)` and `tags.create(name, null)` behavior (tag the
handle's visible version) is preserved and tested.
- `checkout(version)` validates numeric versions as non-negative
integers before conversion.
- `numBuckets` is checked only for the `bucket` write spec and must be
an integer in 1–1024 before native conversion; `identity` and
`unsharded` specs ignore it.
- `limit` on plain and vector queries is checked against the native
`u32` range (0–4294967295) before conversion, covering the upper
boundary; `limit(0)` still returns no rows from plain queries.
- `nprobes`, `minimumNprobes`, `maximumNprobes`, `ef` and `refineFactor`
reject non-integers via the existing `validateNonNegativeInteger`.
Fractional `searchEffort` stays valid and is covered by a positive
regression assertion. Branch APIs are outside this patch.

This does not change the separate `TagContents` serialization fix in
#4915, and is based directly on main rather than stacked on it. This is
not a complete audit of numeric options.

## Validation
- New regression tests: fractional checkout version; non-integer tag
create/update versions plus `create(name)`/`create(name, null)`
preserved; non-integer query options with `searchEffort` positive case;
`limit` u32 upper boundary accepted, one-past rejected, `limit(0)`
returning no rows; `numBuckets` fractional/0/1025 rejected for `bucket`
and ignored by `identity`/`unsharded`.
- All pass locally on Linux x86_64 against a native build from main;
`tsc -b` and Biome checks pass. TypeScript-only change; Rust and Python
sources unchanged.

---------

Co-authored-by: Xuanwo <github@xuanwo.io>
2026-12-01 10:24:46 +08:00
c105797249 fix(node): contain rejected table write progress callbacks (#5274)
Fixes #5273

## Summary

Handle promises returned from `Table.add(..., { progress })` through the
existing callback warning path. The callback stays unawaited and the
write does not depend on its result. The patch covers write progress in
the native append path, which is separate from `Job.wait` progress.

## Validation

- The real native append regression resolves the write, reads its newly
committed rows, and then rejects the final progress callback. All seven
Apache Arrow variant cases fail on main because the warning is missing.
- With the patch, 28 append, overwrite, and progress tests pass with the
matching native beta binding.
- An actual Node run with `--unhandled-rejections=strict` exits on the
observer error on main. The patch logs the warning and reads three
expected rows.
- Biome checks on changed files and `git diff --check` pass.

---------

Co-authored-by: Divyam Talwar <237515611+DivyamTalwar@users.noreply.github.com>
Co-authored-by: Divyam Talwar <DivyamTalwar@users.noreply.github.com>
2026-11-30 21:46:22 +08:00
c90382e9c4 fix(node): handle rejected job progress callbacks (#5272)
Fixes #5271

## Summary

A promise returned from a job progress callback could reject outside the
SDK's synchronous error handler. This calls the observer synchronously
as before and attaches a rejection handler without awaiting it.

## Validation

- The regression test holds the observer promise open until `Job.wait`
completes, then rejects it and verifies the warning.
- All 4 tests in `nodejs/__test__/job.test.ts` pass using the native job
boundary stub and the published matching beta native declarations.
- A separate actual Node run with `--unhandled-rejections=strict` exits
at the observer error on main. It logs the error and continues with the
patch.
- Biome lint and format checks passed on the two changed files. `git
diff --check` passed.

---------

Co-authored-by: Divyam Talwar <237515611+DivyamTalwar@users.noreply.github.com>
Co-authored-by: Divyam Talwar <DivyamTalwar@users.noreply.github.com>
2026-11-30 21:46:02 +08:00
80c889cd9e docs: explain merge insert execution costs (#4501)
resolves #4258

## Summary

- document how indexed partial-column merges patch columns across
touched fragments
- explain how full-scan merges rewrite rows and can materialize the
target table
- describe the index-coverage, batching, and memory tradeoffs
- align the Python, Rust, and TypeScript `use_index` API documentation

## Verification

- `git diff --check`
- Ruff 0.15.20 formatting check for `python/python/lancedb/merge.py`
- Biome 1.9.4 check for `nodejs/lancedb/merge.ts`
- reviewed the rendered MDX structure and cross-SDK wording

The TypeDoc generation command was also attempted. It cannot complete in
this checkout because the Rust-generated `nodejs/lancedb/native.d.ts`
artifact is absent and Rust tooling is not installed; TypeDoc stops on
the resulting pre-existing module-resolution errors before generating
output.

---------

Signed-off-by: Himanshu S <me.mrhimanshu@gmail.com>
Co-authored-by: Himanshu <18554133+mrhimanshu@users.noreply.github.com>
Co-authored-by: Himanshu S <me.mrhimanshu@gmail.com>
2026-11-30 21:23:27 +08:00
lancedb-gatefixer[bot] d9db83de65 fix!: guard remote index routes against dot segments (#5013)
BREAKING CHANGE: Older Enterprise index listings that require per-index
statistics now omit historical entries with empty names, `.` or `..`.
Remote index operations reject these unaddressable names. Operators
needing to remove such entries can use server-side maintenance; direct
native access also supports cleanup. Ordinary index names and
`exist_ok=True` reuse require no migration.

Fixes #5007

Remote index URLs previously allowed `.` and `..` as path segments.
Reqwest normalizes them, so dropping an index named `..` could send the
table-level drop request and delete the table.

Guard the remote statistics, prewarm, and drop routes against empty
names, `.` and `..`, then percent-encode all other names. Index creation
retains its existing name policy on both backends, including names such
as `Customer lookup` and `café_idx` and reuse through `exist_ok=True`.
The same remote guard applies on checked-out branches.

Enriched Enterprise listings retain these entries without issuing stats
requests. Native cleanup is covered by a regression test. API
documentation explains these limits, and website release guidance
remains a non-rendering draft.

Validation:

- Before the review fix, 12 of 15 focused regressions failed,
reproducing valid-name rejection, generated-name reuse failure, and
mixed legacy-list failure.
- 60 focused Rust tests passed, covering unsafe routes, encoded names,
mixed legacy/enriched listings, generated names, native and Enterprise
lifecycles, checked-out branches, and `exist_ok` preservation of index
identity, definition, and table version.
- Rebuilt the Python extension in the uv-managed environment from
`python/uv.lock`; all 28 targeted Python tests passed, including both
names and synchronous/asynchronous `exist_ok` reuse.
- Node native build, TypeScript type checking, lint/format checks, four
targeted index tests, and generated API documentation passed.
- Rust formatting, Clippy (`remote`, tests and examples), Python
formatting/lint, repository-wide Typos 1.26.0, and `git diff --check`
passed. Native builds used the repository `ci` profile with
`remote,lancedb/metrics-otel` enabled for Python and Node.
- Repository-root Ruff lint reports 59 existing errors in unchanged
`docs/web-tests`; Python-package lint passes.

<!-- lance-gatekeeper-fix:v1 agent=1ef05de7bc00306ccd6f8a60b9a81003
generation=1 -->

<!-- gatefixer-walkthrough:v1
head=6b25e10810ea1d11a4ef56be63c4ef50225f65d6 -->
## Change walkthrough

```mermaid
flowchart TD
    entry["Listed index"] --> typed{"Type available?"}
    typed -->|Yes| include["Include index"]
    typed -->|No| safe{"Addressable name?"}
    safe -->|No| omit["Omit entry"]
    safe -->|Yes| stats["Encode and fetch stats"]
    stats --> include
```

Creation preserves existing name support; remote routes reject only
empty names, `.` and `..`.

**Read:** [Route
guard](https://github.com/lancedb/lancedb/blob/6b25e10810ea1d11a4ef56be63c4ef50225f65d6/rust/lancedb/src/remote/table.rs#L102-L112)
→ [Listing
fallback](https://github.com/lancedb/lancedb/blob/6b25e10810ea1d11a4ef56be63c4ef50225f65d6/rust/lancedb/src/remote/table.rs#L2534-L2596)
→ [Index-preservation
regression](https://github.com/lancedb/lancedb/blob/6b25e10810ea1d11a4ef56be63c4ef50225f65d6/rust/lancedb/src/table/create_index.rs#L1431-L1481).

<sub>Snapshot:
[6b25e10](https://github.com/lancedb/lancedb/commit/6b25e10810ea1d11a4ef56be63c4ef50225f65d6)</sub>
<!-- gatefixer-walkthrough:end -->

---------

Co-authored-by: Gatefixer <313497061+lancedb-gatefixer[bot]@users.noreply.github.com>
2026-11-30 20:51:19 +08:00
Ayanna Bansal 14e49a6710 fix(node): infer a timestamp type for Date values (#5232)
`createTable` and `makeArrowTable` reject a JavaScript `Date` when no
schema is given:

```ts
await db.createTable("events", [{ id: 1, created: new Date() }]);
// Error: Failed to infer data type for field created at row 0. Consider providing an explicit schema.
```

Row validation already lets `Date` through as a supported value, and the
same rows work with an explicit `Timestamp` schema, but `inferType` has
no branch for it, so inference gives up.

This change:

- infers `Timestamp<MILLISECOND>` for a `Date`, which is also what
Apache Arrow's own `vectorFromArray` infers and matches the precision of
a JS `Date`. A list of dates is inferred as a list even when the column
name looks like a vector column;
- writes `Timestamp(ms)` columns, and lists of them at any depth, as
signed 64-bit values in `makeVector`. `apache-arrow@15.0.0` rounds the
high 32 bits of a negative timestamp toward zero, so `new Date(-1)` came
back as 4294967295. This already affected an explicit `Timestamp(ms)`
schema on Arrow 15; inference would have made it easier to hit. `Date`,
integer and bigint values take the new path; anything else (fractional
numbers, strings, list values that are not arrays or typed arrays) is
left to Arrow exactly as before;
- rejects an Invalid Date with a clear error. Arrow 15 stored it as
1970-01-01 and newer versions threw a BigInt conversion error;
- documents the new rule in the `makeArrowTable` docstring and the
generated API page.

Not changed (explicit schemas only, behaviour as before this PR):
timestamp units other than milliseconds, timestamps inside a
`List<Struct>`, `FixedSizeList` or `Map`, and `Date` query parameters in
`sql.ts`. On Arrow 15 these still go through Arrow's conversion. I can
follow up on them separately if wanted.

Tested:
- New tests in `__test__/arrow.test.ts`: the type is inferred; values
and nulls round-trip; a `Date` mixed with a string is still rejected;
dates before 1970 survive IPC as scalars, in lists, nested lists and
structs, with and without a schema; epoch numbers, bigints and typed
arrays keep working in explicit timestamp columns; Invalid Date is
rejected in every shape.
- `jest __test__/arrow.test.ts` passes with `apache-arrow` resolved to
15.0.0, 16.0.0, 17.0.0 and 21.2.0 (swapped the way the `arrow-compat` CI
job does). On 15.0.0 the pre-1970 tests fail without the workaround. CI
does not run Arrow 15, so on newer versions the Invalid Date test is
what fails if a shape stops reaching the new writer.
- `jest __test__/table.test.ts`, `biome ci .`, `tsc -b` and `pnpm run
docs` pass.
- Checked by hand that `createTable` then `add` with `Date` values
stores and returns them.

I ran the TypeScript tests against the published 0.42.0-beta.34 native
binary; I did not rebuild the Rust side, which this change does not
touch.
2026-11-30 20:38:59 +08:00
wangshun 04bf27af9d feat: support IN subqueries in Embedded search filters (#5223)
Fixes #5222

## Summary

Embedded vector and full-text searches rejected `IN (SELECT ...)`
because Lance's scanner parsed the filter as a single-table expression.
A team-scoped search with `limit(1)` needs to rank eligible documents
using keys from the sharing table.

Resolve unqualified lookup tables through the originating database and
use DataFusion to evaluate the predicate on the search snapshot. Pass
the matching row IDs to Lance before ranking. The syntax applies to
base-table prefilters within one namespace. Literal filters use the
existing scanner path.

## Tests

Tests: `/bin/sh -c 'cd nodejs && corepack pnpm test --runInBand
__test__/query.test.ts -t '"'"'prefilters by keys from another
table'"'"''`.
Result: cd nodejs && corepack pnpm test --runInBand
__test__/query.test.ts on the exact-HEAD published native binary before
adding tests: 41 passed.
Result: cd nodejs && corepack pnpm test --runInBand
__test__/query.test.ts -t 'prefilters by keys from another table' on the
exact-HEAD published native binary: 2 failed with the reported
unsupported SQL expression, exit 1 (OSSCOUT_BASE.log).
Result: cd nodejs && corepack pnpm lint: passed after correcting new
fixture key style.
Result: cargo fmt --all && git diff --check: passed.
Result: cd nodejs && corepack pnpm test --runInBand --runTestsByPath
__test__/expr.test.ts __test__/remote.test.ts on the exact-HEAD
published native binary: 179 passed across 2 suites.
Result: cd nodejs && corepack pnpm tsc && corepack pnpm run docs with
the exact-HEAD native declarations: passed, with no generated
documentation changes.
Result: cd nodejs && corepack pnpm build:debug --profile ci && corepack
pnpm tsc: passed from the patched source.
Result: cd nodejs && corepack pnpm test --runInBand
__test__/query.test.ts -t 'prefilters by keys from another table' on the
source-built patch: 2 passed, exit 0 (OSSCOUT_PATCHED.log).
Result: cd nodejs && corepack pnpm test --runInBand --runTestsByPath
__test__/query.test.ts __test__/expr.test.ts __test__/remote.test.ts on
the source-built patch: 225 passed across 3 suites, exit 0
(OSSCOUT_PATCHED.log).
Result: cd nodejs && corepack pnpm run docs on the source-built patch:
passed, with no generated documentation changes.
Regression coverage: `nodejs/__test__/query.test.ts`.
<!-- oss-scout-job:job-2628acdb-66f3-4d91-8a6e-d5d15e92bde7 -->

---------

Signed-off-by: wangshun <96341168+xixi-box@users.noreply.github.com>
2026-11-30 20:38:51 +08:00
Kevin Dong 2ff3bee923 feat(node): expose ZoneMap and BloomFilter index configs (#4962)
## Summary

Refs #4931 (TypeScript portion).

Expose the existing Rust ZoneMap and BloomFilter builders through
`Index.zoneMap()` and `Index.bloomFilter({ numberOfItems?, probability?
})` for Embedded and Enterprise tables. Export `BloomFilterOptions`,
reject values that cannot be converted losslessly from a positive
JavaScript safe integer to Rust `u64`, and retain the core builder's
probability validation and defaults.

Include API examples, generated documentation, and the ZoneMap
table-capability compatibility warning. Synchronize with main while
preserving its RTree/plugin factories and source-bearing Blob APIs. The
Python portion remains separate.

## Validation

- Built the new native binding on macOS 15.7.9 / arm64 with Rust 1.98.0,
Node 24.22.1, the repository `ci` profile, locked dependencies, and
Rust's bundled LLD scoped to the Node binding. Both lockfiles match
main.
- Four full affected Jest suites: **819 passed, 3 existing
experimental-feature cases skipped**. Coverage includes index
creation/listing, range and membership plans/results, option boundaries,
Enterprise HTTP request bodies, and the newly merged Blob descriptor
API.
- Passed TypeScript compilation, Biome check/format for all 85 Node
files, generated API documentation with warnings treated as errors, Rust
formatting, and `git diff --check`.
- Independent execution in a separate writable snapshot: 56
reviewer-designed boundary cases passed on each of Node 22 and 24; 815
adjacent repository tests passed, with 3 existing skips. TypeScript,
generated docs, Biome, and the compiled package entry point passed. The
final source tree, complete diff, and freshly built native artifact
hashes matched; no actionable findings remained.

The final documentation correction was checked against the pinned Lance
source. TypeScript compilation, Biome, generated API documentation, and
all 19 index option tests passed again. Two real Embedded table probes
confirmed that default ZoneMap creation on string and binary columns
leaves the v1 reader and writer capability bits unset; the string range
query used the scalar index and returned the expected rows. A fresh
independent snapshot also passed the string/binary lifecycle probes on
Node 22 and 24 (24 manifest observations), the 19 repository index
tests, and the documentation/type/lint checks.

Enterprise checks use mock HTTP endpoints. The native linker reports
C-library minimum-macOS-version warnings, so these runs do not establish
compatibility with older macOS versions.

## Merge Danger

**Door:** two-way

The SDK additions can be reverted. ZoneMap write seeds use v0 by
default. A commit that explicitly sets `lance.zone_write_seeds.version`
to `"1"` activates a persistent reader and writer capability; readers
and writers must support it before opting in. Dropping the index or
restoring an older version does not remove that capability from
subsequent snapshots.

**Blast Radius:** TypeScript

Adds index configuration factories and NAPI bindings; reuses existing
core index creation and Enterprise serialization.
2026-11-30 20:23:00 +08:00
Divyam TalwarandDivyam Talwar ea2d9a0440 fix(node): exclude padding from Transformers embedding pooling (#5282)
## Summary

Use Transformers.js mean pooling with the tokenizer's attention mask so
padding positions do not contribute to source and query embeddings.

## Validation

- A deterministic model and tokenizer fixture uses actual
Transformers.js Tensor objects and compares the same short text embedded
alone and in a padded batch. On main its vector changes from `[1, 5]` to
`[50.5, 102.5]`. With the fix it stays `[1, 5]` and the longer text's
expected vector remains `[4, 8]`.
- Existing Transformers and embedding Jest suites on Node 24: 20 passed,
1 skipped (OpenAI key required). TypeScript build and Biome checks
passed.
- Used Transformers.js 4.3.2 with the ONNX Web tensor runtime for
fixture-only tests. Model downloads and inference were disabled.

Fixes https://github.com/lancedb/lancedb/issues/5281

---------

Co-authored-by: Divyam Talwar <DivyamTalwar@users.noreply.github.com>
2026-11-30 20:13:20 +08:00
4abb2b282c fix(node): retain deferred query promise failures until execution (#5280)
## Summary

Observe Promise-backed query preparation when the builder stores it,
including promises produced by fluent modifiers. Terminal operations
still await the original promise and receive its original rejection.

## Validation

- Both delayed-execution regressions fail on main. The new tests
exercise a plain Promise-backed builder and a builder with chained
filters, and check rejection identity.
- Native Jest query suite: 43 passed. TypeScript compilation with
`--noEmit` and Biome checks passed.
- Ran real embedded direct-Promise and forced string-vector queries with
Node's strict unhandled rejection mode. Both baseline processes exit
before execution. With the fix each process survives the delay, receives
the expected error when awaited, and successfully executes a control
query.

Fixes https://github.com/lancedb/lancedb/issues/5279

---------

Co-authored-by: Divyam Talwar <DivyamTalwar@users.noreply.github.com>
Co-authored-by: Divyam Talwar <152021174+DivyamTalwar@users.noreply.github.com>
2026-11-30 20:13:11 +08:00
Zain QureshiandClaude Opus 5.5 058d5c3f4c fix(nodejs): reject fractional branch versions (#5167)
Refs #4848

## Problem

With the table at version 2, `branches.create("exp", undefined, 1.5)`
silently forked from version 1 and left the new branch missing the
second row. With `exp` at version 3, both `branches.checkout("exp",
2.5)` and `openTable("my_table", undefined, { branch: "exp", version:
2.5 })` returned version 2 and its two rows. N-API coerced these
arguments to `i64` before Rust could validate them
(`nodejs/src/table.rs:2698` and `nodejs/src/table.rs:2743`).

## Change

`Branches.create` and `Branches.checkout` now use the existing
TypeScript integer validator before calling N-API
(`nodejs/lancedb/table.ts:2759` and `nodejs/lancedb/table.ts:2773`).
Creation rejects with `fromVersion must be a non-negative integer` and
creates no branch. Both reads reject with `version must be a
non-negative integer` because opening a named branch delegates to the
same checkout method (`nodejs/lancedb/connection.ts:830`).

Tag-based creation rejects a simultaneous source version through the
native source conflict check (`nodejs/src/table.rs:2701`). With no
branch or with `branch: "main"`, `openTable` uses `Table.checkout`
(`nodejs/lancedb/connection.ts:832`). That separate numeric checkout
path and tag version validation are covered by #4916.

## Tests

Ran from `nodejs` on macOS arm64 using the published beta.26 native
binding built from the base revision. The two regressions failed on the
base. The patched branch run passed 34 tests, and the Node suite passed
1,885 tests with 27 skipped. Live Enterprise and S3 integrations were
outside this run.

```sh
env -u OPENAI_API_KEY -u LANCEDB_API_KEY -u S3_TEST ./node_modules/.bin/jest --runInBand --runTestsByPath __test__/table.test.ts --testNamePattern='branch' --no-verbose
env -u OPENAI_API_KEY -u LANCEDB_API_KEY -u S3_TEST ./node_modules/.bin/jest --runInBand --no-verbose
./node_modules/.bin/tsc -b
./node_modules/.bin/tsc --noEmit -p __test__/tsconfig.json
./node_modules/.bin/biome ci .
```

The package's TypeDoc and postprocessing commands also passed, and the
generated JavaScript API reference matched the checked-in files.

Prepared with AI assistance (Codex and Claude Code) and reviewed with
GitHub Copilot.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-30 20:07:05 +08:00
lancedb-gatefixer[bot] 2d4e0fb3f2 fix: preserve branch scope during Embedded tag time travel (#4852)
Embedded tag checkout replaced the handle's only branch identity. After
reading a tag on another branch, `checkout_latest()` followed that
branch and subsequent writes or restores could commit there.

Keep the handle's original branch and Lance `BranchIdentifier`
separately from its visible snapshot. A branch name alone cannot
distinguish the original branch from a replacement after deletion and
reuse. Cross-branch tags remain readable, and Python pickle and snapshot
copies preserve both identities. `checkout_latest()` reattaches to the
original branch, so later appends stay there. `current_branch()`
continues to report the visible snapshot's branch.

Validate the retained identity before `checkout_latest()` changes the
handle or `restore(tag)` commits; a reused branch name is rejected
without changing either branch tip. Independent and query snapshot
copies retain this identity too. Reject an ambiguous cross-branch
restore before committing. To restore on the tag's branch, first open a
handle there with `branches.checkout(...)` or Rust's
`checkout_branch(...)`. Update Rust, Python sync/async, TypeScript,
generated API documentation, and the tag-based versioning guide for this
behavior.

Python pickle state also carries the original `BranchIdentifier` through
reopening. A foreign snapshot stays readable if the originating branch
is replaced while serialized, but latest checkout and restore reject the
replacement. Latest and same-branch pinned handles validate the saved
identity before reopening returns. Older pickle states without the
identifier keep their existing reopen behavior; they cannot validate an
identity that was never saved.

Validation:

- All 12 new branch-name reuse regression cases failed before the
identity fix and pass afterward. They cover latest checkout and restore,
direct handles and snapshot copies, all three consistency modes, and
unchanged versions and contents on both branch tips. Query snapshot
identity retention is also covered.
- All 8 new Python pickle regression cases failed before the
serialization fix and pass afterward. They replace the branch while the
handle is serialized, cover latest checkout and restore across three
consistency modes, verify unchanged tips, and reject replacement data
when reopening latest or same-branch pinned handles.
- 494 Rust table tests and 23 dataset consistency tests passed with
`--features remote --profile ci`; Clippy for the core and Python
bindings, Rust formatting, and `git diff --check` passed.
- 62 targeted Python tag, branch, pickle, and restore tests passed in
the uv-managed environment after rebuilding the extension. An additional
compatibility check verified that older pickle states without the
identifier still reopen and return to the original branch.
- Earlier SDK validation: 9 targeted Node tests passed, including the
cross-branch regression. Node native build, TypeScript compilation,
lint/format checks, and API documentation generation passed. TypeScript
sources are unchanged in this Python pickle follow-up.
- Python package Ruff lint/format checks passed; repository-wide Ruff
reported 59 pre-existing findings in untouched `docs/web-tests/` files.
Vale 3.24.0 found no prose issues on the changed guide lines.

Fixes #4842

<!-- lance-gatekeeper-fix:v1 agent=c1c6448a3f02ec6db445df5e3d8dd77f
generation=1 -->


<!-- gatefixer-walkthrough:v1
head=078eceadbedc15cf179d9d4dcce249c83e7010f9 -->
## Change walkthrough

```mermaid
flowchart LR
    A["Save original identity"] --> B["Reopen visible snapshot"]
    B --> C{"Foreign snapshot?"}
    C -->|No| D["Validate before return"]
    C -->|Yes| E["Retain saved identity"]
    E --> F["Validate latest or restore"]
```

**Read:** [Serialize and
reopen](https://github.com/lancedb/lancedb/blob/078eceadbedc15cf179d9d4dcce249c83e7010f9/python/python/lancedb/table.py#L4541-L4594)
→ [Reinstate identity
safely](https://github.com/lancedb/lancedb/blob/078eceadbedc15cf179d9d4dcce249c83e7010f9/rust/lancedb/src/table/dataset.rs#L278-L307)
→ [Serialized-handle
regressions](https://github.com/lancedb/lancedb/blob/078eceadbedc15cf179d9d4dcce249c83e7010f9/python/python/tests/test_table.py#L1300-L1360).

<sub>Snapshot:
[078ecea](https://github.com/lancedb/lancedb/commit/078eceadbedc15cf179d9d4dcce249c83e7010f9)</sub>
<!-- gatefixer-walkthrough:end -->

---------

Co-authored-by: Gatefixer <313497061+lancedb-gatefixer[bot]@users.noreply.github.com>
2026-11-30 20:05:58 +08:00
Tomwang.eth 855bec2a57 fix(node): make tags.list() values plain serializable objects (#4915)
Related: #4849 (same defect class on `branches.list()`, fixed in #4914).

**Problem**
`Tags.list()` returns napi class instances whose fields live on the
prototype, so `console.log`, spread and `JSON.stringify` show `{}` — the
documented example (`{ "v1": { version: 1, manifestSize: ... } }`)
doesn't match what users actually see. Property access
(`tags["v1"].version`) works, which is why the existing tests didn't
catch it.

**Change**
- `TagContents` stays a runtime napi class export: existing ESM named
imports of `TagContents` and `instanceof` checks keep working, and
existing TypeScript values remain assignable to it.
- `nodejs/lancedb/table.ts` post-processes `Tags.prototype.list()`
results, promoting `version` and `manifestSize` to own enumerable
properties on each returned instance by reusing the class getters and
setters. Values are now enumerable, spreadable and JSON-serializable
with no fields added, removed or renamed.
- TS-only: the Python SDK already returns proper dicts with both fields.

**Tests**
- New regression test in `nodejs/__test__/table.test.ts` covers the
named import and `instanceof` alongside own-enumerable keys, spread and
a JSON round-trip through `tags.list()`.
- The tag tests from #5145 are kept and pass against this change.
- Verified locally on Linux x86_64: `tsc -b`, Biome checks, and the
focused tags suite (4 passed), including `tags.create(name)` /
`tags.create(name, null)` behavior.
2026-11-30 19:14:23 +08:00
Alex Castillo González fc13fd6e98 fix(nodejs): batch OpenAI embedding requests to 2048 inputs (#4833)
`OpenAIEmbeddingFunction.computeSourceEmbeddings` in the Node SDK sent
every row in a single `embeddings.create` call. `makeArrowTable` passes
the whole source column at once, and the OpenAI embeddings endpoint
accepts at most 2048 inputs per request, so `table.add` (or
`createTable`) with more than 2048 rows and an `openai` embedding
function fails with a 400.

This splits the input into chunks of at most 2048 and concatenates the
results in order. Inputs of 2048 rows or fewer still make one request,
as before.

Test: `nodejs/__test__/embedding_openai.test.ts` mocks `openai`
(rejecting requests with more than 2048 inputs) and checks that 5000
rows produce 5000 embeddings, in order, over three calls (2048, 2048,
904). It fails without the change and passes with it.

This change was prepared with AI assistance (Claude Code).
2026-11-30 19:14:00 +08:00
Xuanwo 7a2182c95b docs(nodejs): clarify macOS prebuilt binaries are Apple silicon only (#5244)
The Node.js README lists Intel Macs among the platforms that receive a
native binary from npm. The macOS package is published for Apple silicon
(`arm64`) only. Intel Mac users can follow the [source-build
instructions](https://github.com/lancedb/lancedb/blob/main/nodejs/CONTRIBUTING.md#development).

Refs #3149 and #4765.
2026-11-30 18:04:49 +08:00
Muhammad Abdullah ButtandXuanwo 8a00ca58ea fix(nodejs): send Lance time units when altering timestamp or duration columns (#5196)
`alterColumns` serializes an Arrow `dataType` with `dataTypeToJson`. For
`Timestamp` and
`Duration` it wrote apache-arrow's numeric `TimeUnit` value into the
type string, so a cast to
`new TimestampMicrosecond()` was sent as `timestamp:2:-` and
`Duration(MICROSECOND)` as
`duration:2`. Lance only parses the units `s`, `ms`, `us` and `ns`, so
every such alteration
failed with `Invalid data type: {"type":"timestamp:2:-"}`.

This maps `TimeUnit` to Lance's unit strings for both types.

Tests:
- arrow.test.ts: checks `dataTypeToJson` output for all four units of
both types, with and
without a timezone. It fails on main (`timestamp:0:-`) and passes with
the fix.
- table.test.ts: "can cast to various types" now also alters
timestamp[ms] and duration[ms]
  columns to microseconds and checks the schema.

I couldn't build the native module locally, so the arrow.test.ts run
used the released 0.37.1 binary, and the table.test.ts steps were
checked as a standalone script against that package rather than under
jest.

I made this change with help from Claude Code, and I reviewed the diff
and the test results myself.


---------

Co-authored-by: Xuanwo <github@xuanwo.io>
2026-11-30 16:49:51 +08:00
Xuanwo e185dc8646 perf: raise the default Blob V2 direct-read threshold to 32 MiB (#5248)
Enterprise SDKs use an inclusive 32 MiB default for eligible Blob V2
direct reads. The paired field comparison with the 10 MiB SDK default
measured higher direct-read latency at 10 and 16 MiB. At 32 MiB, the
interval for the latency difference spanned zero. [SDK version used in
the field comparison](https://github.com/lancedb/lancedb/pull/5247)

The earlier mixed-load test measured lower Plan Executor cache pressure
with direct reads enabled at the 10 MiB cutoff. That result covers the
tested size mix. With the 32 MiB cutoff, reads from 10 MiB up to (but
excluding) 32 MiB go through the proxy, so the impact on executor
traffic and cache pressure depends on the workload's size distribution.

The existing internal override still takes precedence. Direct reads keep
the 16 MiB part size. The Node binding test verifies proxy routing one
byte below the default and two contiguous object-store ranges with a
matching SHA-256 at exactly 32 MiB.
2026-11-28 03:21:37 +08:00
Xuanwo 129028f300 perf: improve presigned Blob V2 reads (#5247)
## Behavior

Presigned Blob V2 reads retry an idempotent ranged GET once after a
recognized disconnect or timeout before the complete response headers
arrive. This includes an abrupt TLS EOF while receiving the headers. A
retry preserves the physical Range and the still-valid URL. Expiry
triggers resolution on the pinned snapshot. Once the complete headers
arrive, the existing status and body paths handle the response.
Enterprise connections default to a 300-second pool idle timeout and
presigned object-store connections default to 30 seconds. The existing
override applies to both pools.

Loopback TCP tests exercise FIN and RST on a reused connection, both
with zero response bytes and after a partial header. They verify the
send count with retries enabled and disabled, the exact replayed Range
and the payload digest. A truncated body after complete headers returns
an error after one send.

Direct reads over 16 MiB stream bounded physical ranges into their
corresponding slices of the final buffer. The per-read fan-out uses
Lance's `LANCE_IO_THREADS`, capped by the connection's existing
`LANCE_CLIENT_BLOB_REQUEST_CONCURRENCY` limit (8 by default). Each
request retains its permit through body consumption. The 10 MiB routing
threshold continues to apply to the full logical read.

The connection can reuse unexpired presigned locations for verified rows
under the same table, column, snapshot and request credentials. Range
offsets and sizes come from the resolver. The existing batch request
covers the requested rows of a shared Packed or Managed sidecar.
Reopening a verified row uses its prior resolution, and the first open
of each unseen SQL descriptor still authorizes just that row. The public
API and REST response format are unchanged.
2026-11-28 02:29:31 +08:00
Lance Release fdc8041b2a Bump version: 0.42.0-beta.37 → 0.42.0-beta.38 2026-11-27 09:41:44 +00:00
Bilal Atique 09beba532e feat(node): accept Expr values in select() (#4878)
Closes #3042.

Node `select()` now takes `Expr` values, the same expression builder
that `where()` already accepts. A `Map` or a plain object can mix `Expr`
values and SQL strings:

```ts
import { col } from "@lancedb/lancedb";

const rows = await table
  .query()
  .select({
    id: "id",
    name: col("firstName"),
    total: col("unitPrice").mul(col("quantity")),
  })
  .toArray();
```

This works on every query with `select()`: `query()`, `vectorSearch()`,
`search()` and the take queries. The parameter type is now `Map<string,
string | Expr>` and `Record<string, string | Expr>`. Nothing else in the
TypeScript API changes.

### How it works

`select()` turns each `Expr` into SQL with `toSql()` and passes the
pairs to the native `select` that SQL strings already use. `where()`
handles an `Expr` the same way, so Node treats expressions alike in both
places. `toSql()` quotes camelCase names and SQL keywords with
backticks, so `col("firstName")` reads `firstName`.

I also looked at passing the expressions to Rust as `Select::Expr`, as
Python's `select_expr` does. I didn't go that way:

- Before a local or remote query runs, Rust turns `Select::Expr` back
into SQL with the same `expr_to_sql_string`. The query is the same
either way.
- A map that mixes SQL strings and expressions can't become a
`Select::Expr` without parsing the strings. Python's `AsyncQuery.select`
sends a mixed dict through `select_expr` and wraps each string with
`lit()` (`_coerce`), so `select({"id": "id", "doubled": col("score") *
lit(2)})` returns the string `'id'` in the `id` column. Sending SQL
keeps every string a SQL expression.
- I found one path that accepts `Select::Expr` and rejects
`Select::Dynamic`: namespace `QueryTable` pushdown. Node can't turn
pushdown on today, so nothing changes yet. If Node gets that option,
`select()` can send `Select::Expr` when every value is an `Expr`.

`blobMode: "bytes"` (#4353) finds blob columns by name in the `[output,
source]` list of the selection. For a camelCase column, `toSql()` gives
`` `imageData` ``, which doesn't match `imageData`. So when an `Expr` is
a bare column reference, the match uses its plain name. For this, the
native `Expr` gets a small `columnName()` helper, like `column_name()`
in the Python bindings, which Python uses for the same match. A blob
renamed with `col()` gets its bytes, as with a SQL string. Other
expressions are not filled with bytes, as before.

A value that is neither a string nor an `Expr` now throws a `TypeError`
that names the key, instead of the native conversion error.

### Tests

New tests in `expr.test.ts`:

- a `Map` that mixes SQL strings with `col("firstName")` and
`col("unitPrice").mul(2)` on a plain query, with the column order
- a `Record` with `upper()`, `func("lower", ...)` and a SQL string,
filtered with an `Expr` in `where()`
- `Expr` values on a vector query, an automatic `search()` (full-text
search) and a take query
- `blobMode: "bytes"` with a camelCase blob column selected with
`col()`: renamed, next to a computed `Expr` column, and in a take query
- a number as a value throws a `TypeError`

The whole Node suite passes. The Node docs under `docs/src/js` are
regenerated. The `@example` in the middle of the `select()` docstring
used to swallow the two paragraphs after it into the code block, so I
moved the example to the end, which is why each query class page
changes.

Left out: `Expr` items in the plain column list (`select([col("a")])`),
because an expression needs an output name. The `select` of a
materialized view still takes SQL strings only.
2026-11-27 17:10:43 +08:00
Lance Release e38d8bef56 Bump version: 0.42.0-beta.36 → 0.42.0-beta.37 2026-11-27 03:36:01 +00:00
LanceDB RobotandXuanwo 344a4d1444 chore: update lance dependency to v16.0.0-beta.4 (#5242)
Update the Rust and Java Lance dependencies to
[v16.0.0-beta.4](https://github.com/lance-format/lance/releases/tag/v16.0.0-beta.4)
and pin Python tests to pylance 16.0.0b4. Make the Node.js Rust blob
parser helper private so strict workspace Clippy passes.

---------

Co-authored-by: Xuanwo <github@xuanwo.io>
2026-11-27 11:34:27 +08:00
Xuanwo 1c0118015c 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.
2026-11-27 00:16:29 +08:00
Lance Release 85dcf3a3c5 Bump version: 0.42.0-beta.35 → 0.42.0-beta.36 2026-11-26 15:06:40 +00:00
Lance Release 0adfd22db1 Bump version: 0.42.0-beta.34 → 0.42.0-beta.35 2026-11-26 10:50:09 +00:00
Lance Release 9adb403656 Bump version: 0.42.0-beta.33 → 0.42.0-beta.34 2026-11-26 03:33:13 +00:00
Lance Release 7c3d68e951 Bump version: 0.42.0-beta.32 → 0.42.0-beta.33 2026-11-25 23:49:08 +00:00
Lance Release 7e1478b547 Bump version: 0.42.0-beta.31 → 0.42.0-beta.32 2026-11-25 21:41:10 +00:00
Lance Release 8441dab874 Bump version: 0.42.0-beta.30 → 0.42.0-beta.31 2026-11-25 21:32:03 +00:00
Xuanwo 4d9fd358f8 feat(nodejs): expose Function failure recovery APIs (#5209)
TypeScript callers can now inspect and recover Function row failures
through the native workflow. `functionErrors()` groups returned failures
and can show retained attempt history. `functionErrorRows()` looks up
current failed inputs using row IDs and physical row addresses
represented as `bigint`. Older deployments can continue to use the
existing error listing.

`retryFailed()` selects the exact failed rows on the server, with
optional error type and job filters. `upgradeColumn()` binds an existing
immutable Function version and can recompute failed rows, all eligible
rows, or no rows. Callers can quarantine and release failures,
explicitly include quarantined rows in a retry, and use
`functionProvenance()` to see which Function version produced a recorded
value.

The native operations reuse the existing Rust workflow v1 capability
checks. The Function failures guide includes TypeScript examples for
inspecting, retrying, upgrading, and quarantining failures.
2026-11-25 23:14:04 +08:00
Lance Release a709c6db1e Bump version: 0.42.0-beta.29 → 0.42.0-beta.30 2026-11-25 03:11:25 +00:00
Sarwar BhuiyanandClaude Opus 5.5 5f87e18541 feat: create any registered Lance scalar index plugin by name (#5004)
Closes #4933

Adds a generic configuration for creating a scalar index of any type
recognized by a registered database plugin, using its type name and
optional JSON parameters. Index types without a dedicated SDK
configuration can use the same API.

- **Rust:** `Index::Plugin(PluginIndexBuilder)`, with JSON-object
parameters through `.params(...)` or `.params_json(...)`.
- **Python:** `ScalarPlugin(index_type, params=None)`, accepting a dict
or JSON-object string.
- **TypeScript:** `Index.plugin(indexType, params?)`, accepting an
object or JSON-object string.
- Type names are case-insensitive and surrounding whitespace is ignored.
Empty names and non-object parameters are rejected.
- Native index introspection preserves existing built-in types and
exposes other registered plugin types through `Custom`.

The guide and SDK references describe index creation, parameter
ownership, and errors consistently. They recommend a dedicated
configuration when one exists and refer readers to the plugin’s
documentation for parameter names and defaults. The TypeScript reference
is regenerated from its source JSDoc.

## Remote request format

Generic requests use `index_type: "PLUGIN"` and a separate upper-cased
`plugin_type`. Arbitrary parameters stay nested under `params`,
preserving omitted parameters versus an explicit empty object. This
separates the generic path from built-in handling and prevents
parameters from overwriting request fields.

## Validation

- 52 targeted tests passed: 15 Rust, 22 Python, and 15 TypeScript.
- Two Rust plugin doctests passed.
- Rust Clippy, the Node build and lint, changed-file Python lint,
TypeDoc generation, Vale, and the MkDocs SDK-reference build passed.
- Request tests cover Python sync/async calls, object and JSON-string
inputs, normalization, omitted and empty parameters, and collisions with
request metadata.
- Repository-wide Ruff reports existing findings in untouched
documentation examples. Strict Mintlify validation reports four missing
snippet-export warnings, also reproduced on the unmodified commit.

## Follow-ups

- Replace the built-in examples with a widely available custom plugin
when one is available, as discussed in review.
- Remote `list_indices()` and `index_stats()` still parse a fixed set of
type names; accepting unrecognized plugin types through a `Custom`
fallback remains separate.

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-24 07:00:47 -08:00
Lance Release 03b861f9a0 Bump version: 0.42.0-beta.28 → 0.42.0-beta.29 2026-11-24 11:46:34 +00:00
Lance Release abe829f4a3 Bump version: 0.42.0-beta.27 → 0.42.0-beta.28 2026-11-24 09:20:21 +00:00