mirror of
https://github.com/lancedb/lancedb.git
synced 2026-12-03 15:55:19 +00:00
614f8c32011448bafbc495bcba532d9814c0a5ef
3903
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
614f8c3201 |
feat: add Scannable-based merge insert with spill support and retry-safe execution (#5360)
Addresses part 1 of #4505 Refactor merge-insert to accept Scannable sources while preserving RecordBatchReader compatibility, introduce ScannableProvider and retry-aware source execution, and add configurable 64 MiB source collection thresholds with spill-based routing for large non-rescannable inputs. Preserve row-count statistics using inexact prefix estimates, apply JSON/blob casting per scan, and propagate threshold configuration through connections and tables. Add regression tests covering source routing, spill replay, retry behavior, statistics, configuration, and JSON/blob casting while preserving existing LSM/MemWAL and FirstSeen behavior. --------- Co-authored-by: Xuanwo <github@xuanwo.io> |
||
|
|
74503e13f6 |
fix(python): skip null texts when reranking with a cross encoder (#5365)
## Summary A vector, full-text or hybrid search can return a row whose reranking text is null. `CrossEncoderReranker` built a `[query, None]` pair for that row and passed it to `CrossEncoder.predict`. The Hugging Face tokenizer only accepts strings (a `[query, None]` pair raises `TypeError: TextInputSequence must be str`), so one row with missing text made the whole rerank call fail. Filter rows with null text out of the Arrow table before building the pairs, so each score lines up with the right row. When every candidate has null text, return an empty scored table without calling the model. The class docstring now says that rows with a null `column` value are left out of the reranked results. This is the same behaviour as #5283 (Cohere) and #5296 (Jina), applied to the cross-encoder reranker. #5336 and #5337 do the same for VoyageAI and watsonx.ai. ## Verification - Added `test_cross_encoder_reranker_nullable_documents`, run through a real local table and `table.search(...).rerank(...)` with a mocked model, with two cases: - a null between two valid documents: only the two valid pairs reach `predict`, and the result keeps the correct row IDs in score order, the `_distance` column and a `float32` `_relevance_score`; - all-null input, where `predict` is never called and an empty typed result comes back. - Both cases fail on `main` (the model receives `['Which document is last?', None]`) and pass with this change. - Checked the tokenizer behaviour directly with the `tokenizers` library: encoding a `(query, None)` pair raises the `TypeError` above. - Ran against LanceDB 0.42.1 and CPU PyTorch 2.15, with the changed reranker module copied over the installed one. The installed `cross_encoder.py` is identical to `main`. I did not download a real cross-encoder model. - Repository Ruff lint and format checks pass. Co-authored-by: Xuanwo <github@xuanwo.io> |
||
|
|
50de29bdd5 |
docs(python): show multiple embedding functions with Pydantic (#5371)
Closes #1911 ## Why The Managing Embeddings guide described multiple embedding columns at a high level. Python readers needed a complete Pydantic example showing how to pair the fields, populate both vectors, and choose which vector column to search. ## What changed - Explain the one-to-one pairing in `LanceModel`. Use the same embedding-function instance for one `SourceField()` and one `VectorField()`, and create a separate instance for each pair even when the provider and settings match. If several fields should contribute to one vector, combine their values into a single source field before ingestion. - Add a runnable LanceDB Embedded example that pairs `title` with `title_vector` and `description` with `description_vector`. Both pairs use separate instances of `all-MiniLM-L6-v2`. Inserting rows with titles and descriptions populates both vector columns, and reopening the table preserves both mappings. - Show how `vector_column_name` selects the vector column and embedding function for a text query. Searching titles for “Alpine hiking” returns “Hiking in the Alps”, while searching descriptions for “feeding sourdough starter” returns “Baking sourdough”. - Generate the published snippet from the example test. This is a documentation and example-test change. ## Validation - The new docs test and existing multiple-embedding regression test passed. The docs test mocks only model inference and checks both persisted field mappings, the stored vectors and their dimensions, both search results, and the ambiguity error when `vector_column_name` is omitted. - The generated example also passed with the cached real model. Both columns contained 384-dimensional embeddings and both searches returned the expected articles. - Ruff lint and `git diff --check` passed. The formatter reports two existing differences in unrelated examples in the same test file. |
||
|
|
ff7a1c2c25 |
fix(ci): retry incomplete PyPI metadata after CLI uploads (#5370)
The [0.42.1 CLI publish run](https://github.com/lancedb/lancedb/actions/runs/46743361906/job/143030097235) uploaded all four distributions, then failed verification because the first PyPI metadata response listed only some of the files. The workflow fetched that response once and stopped at the first missing filename. This change gives PyPI time to list every expected file while still rejecting a published checksum mismatch immediately. This was accomplished with the following changes: - Fetch release metadata up to eight times, with a 15-second request timeout and 15 seconds between attempts. Report any filenames still missing when retries run out. - Compare every listed distribution against its local SHA-256 on each attempt, even when a different wheel or the source archive is missing. ### Testing Five regression tests passed, covering complete metadata, delayed files, persistent omissions, a mismatched digest in a partial listing, and a transient request error. The existing stable publishing checks also passed. |
||
|
|
c322048150 |
fix(deps): replace yanked pin-project-lite release (#5364)
The Rust dependency check fails because the workspace lockfile pins `pin-project-lite` to `0.2.17`, which crates.io yanked. Use `0.2.19`, the next non-yanked patch release. After refreshing the crates.io index, `cargo-deny --locked check advisories bans licenses sources` (v0.20.2, matching CI) reports `error[yanked]` on base commit `787ad381b`. All four checks pass with the updated lockfile. |
||
|
|
08a286edb3 |
feat: add resumable staged table writes (#5358)
A coordinator can publish batches staged by multiple ingest workers in a single table version. This adds staged append and overwrite in LanceDB Embedded and Enterprise across Rust, synchronous and asynchronous Python, and TypeScript. Ordinary `table.add()` continues to commit immediately. A coordinator selects the mode with `begin_write(mode)` (`beginWrite` in TypeScript) and shares the opaque write ID. Workers open the same writable table and branch and resume with `open_write(id)` (`openWrite` in TypeScript). They can retry the same input with the same idempotency key. Staging returns no version. Explicit `commit()` publishes one version and returns `AddResult`. Explicit `abort()` discards the staged write and can be repeated. Dropping a handle performs no I/O. Enterprise uses the existing multipart endpoints on servers with multipart write support. A non-empty staged overwrite input carrying top-level Arrow schema metadata fails before the SDK sends any part insert. The SDK enforces this in Rust `StagedWrite::add(...).execute()`, Python `StagedWrite.add` and `AsyncStagedWrite.add`, and TypeScript `StagedWrite.add` on every supported Enterprise server version. Empty input is a no-op. Staged append and overwrite with an empty top-level map are supported, including field and nested field metadata on overwrite. [OSS-2859](https://linear.app/lancedb/issue/OSS-2859) · [Distributed reads in OSS-441](https://linear.app/lancedb/issue/OSS-441) The separate Sophon fix preserves top-level schema metadata in the server’s multipart overwrite path. The SDK follow-up verifies a route that sends every part, retry, and completion to fixed instances before lifting the guard. [ENT-4970](https://linear.app/lancedb/issue/ENT-4970/multipart-overwrite-drops-top-level-schema-metadata-in-sophon) · [Sophon #11472](https://github.com/lancedb/sophon/pull/11472) · [OSS-3312](https://linear.app/lancedb/issue/OSS-3312/enable-schema-metadata-in-enterprise-staged-overwrite-after-verifying) Embedded staged overwrites keep top-level, field, and nested-field metadata from the replacement schema. Commit rejects overwrite parts whose restored schemas differ. The Insert data guide shows staged writes in Python, TypeScript, and Rust. The Distributed Write guide describes both SDK-coordinated staging and server-coordinated CTAS. ## Validation Final head `cf6737cece7b17f33a13556ba13f1460a0d4cfc8` adds the guard in `a02beb97084cb9d5d70b0bfdbbf31ce7bb4b1067` and a documentation-only commit. - **Rust.** All 14 `--lib staged_write` tests and all 15 `--lib multipart_write` tests passed with the locked `ci` profile and Enterprise support. `explicit_enterprise_overwrite_rejects_schema_metadata_before_upload` covers rejection before insert, known and streaming empty inputs, and a subsequent field-metadata part in the same session. - **Python and Sophon 1.16.0.** The Python extension was rebuilt with the final Rust inputs. The staged-write and permutation suites passed 133 tests with 2 skipped. On the isolated released-service fixture, sync and async staged overwrite rejected top-level metadata with zero insert requests. A materialized zero-row table and a streaming zero-row batch both succeeded without an insert. A fresh read verified the original version, row, and schema. Two independent workers then staged parts with field and nested field metadata, and an independent coordinator published one version with exactly the replacement rows. The reopened SDK table and Lance manifest preserved that metadata. Ordinary overwrite and staged append also succeeded. - **TypeScript and docs.** TypeScript compilation, lint, TypeDoc, strict MkDocs, and Vale passed. The final TypeScript changes are documentation. The earlier Node native build and staged-write test below cover the binding. The Rust tests and rebuilt Python extension exercised the final shared guard. At `ab9f49fba5055a5f731fe013a820515aa5cfa12c`, all 11 Rust staged-write integration tests and 13 staged-write unit tests passed. The new tests exercise independent reopen, reject differences at each metadata level, and verify one publication with the complete schema after replacing the mismatched part. Rust formatting and Vale passed for the follow-up. On the initial validation head `68e950d24a1418890f80eb04102de49388012318`: - Rust passed the library check with Enterprise support and 15 existing multipart tests. - Python passed both staged-write tests covering synchronous multiprocessing and asynchronous overwrite and abort. The separate fail-loud fragment constraint regression passed all 39 cases. [#5120](https://github.com/lancedb/lancedb/pull/5120) - Node.js passed the native build, TypeScript compilation, lint, and the staged-write Jest test. TypeDoc generation and strict MkDocs also passed. The initial Python and Node.js native extensions were built at `47ea43533f103744e84a7cdbe83d8e4a8ddf093e` with the repository’s `ci` profile, the default SDK features, and locked Lance 16.0.0-beta.7 and `object_store` 0.14.2. The initial validation head differs from that build commit only in two generated TypeDoc pages. The Python and Node.js tests ran again at that head using the same native artifacts. The candidate Python SDK passed multipart create, cross-process staging, commit, and abort against released LanceDB Enterprise (Sophon) 1.16.0 on an isolated loopback gateway and S3-compatible store. After an ordinary append published version 2, a separate coordinator committed the staged batches once to version 3, with exactly the three expected rows. The probe also verified overwrite conflict handling, schema refresh after a successful overwrite, and branch and pinned-handle behavior. Both abort modes removed the upload marker and staged transaction records, rejected subsequent staging and commit, and left the table at version 3 with the same rows. Append abort removed its staged payload. Overwrite abort left one unreferenced data file in object storage for storage cleanup. A separate Sophon 1.16.0 probe confirmed that multipart overwrite loses top-level schema metadata, including `embedding_functions` and `lancedb::column_definitions`. Field and nested-field metadata survived, and a single-request overwrite preserved the full metadata on the same input. ## Local security comparison Compared head `ab9f49fba5055a5f731fe013a820515aa5cfa12c` with its merge base `c85647526c90647d9b5d6a701afeacca3f47b34d`. - **Dependencies.** OSV-Scanner 2.7.1 used one offline crates.io advisory snapshot for both Cargo locks. Each scan read 1,098 package entries and reported the same 48 advisory matches across 24 package versions. The change makes the already-locked `prost` 0.14.4 a direct dependency for Embedded, where Lance already pulls it in. OSV and the GitHub Advisory Database returned no advisory for that version. The Cargo, Python, and Node lockfiles are byte-identical. The latter two therefore did not require a dependency audit. - **Source.** Semgrep Community Edition 1.187.0 ran 658 security and secret rules on 16 baseline files and 24 candidate files across Rust, Python, and TypeScript. Both results contained the same 31 matches on unchanged code, with zero skipped targets or parse errors. These were existing Rust `unsafe` blocks in tests and N-API branch metadata, a Python serialization check, and a TypeScript iterator call through `Symbol.asyncIterator`. [Rule snapshot](https://github.com/semgrep/semgrep-rules/tree/a5ad1714f00c9f7fde980cab0ea1d6dc6d414fd2) The OSV results cover lockfile package versions in the local database. Semgrep covers the changed source files with file-local analysis. Rule-level Aikido results were unavailable for comparison. |
||
|
|
2a88c3ad35 |
fix(python): preserve Arrow payloads in linear reranking (#5368)
## Summary
Keep payload columns in Arrow during
`LinearCombinationReranker.merge_results()`
(`python/python/lancedb/rerankers/linear_combination.py`) instead of
round-tripping entire rows through `.to_pylist()` and
`pa.Table.from_pylist()`.
### Root Cause
- `LinearCombinationReranker.merge_results()` converted all columns of
`vector_results` and `fts_results` to Python dictionaries via
`.to_pylist()` and reconstructed the output table with
`pa.Table.from_pylist()`.
- Round-tripping through Python objects silently truncates
sub-microsecond precision on Arrow `time64[ns]` columns (e.g. `[1001,
2002, 3003]` becomes `[2000, 1000, 3000]`) and raises
`NotImplementedError` on `FixedShapeTensorArray` columns (the same Arrow
types already tested for `RRFReranker` in `test_rerankers.py`).
### Changes
- Project only `_rowid`, `_distance`, and `_score` to Python for the
relevance score computation, then select the deduplicated payload rows
directly in Arrow via `pa.concat_tables(...).take(...)` and
attach/update `_score` (when `return_score="all"`) and
`_relevance_score` before sorting.
- Preserve existing duplicate-row precedence, missing-score penalties,
tie ordering, and both `return_score="relevance"` and
`return_score="all"` modes.
- Add unit tests in
`python/python/tests/test_linear_combination_payload.py` covering
`pa.time64("ns")` and `pa.FixedShapeTensorArray` in both `return_score`
modes.
### Verification
- **Baseline RED (`787ad381`)**: All 4 parametrized cases in
`test_linear_combination_payload.py` fail (nanosecond precision loss for
`time64("ns")` and `NotImplementedError` for `FixedShapeTensorArray`).
- **With fix GREEN**: `test_linear_combination_payload.py` -> `4
passed`.
- `ruff check`, `ruff format --check`, and `git diff --check` pass
cleanly on both modified files.
Signed-off-by: bc15575202581 <bc15575202581@gmail.com>
|
||
|
|
3857320202 |
perf(python): avoid redundant output_schema planning and eager-path bypass in to_pandas (#5361)
### Summary & Reasoning Embedded Python `to_pandas()` previously incurred three avoidable bottlenecks on tables without blob columns: 1. **Unconditional `output_schema()` re-planning**: Both sync and async `to_pandas()` invoked `output_schema()` before execution, running the full Rust/DataFusion physical query planner (`create_plan()` — dataset lookup, row count, SQL/subquery prep, index loading, plan construction) only to discard the plan and build it a second time. For sync queries, `_output_schema()` also hopped across `LOOP.run(...)`, bypassing the direct `execute_to_reader_sync` fast path. 2. **Async eager-collector bypass**: `AsyncQueryBase.to_pandas()` rewrote the default `blob_mode="lazy"` to `"descriptions"`, causing `to_arrow()` to skip `#5127`'s native eager collector (`execute_to_reader`) and fall back to per-batch `to_batches()` streaming (1,024-row slicing and one Python future per batch). Sync `LanceTakeQueryBuilder.to_pandas()` hit the same path via `BaseQueryBuilder`. 3. **Redundant `table.schema` fetches and `to_query_request()` vector FFI clones**: Blob row-id and source checks cloned query requests across FFI and fetched `table.schema` multiple times per execution (2x on non-hybrid, 4x-5x on hybrid / WAL-PK tables) even when the table schema contained no blob columns or `with_row_id()` was already set. ### Chosen Direction & Trade-Offs - **Schema-gated fast path**: `schema_has_blob_field(table_schema)` matches strictly schema-declared blob columns (including nested structs and lists), so a query over a non-blob table cannot produce blob output fields. Fetching `table_schema` once and gating `output_schema()` and `blob_mode` rewrites on it avoids double planning, keeps non-blob `to_pandas()` and `to_arrow(blob_mode="descriptions"|"bytes")` on the eager collector, and brings execution down to a single schema fetch (including across hybrid child legs and WAL-PK retries). - **Conservative on blob tables & unbound queries**: Tables containing blob columns still run `output_schema()` so projected/quoted/nested blob edge cases keep identical behavior (while reusing the pre-fetched schema to avoid extra schema fetches). Unbound `AsyncQueryBase` (`table=None`) keeps the conservative fallback. - **Preserving overrides & monkeypatches**: Internal schema-threaded helpers are only entered when built-in `to_arrow`/`to_batches` methods have not been overridden or monkeypatched (including hybrid child legs), so custom subclasses without `blob_mode` and test spies behave identically. - **Enterprise tables**: Early Enterprise execution paths are unchanged (preserving zero extra schema requests in `"lazy"` mode and existing `_blob_paths` / snapshot behavior). - **Out of scope**: Skipping `output_schema()` when a query on a blob table projects only non-blob columns, and Rust-side `create_plan()` optimizations. ### Benchmarks Measured on **AMD Ryzen 9 7950X3D**, runner and child processes pinned to **CCD0 (`ProcessorAffinity = 0xFFFF`, logical CPUs 0-15, verified via `GetProcessAffinityMask`)**, interleaved **`A -> B -> B -> A`** cells on shared datasets and the exact same compiled `_lancedb.pyd` extension (`A` = `c3f005f7`, `B` = patched): | Workload | Baseline `A` (med / p95) | Candidate `B` (med / p95) | Speedup | Per-cell medians (`A1, B1, B2, A2`) | | :--- | ---: | ---: | ---: | :--- | | Sync indexed vector `10k x 128d` `limit(10)` (`n=100`/cell) | `6.541 ms` / `6.834 ms` | `5.196 ms` / `5.439 ms` | **1.26x (-20.6%)** | `6.627, 5.148, 5.249, 6.464 ms` | | Async indexed vector `10k x 128d` `limit(10)` (`n=100`/cell) | `6.835 ms` / `8.063 ms` | `5.358 ms` / `5.632 ms` | **1.28x (-21.6%)** | `6.924, 5.323, 5.410, 6.790 ms` | | Sync scan `500k x 3` (`n=10`/cell) | `11.027 ms` / `11.901 ms` | `9.543 ms` / `10.253 ms` | **1.16x (-13.5%)** | `10.769, 9.452, 9.591, 11.134 ms` | | Async scan `500k x 3` (`n=10`/cell) | `152.783 ms` / `154.980 ms` | `9.447 ms` / `9.817 ms` | **16.17x (-93.8%)** | `151.034, 9.602, 9.431, 154.107 ms` | ### Verification - **Executed on Windows host**: - Targeted pytest suite (11 files covering sync direct, eager collector, query, blob, blob-without-pylance, hybrid, WAL hybrid, FTS wand factor, Enterprise `test_remote_db.py`, namespace, and table tests): **2,150 passed, 0 failed, 21 skipped** (0 missing-`pandas`/`pylance` skips; skips limited to Linux `sched_setaffinity`/`fork`, optional `av`/`torch`, and `experimental_functions`). - No-`pandas` / no-`pylance` parity check (blocking `pandas` and `lance` imports on `test_sync_query_direct.py`, `test_eager_collector.py`, `test_wal_hybrid.py`): **21 passed, 0 failed, 6 skipped**. - Doctests on `python/lancedb/query.py`: **23 passed, 0 failed**. - `ruff==0.9.9 format --check .` and `ruff==0.9.9 check .`: passed. - `pyright --pythonplatform Linux`: 0 errors; diff-scoped `pyright` on `python/lancedb/query.py`: 0 errors across all changed lines. - `typos` on all modified files: passed. - **Pending CI**: Full cross-platform Python matrix (Linux/macOS/Windows), Linux-only `sched_setaffinity`/`fork` tests, and CI commitlint/license-header workflows. --------- Co-authored-by: Xuanwo <github@xuanwo.io> |
||
|
|
33fdf6a7ce |
docs: document visible row counts for RTE tables (#5362)
## Summary Document how to count visible rows in an Enterprise Realtime Engine table. Use `COUNT(*)` when Flight SQL is reachable, or sum Arrow batch sizes from an unbounded, one-column REST scan. Explain the cost of the REST scan and the scope of the explicit base-table count. ## Validation Exercised both routes through published Python clients on isolated Linux. The large fixture returned 100,000 visible rows, then 99,999 after an overwrite and a base-key delete, then 99,998 after a fresh-key delete. An independent key/value oracle matched each stage. The REST base-only count stayed at 80,000 and the default REST count returned HTTP 400. |
||
|
|
3d765d3729 |
fix(python): skip null and empty texts in Gemini text embeddings (#5369)
## Summary
A table with a `gemini-text` embedding function can contain rows whose
source text is null or empty. `GeminiText.generate_embeddings` built a
`{"parts": [{"text": None}]}` content entry for each of them and sent it
to `embed_content`, so a single missing text could fail the request for
the whole batch.
Skip null and empty texts before building the request, as #5233 does for
Ollama and #4919 for Bedrock. Embed only the remaining texts and put
each embedding back at its original position, so a skipped row gets
`None` while the other rows keep their vectors. When every text is null
or empty, return `None` for each without calling the API. If the service
returns a different number of embeddings than texts sent, raise a
`ValueError` instead of misaligning rows.
The optional L2 normalization for truncated `gemini-embedding-001`
vectors still runs on the returned embeddings only.
## Verification
- Added `test_source_embeddings_skip_null_and_empty_texts` to
`tests/test_gemini_text_embeddings.py`, using the file's existing
`fake_genai` fixture:
- `["a", None, "", "b"]`: only `["a", "b"]` is sent, and the result is
`[vec_a, None, None, vec_b]`;
- `[None, ""]`: no request is sent and the result is `[None, None]`.
- With `main`'s `gemini_text.py`, the new test fails and the existing 8
tests pass; with this change, all 9 pass. I ran the file against LanceDB
0.42.1 with `main`'s and then the changed `gemini_text.py` copied over
the installed module. I did not call the live Gemini API.
- Repository Ruff lint and format checks pass.
|
||
|
|
787ad381bf |
docs(rust): document and test num_threads for index optimization (#5359)
This PR fixes [issue #4960](https://github.com/lancedb/lancedb/issues/4960). Fixes #4960 The issue asks for a `num_threads` option on `OptimizeOptions`, like `CompactionOptions::num_threads`, so index optimization can be held to a CPU budget. LanceDB re-exports `OptimizeOptions` from `lance-index`, and Lance added `OptimizeOptions::num_threads` / `with_num_threads` in lance-format/lance#11154. The bump to Lance v16.0.0-beta.7 (#5352) brought it in, and `OptimizeAction::Index(options)` already hands the options through to `Dataset::optimize_indices` unchanged. So the Rust option works today, but nothing in LanceDB says so or checks it. This PR: - documents the option on `OptimizeAction::Index`, with a compile-checked example (`OptimizeOptions::default().with_num_threads(2)`), what it limits (compute stages of index optimization, not a process-wide thread cap), that zero is rejected, and that index optimization runs on LanceDB Embedded tables only; - adds `test_optimize_index_with_num_threads`: on a table with 100 indexed and 100 unindexed rows, `with_num_threads(0)` returns an error naming `num_threads` and leaves the index untouched, and `with_num_threads(1)` then indexes all 200 rows. No code paths change. Possible SDK parity gap: the Python and TypeScript `optimize()` convenience methods run the index step with default `OptimizeOptions`, so they don't expose this limit yet. That would be a separate binding change; I left it out of this PR. ## Testing On macOS arm64, Rust 1.100.0 stable: ``` cargo test --profile ci -p lancedb --lib table::optimize::tests # 24 passed, incl. test_optimize_index_with_num_threads cargo test --profile ci -p lancedb --doc OptimizeAction # 2 passed, incl. the new OptimizeAction::Index example cargo fmt --all -- --check # clean ``` As a check that the test exercises the pass-through, I temporarily made `optimize_indices` ignore the caller's options and use `OptimizeOptions::default()`; `test_optimize_index_with_num_threads` then fails at the zero-value assertion. The test can't observe the thread count itself, so the `with_num_threads(1)` case only shows a limited run completes and indexes every row. `cargo clippy -p lancedb --tests` on Rust 1.100 reports dead-code and `if`-guard lints in other files (`job/profile.rs`, `table/add_data.rs`, `table/write_progress.rs`, `table/query.rs`, `table/computed_columns.rs`) with the default features; none in `table/optimize.rs`. Co-authored-by: Lenin Mookiah <2639584+leninworld@users.noreply.github.com> |
||
|
|
feff86a08d |
feat(query): stream query results with optional total hits (#5354)
## Summary An Embedded query can stream one page of results and report how many visible rows matched before offset and limit. This adds Rust `execute_with_metadata`, Python sync and async `to_result`, and TypeScript `toResult`. The existing query terminals continue to use their existing execution paths. Tracking defaults to Off. An exact count returns `eq(N)`. A positive cap C returns `eq(N)` below C and `gte(C)` as soon as C matches are proven, including equality. TypeScript exposes counts as bigint. Counts use the same snapshot as the result batches. The accessor reports pending until the stream reaches successful EOF. Explicit counts can add work after the last batch, especially when full-text counting needs to scan visible text. Closing an unfinished result cancels execution. Stream and metadata failures retain interruption details, including the request ID. Embedded supports scalar and row-level lexical counts. Unordered FTS retains its existing top-k and scoring policy. Enterprise and unsupported query shapes return a typed error when a count is requested. ## Dependency #5352 merged Lance v16.0.0-beta.7 into main, including [Lance #11680](https://github.com/lance-format/lance/pull/11680). This PR uses that dependency and its lockfiles. ## Validation The Linux-tested revision `bc39ad7ac` and rebased revision `24f4e90c2` have the same Git tree. The only change in `6932b3082` is the Python namespace regression fixture, which now resolves the local table without the optional pylance package. The revised test passed on managed Linux with CPython 3.11.18 both with pylance and pandas installed and after removing both packages. Managed Linux runs used the unmodified manifests and lockfiles from #5352 and the published `pylance 16.0.0b7` wheel. - The Rust metadata suite passed 57 tests, with two existing ignores. Coverage includes unordered FTS plans, top-k scores, physical row addresses under pagination, pending-read cancellation, and interruption after the last batch. - Python query, remote and namespace suites passed 1,163 tests. One optional slow test requires PyTorch, which was unavailable on this VM. The Node query, remote, table and error suites passed 913 tests, with three experimental cases skipped. - Regression tests reproduced the failures on the previous revision and verified the fixes. Python sync reranking and namespace FTS preserve an explicit empty page. Python sync and async scans expose `_rowaddr` alongside the pre-pagination count. Explicit counts are rejected before TypeScript auto-search issues an Enterprise request or invokes a vector embedding provider. Python and Node retain the server's 1,063-row first batch in Off mode. - A custom Python namespace opened through the public API receives the same computed projection in Off mode as with `to_batches()`. A Node result interrupted after another SDK load retains its original error class and request ID. Both regressions were reproduced on the prior revision. - Workspace Clippy, formatting, Ruff, Biome, TypeScript checks, TypeDoc and strict MkDocs passed. All 287 generated TypeDoc files matched the committed files byte for byte. |
||
|
|
623777389e |
fix(docs): unblock nightly eval preparation for Firecrawl (#5309)
The nightly Agent Evals workflow stops during documentation preparation because the Firecrawl example names a fixed Enterprise edition. Use the unversioned integrations URL and regenerate the snippet so the development composer accepts the example. This fixes the preparation error in [run 46482397051](https://github.com/lancedb/docs/actions/runs/46482397051). The public URL currently redirects to the same integrations page. ## Checks completed - Reproduced the composer failure with the exact three source revisions from the failed run. - Passed documentation assembly, development composition, and skill packaging after the change. - Passed Ruff formatting, Ruff lint, and `git diff --check`. - Confirmed that the public URL redirects and returns HTTP 200. The live Firecrawl example and full eval suite were not run. The Firecrawl example requires a personal API key and consumes service credits. ## Clicktesting Required tools: Git, GitHub CLI, GNU Make, uv, Node.js 20 or later, and npm. Use your own GitHub account with read access to `lancedb/docs` and `lancedb/sophon`. No service secrets are required for these documentation checks. Start in an empty directory. Authenticate with your own account, then obtain the branch and the build inputs: ```bash gh auth login gh repo clone lancedb/lancedb lancedb git -C lancedb switch --track origin/fix/nightly-firecrawl-url gh repo clone lancedb/docs docs git -C docs checkout 1a2a108f590405ae7dcec16da098c8c94f75469b gh repo clone lancedb/sophon sophon git -C sophon checkout d471a248ab3e80e08b92c432c969027643dee33e npm install --global mint@4.2.888 uv python install 3.13 cd docs export LANCEDB_DOCS_ROOT=../lancedb/docs/web export SOPHON_DOCS_ROOT=../sophon/docs/web make assemble uv run --no-project --python 3.13 --with pyyaml python scripts/compose.py --development build/site --output build/nightly make package-skill ``` Expected result: all three build commands succeed. Composition must not report that Firecrawl code uses another edition. Start the documentation application from the generated directory: ```bash cd build/nightly mint dev --port 3000 ``` Open `http://localhost:3000/enterprise/development/integrations/data/firecrawl`. Find “Crawl a site.” Confirm that its Python example uses `https://docs.lancedb.com/integrations`. In a second terminal, check the live destination: ```bash curl -sSL -o /dev/null -w '%{http_code} %{url_effective}\n' https://docs.lancedb.com/integrations ``` Expected result: HTTP 200 and the current edition's integrations URL. Co-authored-by: Lucia Cerchie <cerchie@Lucias-MacBook-Pro.local> |
||
|
|
d87b721604 |
fix(python): support legacy StringView JSON writes (#5357)
PyArrow 16.1 is in the Python SDK's supported range and cannot cast `StringView` to UTF-8. For a JSON column, sanitized `add()` and `merge_insert()` fail at that cast before Lance can encode the input as JSONB. Convert top-level JSON `StringView` columns at the shared Python cast boundary. Use Arrow's cast when available and materialize UTF-8 values when the kernel is missing. The aligned column carries `arrow.json` metadata and preserves nulls. Both write regressions fail on PyArrow 16.1 before the fix and pass after it. They consume multiple batches and verify JSON queries after reopening. The RTE JSON upsert regression also exercises `StringView` input. This carries forward [LH-kevin’s fix](https://github.com/lancedb/lancedb/commit/481e13d95c3471c80a781ba4e0b21004afbb246b). Related to #4038 and #4035. Co-authored-by: LH-kevin <186923068+LH-kevin@users.noreply.github.com> --------- Co-authored-by: LH-kevin <186923068+LH-kevin@users.noreply.github.com> |
||
|
|
0a14761f0e |
feat(python): open blob files by row offset (#5356)
Open seekable Blob files by row position with `table.take_blob_files(column, offsets, *, buffer_size=None)` on synchronous and asynchronous Embedded and Enterprise tables. Results follow the requested order, duplicate offsets have independent cursors, and NULL and empty values stay distinct. An invalid offset rejects the entire batch. Enterprise resolves positions and descriptors together and verifies one snapshot across descriptor queries, location resolution, and authenticated byte reads. Eligible ranges use the existing presigned read path when the gateway advertises it. Refs [OSS-2881](https://linear.app/lancedb/issue/OSS-2881). ## Validation - On Enterprise 1.16.0, the same locked wheel passed both sync and async reads of 1,025 distinct offsets after a deletion. The offsets matched an independent ordered query, and the two descriptor chunks and subsequent authenticated requests matched the pinned version and snapshot identity. - Both APIs returned byte-for-byte matches for 37-byte proxy reads and a 32 MiB presigned object-store read. The large reads used zero gateway byte requests. An independent range check returned two object-store HTTP 206 responses with matching physical ranges and bytes. - The wheel passed 23 focused Python tests. The Rust library check and all 81 Enterprise Blob module tests passed, including nested NULL and strict snapshot echo cases. Runtime evidence is from commit `f56c359ba7874cd75c52169491166a941251510f` with Lance `16.0.0-beta.6`, wheel SHA-256 `9abbbfe584513432547d237dcf7b684b479b35cad07c48cd9899d381f0e80423`. The merge preview with `main` at `ff556729` is clean. [#5352](https://github.com/lancedb/lancedb/pull/5352) updates the integration dependencies to Lance `16.0.0-beta.7` and `object_store` `0.14.2`. Those pins are outside the tested wheel's coverage. The synthetic test table was removed from the catalog. Its physical storage cleanup is tracked separately. |
||
|
|
eea95c8778 |
feat(python): support SigLIP image search with OpenCLIP (#5355)
## Summary - Use the existing OpenCLIP provider with the SigLIP SO400M checkpoint to embed image files and search them from Python. - Accept filesystem path objects for vector queries and preserve Windows drive letters and special characters in image ingestion paths. String queries continue to use the text encoder. - Add sync and async regression tests and a generated, runnable documentation example. Refs #4767 ## Validation - Embedding suite with 122 passing tests, CI-pinned Ruff, Linux-targeted Pyright, and strict MkDocs. - The real SigLIP checkpoint returned 1,152-dimensional unit-normalized vectors and ranked the matching image first. The Windows smoke test used the non-mapped safetensors reader and one shared model instance. - Five row-address tests also failed with the preview native extension on the unmodified base. The source-built CI run will cover these tests. |
||
|
|
c85647526c |
fix: encode JSON in RTE merge_insert (#5353)
Unsharded RTE `merge_insert` reaches the shard writer with JSON text,
which fails the writer’s `LargeBinary` schema check. Encode Arrow JSON
with Lance’s JSONB converter before schema alignment so plain JSON text
and `arrow.json` can both be upserted. Require an explicit JSON
extension on binary input before schema alignment can attach the
destination’s JSONB metadata.
The Python regression tests query the updated and inserted rows after
reopening the table and verify that invalid JSON and unmarked binary
writes leave the existing data intact. Overwrite tests cover schema
replacement in both directions between plain Arrow strings and typed
JSON.
PyArrow 16.1 still raises `Unsupported cast from string_view to utf8`
for `StringView` input on sanitized append and merge paths. Ordinary
UTF-8 RTE upserts and default Arrow append with `StringView` pass on
that version.
The RTE conversion and regression build on LH-kevin’s
[
|
||
|
|
ff556729ab |
chore: update lance dependency to v16.0.0-beta.7 (#5352)
Update the Rust and Java Lance dependencies to [v16.0.0-beta.7](https://github.com/lance-format/lance/releases/tag/v16.0.0-beta.7) and pin Python tests to pylance 16.0.0b7. Use the published object_store 0.14.2 release to match Lance's multipart API. |
||
|
|
c9ef03c61e |
fix: refresh stale schema when listing indexes (#5345)
## Problem An Enterprise table handle can fail to list indexes after another client adds and indexes a column. The list response includes the new column while the first handle still has an older schema cached. ## Fix When the cached schema misses an index column or resolves it only by ignoring case, send one `describe` request with the original branch, version selector, and freshness bounds. For a latest read, use the list response version as a lower bound when available. Resolve every column before requesting legacy index stats. ## Validation The original SDK failed on the old handle with `Field path i not found in schema`. A fresh handle and a historical handle passed the same test. [Baseline CI](https://github.com/lancedb/lancedb/actions/runs/46821564282/job/143256287384) At `4c657f597`, the two-client Enterprise regression passed with a zero read consistency interval. Both mock cases passed and verified the `describe` and legacy stats request counts. [Enterprise CI](https://github.com/lancedb/lancedb/actions/runs/46831924124/job/143291095278) The current revision also covers `w` and `W` coexisting and checks that equivalent quoted paths use the warm cache. [Rust CI](https://github.com/lancedb/lancedb/actions/runs/46842846145) Tracks ENT-4843. |
||
|
|
b5f35d5c56 |
fix: honor Enterprise query batch size limits (#5350)
Enterprise queries could return Arrow batches larger than the size explicitly requested by the caller. The SDK now slices oversized batches in the final query stream and keeps server-selected batch sizes when the caller omits the limit or passes zero. The search guide shows how to stream a full table or filtered scan in one query using Python's `search().to_batches()`. It covers older deployments that return buffered Arrow IPC files or enforce a query row cap. A local Enterprise 1.16.0 probe streamed all 131,073 rows from a pinned snapshot in one query, with batches of at most 37 rows and the first batch available before the Arrow end-of-stream marker. The probe ran with Plan Executor enabled and disabled. Related to OSS-3133. |
||
|
|
53a8c6973c |
fix(python): return optimize stats from sync table and forward compaction options (#4830)
## Summary This PR fixes return value and argument forwarding inconsistencies in the Python `Table.optimize()` implementation: 1. `LanceTable.optimize()` now returns `OptimizeStats` produced by the underlying optimization process, matching `AsyncTable.optimize()` behavior. Previously, the return value was dropped by `LOOP.run(...)`, causing `table.optimize()` to always return `None`. 2. `Table.optimize` (abstract base class), `LanceTable.optimize`, and `RemoteTable.optimize` now annotate `-> OptimizeStats` return types. 3. `RemoteTable.optimize()` now properly forwards `compaction_options` to the underlying table optimize handle. Previously, `compaction_options` was accepted in the method signature but omitted in the delegation call. Refs #4397. ## Root Cause & Problem - In `python/python/lancedb/table.py`, `LanceTable.optimize()` called `LOOP.run(self._table._do_optimize(...))` as a standalone statement without a `return`. Because `LOOP.run` returns the result of the coroutine, callers of synchronous `table.optimize()` received `None` even though compaction and prune statistics (`OptimizeStats`) were generated. - In `python/python/lancedb/remote/table.py`, `RemoteTable.optimize()` accepted `compaction_options: Optional[CompactionOptions] = None` in its method definition, but the call to `self._table.optimize()` omitted `compaction_options=compaction_options`. - In `Table` (ABC), `optimize()` was missing return type annotations, preventing type checkers from inferring `OptimizeStats`. ## Technical Solution - Updated `LanceTable.optimize()` in `python/python/lancedb/table.py` to `return LOOP.run(...)` and added the return type annotation `-> OptimizeStats:`. - Added `-> OptimizeStats:` return type annotation to `Table.optimize()` in `python/python/lancedb/table.py`. - Updated `RemoteTable.optimize()` in `python/python/lancedb/remote/table.py` to forward `compaction_options=compaction_options` to `self._table.optimize(...)` and added `-> OptimizeStats:` return type annotation. - Added `OptimizeStats` to `TYPE_CHECKING` imports in `python/python/lancedb/remote/table.py`. - Added regression tests in `test_table_signatures.py` to verify argument forwarding (`compaction_options`) and stats return on both local and remote tables. - Updated `test_sync_optimize` and `test_sync_optimize_in_async` in `test_table.py` to assert that non-None `OptimizeStats` containing compaction and prune stats are returned. ## Test Plan - Focused signature and argument forwarding test suite: Ran `pytest python/tests/test_table_signatures.py` (40 passed in 5.05s). - Focused sync and async optimize test suite: Ran `pytest python/tests/test_table.py -k "test_sync_optimize"` (2 passed in 3.30s). Ran `pytest python/tests/test_table.py -k "test_optimize"` (25 passed in 7.69s). - Linting and formatting: Ran `ruff check` on modified files (passed with 0 errors). Ran `ruff format --check` on modified files (passed with 4 files formatted). |
||
|
|
50c66c66d5 |
fix(python): return row addresses from embedded scans (#5344)
## Problem Embedded Python queries accept `with_row_address()`, but ordinary sync and async scans omit `_rowaddr`. ## Fix Pass the existing option to the Lance scanner for Embedded base-table scans. Embedded namespace queries that request addresses use the Embedded scanner. An RTE scan reports that addresses require `use_rte(False)` to read the base table. ## Validation The two-fragment tests verify sync batches and async Arrow results, `uint64` physical addresses, projection, and default and explicit disabling. Stable row IDs confirm that `_rowaddr` is distinct from `_rowid`. Additional tests cover namespace routing, RTE and vector/FTS builder conversion. All applicable checks passed for `64dd3c0e`. The baseline test run stopped at the `stats()` fixture and did not reach the query assertions. Tracks OSS-2972. |
||
|
|
2e46464589 |
docs: group ordered takes for training batches (#5351)
Training samplers can group several batches of offsets into one bounded Enterprise request. The guide uses `take_offsets(..., preserve_order=True)` on the sampler's table version and checks the returned row count before splitting the rows back into the original training batches. It explains the buffering trade-off and how to apply the same cardinality check to row-ID lookups. Related to [OSS-3134](https://linear.app/lancedb/issue/OSS-3134). |
||
|
|
16c934a827 |
docs(python): document single-commit RecordBatchReader appends (#5349)
Python callers can pass a `pyarrow.RecordBatchReader` to `add()` to commit multiple batches as one table version. The insert guide shows the synchronous and asynchronous calls, when to use separate calls for independently acknowledged flushes, and the server protocol and catalog requirements for Enterprise multipart uploads. Both examples advanced the table by one version on the Enterprise 1.16.0 directory and manifest catalogs with Python SDK 0.42.1. |
||
|
|
36814ac87b |
docs: clarify Enterprise migration writes and row caches (#5348)
The Attach Database guide now shows how to switch writers to the Enterprise SDK or SQL and how to request a fresh read. It also shows how to retain a tagged snapshot for cached row addresses or rebuild a cache with business keys or stable row IDs that are already enabled on the target table. The saved Enterprise 1.12.0, 1.13.0, and 1.14.0 editions omit this migration guidance. The six Python examples ran with Enterprise 1.16.0 and Python SDK 0.42.1 on both directory and manifest catalogs. With a configured 60-second weak read interval, a primed reader still saw v1 after a bare URI commit. The zero interval and `checkout_latest()` each read v2 in independent cases. Related issues are [OSS-3150](https://linear.app/lancedb/issue/OSS-3150) and [OSS-3151](https://linear.app/lancedb/issue/OSS-3151). |
||
|
|
8c9ba71add |
fix: register Lance SQL functions for RTE filters (#3794)
<!-- lance-gatekeeper-fix:v1 agent=d1262fd0aeb86548a3550f636fffe0cc generation=1 --> Embedded RTE queries parse SQL filters in a separate DataFusion context. Register Lance's SQL functions in that context so a filter such as `ST_Distance(...) <= radius` resolves as it does in an ordinary Embedded scan. The Rust regression checks an inclusive distance filter against rows in the base table and the active MemTable with the `geo` feature enabled. This builds on [Gatefixer's original contribution](https://github.com/lancedb/lancedb/commit/e459892bb5ee611daf53fe5e61d51aeb70e41dd5). --------- Co-authored-by: Gatefixer <313497061+lancedb-gatefixer[bot]@users.noreply.github.com> Co-authored-by: Xuanwo <github@xuanwo.io> |
||
|
|
a46ed4754b |
docs: expose checkpoint delta in the table guide (#5347)
Show the checkpoint delta section in the Tables guide. The Python, TypeScript, and Rust SDKs ship the API from #5135 and #5149 in [v0.42.1](https://github.com/lancedb/lancedb/releases/tag/v0.42.1). Verified that Mintlify renders the checkpoint anchor and all three language tabs. The Python and TypeScript examples run against the published 0.42.1 packages. An Embedded docs edition prepared from the v0.42.1 tag will need a recorded correction for this section because the tag still wraps it in a draft comment. Refs [OSS-2860](https://linear.app/lancedb/issue/OSS-2860/version-to-version-diff-branch-diff-is-enterprise-only). |
||
|
|
528ed34589 |
docs(nodejs): sync generated macOS platform support (#5303)
The generated JavaScript SDK README still lists Intel Macs after #5244 updated the Node.js README. The stale line causes the Node.js `Check docs` step to fail on PRs targeting `main`. [Failing job](https://github.com/lancedb/lancedb/actions/runs/46403162946/job/141808637388) Regenerate the SDK README so its macOS entry matches the Apple silicon (`arm64`) binaries published to npm. |
||
|
|
585e598092 | Bump version: 0.43.0-beta.0 → 0.43.0-beta.1 v0.43.0-beta.1 | ||
|
|
9b3398e31b |
fix(python): skip null texts when reranking with AssetFeed (#5346)
## Summary A vector, full-text, or hybrid search can return rows whose reranking text column is ull. AssetFeedReranker._rerank currently forwards None values inside the JSON documents list to the AssetFeed rerank API, which rejects or misaligns results when null texts are present, still makes an HTTP request when every candidate text is ull, and counts null rows against MAX_DOCUMENTS = 100. This aligns AssetFeedReranker with the existing null-filtering pattern in #5283 (Cohere), #5296 (Jina), #5336 (VoyageAI), and #5337 (watsonx.ai): - Filter out rows where esult_set[self.column] is null before self._handle_empty_results(result_set) and MAX_DOCUMENTS validation, so returned AssetFeed result indices select the exact matching rows and keep all original columns. - Return an empty loat32-scored result table without calling the AssetFeed API when all candidate rows have null text. - Document in AssetFeedReranker that rows with null values in column are omitted from the reranked results. ## Verification - Added unit tests in python/python/tests/test_assetfeed_reranker.py: - est_nullable_documents (["first document", None, "last document"] and [None, None, None]): verifies only non-null strings are sent, row IDs/scores/_distance/ loat32 _relevance_score align cleanly, and all-null inputs skip the HTTP request. - est_null_documents_excluded_before_max_documents_check: verifies 100 valid documents plus 1 null row pass MAX_DOCUMENTS validation after null filtering. - Ran pytest -o addopts="" --noconftest -v python/python/tests/test_assetfeed_reranker.py on Python 3.11.18 + PyArrow 26.0.1 (15 passed in 1.16s with lancedb._lancedb stubbed in the scratch test runner because Windows Application Control on the local test machine blocks the unsigned native Rust .pyd binary; mocked HTTP session, no live AssetFeed API calls). - Verified uff check and uff format --check pass cleanly on both changed files. |
||
|
|
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> |
||
|
|
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> |
||
|
|
5373da5760 |
fix: explain Flight SQL endpoint errors during function registration (#5342)
## Summary Function registration uses Flight SQL. If the SDK has no usable SQL URI or cannot establish a connection, it points to the cluster’s published Flight SQL URI and the Public SQL or PrivateLink SQL settings. The diagnostic retains the original exception type, cause text, and request ID when present. ## Validation - Built main (`0abc7d48`) and the SDK change (`4bfdbb217`) in the same isolated Linux VM with the locked Python environment. The final commit updates only the test assertion for platform-dependent connection errors. - Compared 22 calls against a healthy HTTPS REST fixture and Flight endpoints. The expected five registration failures gained the hint. After accounting for request IDs, all original errors and successful results matched. - New regression tests on main had two expected failures and three passing controls. The SDK change passed 86 tests with 16 skipped across registration, Function catalog, SQL, and view creation. Rust formatting and Ruff passed. - All 50 GitHub checks passed on `7c2dad8bc`, including the [Python workflow](https://github.com/lancedb/lancedb/actions/runs/46796061600) and the [Rust macOS 26 rerun](https://github.com/lancedb/lancedb/actions/runs/46796061943/job/143185732469). |
||
|
|
3afd0ced9c |
fix: reject combined-fields queries on legacy Enterprise servers (#5343)
Closes #5340. Reject `CombinedFields` before sending an FTS query to a LanceDB Enterprise server older than 0.3.0. The check follows all Boolean clauses and both sides of a Boost query. The 0.3.0 regression test also checks that unequal column weights and the `AND` operator reach the server. Reproduced with Python SDK 0.42.1 against a mock 0.2.0 server. Both searches returned HTTP 200. The top-level query lost its weights and operator, and the nested Boolean query sent an empty string. The same searches preserved the structured query on 0.3.0. |
||
|
|
9bdb1b7219 |
fix(python): honor bad-vector policies for inferred vector columns (#5243)
Fixes #5241 ## Summary Python inferred fixed-size vectors from names such as `text_embedding`, but the bad-vector sanitizer used a narrower naming rule. Ragged rows could reach Arrow and fail the cast, and schema inference could accept an `embedding` row containing NaN. Use the schema-inference name check when selecting floating-point vectors for sanitization. When a target schema exists, apply the expanded naming rule to fixed-size lists so an explicitly variable-length column such as `embedding_history` keeps its list semantics. Creation now rejects NaNs in these inferred vectors under the default `error` policy. The `drop`, `fill`, and `null` policies handle them during creation, append, and overwrite. The four streaming bad-vector policy regression cases come from [#5003](https://github.com/lancedb/lancedb/pull/5003). Fixes #5241. ## Testing Tests: `/bin/sh -c 'cd python && PYTHONPATH=python UV_PROJECT_ENVIRONMENT=/tmp/osscout-lancedb-venv uv run --no-sync pytest python/tests/test_table.py -k bad_vectors_in_name_inferred_columns -q --tb=short'`. Result: Existing related tests on base, cd python && PYTHONPATH=python UV_PROJECT_ENVIRONMENT=/tmp/osscout-lancedb-venv uv run --no-sync pytest python/tests/test_table.py -k 'bad_vectors or with_nans or null_elements or empty_fixed_size_list or integer_embeddings or infer' -q — exit 0, 75 passed, 501 deselected in 1.18s. Result: Base regression, cd python && PYTHONPATH=python UV_PROJECT_ENVIRONMENT=/tmp/osscout-lancedb-venv uv run --no-sync pytest python/tests/test_table.py -k bad_vectors_in_name_inferred_columns -q --tb=short — exit 1, 19 failed, 9 passed, 576 deselected in 5.29s. The nine default vector controls passed. Output is in OSSCOUT_BASE.log. Result: Patched regression, cd python && PYTHONPATH=python UV_PROJECT_ENVIRONMENT=/tmp/osscout-lancedb-venv uv run --no-sync pytest python/tests/test_table.py -k bad_vectors_in_name_inferred_columns -q --tb=short — exit 0, 28 passed, 576 deselected in 0.54s. Output is in OSSCOUT_PATCHED.log. Result: Patched affected modules, cd python && PYTHONPATH=python UV_PROJECT_ENVIRONMENT=/tmp/osscout-lancedb-venv uv run --no-sync pytest python/tests/test_table.py python/tests/test_util.py python/tests/test_embeddings.py -m 'not slow and not s3_test' -q --tb=short — exit 0, 822 passed, 19 skipped, 8 deselected, 32 warnings in 15.11s. Result: Patched namespace creation checks, cd python && PYTHONPATH=python UV_PROJECT_ENVIRONMENT=/tmp/osscout-lancedb-venv uv run --no-sync pytest python/tests/test_namespace.py -k create_table -m 'not slow and not s3_test' -q --tb=short — exit 0, 5 passed, 89 deselected, 4 warnings in 0.20s. Result: From the repository root, /tmp/osscout-lancedb-venv/bin/ruff format python/python/lancedb/table.py python/python/tests/test_table.py left both files unchanged. /tmp/osscout-lancedb-venv/bin/ruff check python passed. Result: From the repository root, /tmp/osscout-lancedb-venv/bin/ruff format --check . and /tmp/osscout-lancedb-venv/bin/ruff check . --output-format concise flagged six files for reformatting and 59 lint findings, respectively, all under unchanged docs/web-tests paths. Result: git diff --check passed. Regression coverage: `python/python/tests/test_table.py`. <!-- oss-scout-job:job-f4fee21f-9051-4409-b66f-195dad93a5df --> --------- Signed-off-by: wangshun <96341168+xixi-box@users.noreply.github.com> Co-authored-by: Xuanwo <github@xuanwo.io> Co-authored-by: Aditya Gupta <84338325+MaiAditya@users.noreply.github.com> |
||
|
|
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> |
||
|
|
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> |
||
|
|
c3f005f7ff |
fix(python): skip null texts when reranking with watsonx.ai (#5337)
## Summary A vector, full-text or hybrid search can return a row whose reranking text is null. `WatsonxReranker` sent that null in the `inputs` list it passes to `Rerank.generate`, although watsonx.ai reranks a list of strings, so one row with missing text broke reranking for every other row. Filter rows with null text out of the Arrow table before building the request, so the indices watsonx.ai returns still select the right rows and keep their original columns. When every candidate has null text, return an empty scored table without calling the API. The class docstring now says that rows with a null `column` value are left out of the reranked results. This is the same change as #5283 (Cohere) and #5296 (Jina), applied to the watsonx.ai reranker. [watsonx.ai text rerank API](https://cloud.ibm.com/apidocs/watsonx-ai#text-rerank) ## Verification - Added `test_watsonx_reranker_nullable_documents`, run through a real local table and `table.search(...).rerank(...)`, with two cases: - a null between two valid documents, where the mocked client returns reordered indices: only the two valid texts are sent, and the result keeps the correct row IDs, scores, `_distance` column and `float32` `_relevance_score`; - all-null input, where the client is never called and an empty typed result comes back. - Both cases fail on `main` and pass with this change. - Ran against LanceDB 0.42.1 with the changed reranker module copied over the installed one. The installed `watsonx.py` is identical to `main`. I did not call the live watsonx.ai API. - Repository Ruff lint and format checks pass. |
||
|
|
c5a67c3d78 |
fix(python): skip null texts when reranking with VoyageAI (#5336)
## Summary A vector, full-text or hybrid search can return a row whose reranking text is null. `VoyageAIReranker` sent that null in its `documents` list, although the Voyage rerank API takes a list of strings, so one row with missing text broke reranking for every other row. Filter rows with null text out of the Arrow table before building the request, so the indices Voyage returns still select the right rows and keep their original columns. When every candidate has null text, return an empty scored table without calling the API. The class docstring now says that rows with a null `column` value are left out of the reranked results. This is the same change as #5283 (Cohere) and #5296 (Jina), applied to the VoyageAI reranker. [Voyage AI reranker API](https://docs.voyageai.com/reference/reranker-api) ## Verification - Added `test_voyageai_reranker_nullable_documents`, run through a real local table and `table.search(...).rerank(...)`, with two cases: - a null between two valid documents, where the mocked client returns reordered indices: only the two valid texts are sent, and the result keeps the correct row IDs, scores, `_distance` column and `float32` `_relevance_score`; - all-null input, where the client is never called and an empty typed result comes back. - Both cases fail on `main` and pass with this change. - Ran against LanceDB 0.42.1 with the changed reranker module copied over the installed one. The installed `voyageai.py` is identical to `main`. I did not call the live Voyage API. - Repository Ruff lint and format checks pass. |
||
|
|
1a8810e81d |
docs(cli): document Python installation and publish retries (#5332)
The CLI guide covers Homebrew, the shell installer, and manual downloads. Readers who use Python tools need the PyPI package name because it differs from the executable name. This adds examples for running the CLI once and installing it persistently, and clarifies how maintainers retry a partial PyPI upload. |
||
|
|
82620b1b8e |
docs: fix the hybrid search walkthrough (#5334)
## Summary - Import `lancedb` before the Embedded Python connection example uses it. - Explain how to use the default RRF reranker when skipping the optional setup step in Python or TypeScript. ## Testing - Ran the original walkthrough in fresh Python 3.12 and Node.js 24 processes. The Python connection raised `NameError`, and skipping the optional reranker setup raised `NameError` in Python and `ReferenceError` in TypeScript. - Ran the updated steps with the published LanceDB 0.42.0 Python and Node SDKs, real Embedded tables and full-text indexes, and deterministic test embeddings. Both explicit and default RRF returned the same four rows in the same order and with the same relevance scores in each SDK. - Checked the edited page with Vale 3.24.0 and checked the staged diff. AI assistance disclosure. OpenAI Codex reproduced the errors, prepared the documentation change, and ran the checks. |
||
|
|
108e8183e1 |
fix(ci): increase swap for Linux ARM Python wheels (#5333)
Both Linux aarch64 wheel variants intermittently lose the final `lancedb-python` rustc process during fat LTO. The affected runners reported 31 GiB of RAM and 16 GiB of configured swap, and the logged Docker invocation supplies no explicit memory cap. The same runner image has also completed wheel builds, so the historical logs leave the source of SIGKILL undetermined. [Standard wheel failure](https://github.com/lancedb/lancedb/actions/runs/46692473826/job/142804749599) · [Free-threaded release failure](https://github.com/lancedb/lancedb/actions/runs/46648917509/job/142722631114) Give the two native ARM wheel builds 32 GiB of swap through their shared composite action. This keeps fat LTO and one codegen unit, which preserve release wheel size headroom, and keeps the existing manylinux platform and ABI tags. Record the build container's memory and swap peaks and OOM counters on exit, with kernel and systemd-oomd logs on failed native ARM jobs. |
||
|
|
5d455e4b4f |
feat(rust): expose progress callbacks for create_index (#4245)
This adds a `.progress()` option to `IndexBuilder` and plumbs it through `create_index` to the lance `CreateIndexBuilder`. There was already a progress callback usable with `table.optimize()` via `OptimizeOptions`, but it was not exposed for `table.create_index()`, although the underlying lance methods support it. |
||
|
|
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> |
||
|
|
a0ff67e13e |
feat(cli): publish a source distribution for lancedb-tools (#5314)
The `lancedb-tools` release contains wheels for Apple Silicon and two Linux architectures. Users on Intel macOS have no compatible wheel, so the Python installer has no way to install the CLI. This extends the release workflow from #5313 to build a source distribution from the same tag and check the source fallback before the release team approves publication. This was accomplished with the following changes: - Package the tagged Rust CLI, workspace manifests, lockfile, and licenses with a setuptools-rust binary target. - Install by package name on a native Intel macOS runner with all four release files available, then check that pip selected the sdist and built a working x86-64 executable. - Upload the tested sdist alongside the wheels and verify its published SHA-256 digest. |
||
|
|
cf59298934 |
fix(query): apply cosine candidate bounds once per ANN branch (#5330)
An indexed cosine query with an unindexed tail can lose valid rows when its distance range has a positive lower bound. Lance now translates the candidate bounds for exact rescoring. Replanning the ANN branch with doubled inputs can translate them a second time. A public range of `[0.10, 0.16)` then reaches the index as `[0.40, 0.64)`. The SDK checks the candidate bounds on each quantized cosine ANN node. If Lance already supplied the normalized squared-L2 bounds, the SDK uses that node. Exact fallback and refinement keep their original range, and returned distances use the public cosine scale. The regression compares indexed results against a brute-force scan after appending an out-of-range vector. It exercises modern and legacy IVF_PQ, single-query refinement, and modern batched queries with and without refinement. Rust formatting and whitespace checks passed. Project CI runs the behavioral tests. |
||
|
|
ec230318f6 |
fix: point the compaction warning at the current docs page (#4913)
Refs #4371 The link checker flags `https://docs.lancedb.com/performance#compaction-and-cleanup` because that section no longer exists. Compaction has its own page now, and its "When to run it" section (`#when`) covers the warning this link is attached to: tables with many small fragments. This points `DocLink::Compaction` at `/maintenance/compaction#when` and updates the two tests that hard-code the URL. The anchor exists on the published site and in `docs/web/maintenance/compaction.mdx`, so `test_all_doc_links_resolve_in_repo_docs` still holds. Tests: `python -m unittest ci.tests.test_extract_sdk_doc_links` and `cargo test -p lancedb --lib docs::tests::` pass locally. Co-authored-by: Xuanwo <github@xuanwo.io> |
||
|
|
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>
|
||
|
|
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> |
||
|
|
a728692772 |
fix(namespace): create declared-only table on exist_ok create_table (#5329)
`create_table` with `CreateTableMode::ExistOk` treated any successful
`describe_table` as an existing table and tried to open it. A table that
was only declared in the namespace (no data on storage yet) failed with
`TableNotFound ... DatasetNotFound ... _versions`, while `Create` mode
already handles this case.
- Ask `describe_table` for `check_declared`, and only open the table
when `is_only_declared` is not true.
- Otherwise fall through to the normal create path, and handle a declare
conflict for `ExistOk` the same way as for `Create`.
Test: `test_namespace_create_table_exist_ok_after_declare_only` fails on
main with `TableNotFound { name: "declared_only", ... _versions }` and
passes with this change. The existing `exist_ok` tests are unchanged and
pass.
The race between `describe_table` and `declare_table` is unchanged by
this PR.
|