Commit Graph
1734 Commits
Author SHA1 Message Date
LanceDB RobotandXuanwo 17532bb8c3 chore: update lance dependency to v15.1.0-beta.2 (#5217)
Bump the Rust workspace and Java Lance dependencies to [Lance
v15.1.0-beta.2](https://github.com/lance-format/lance/releases/tag/v15.1.0-beta.2)
and pin the matching `pylance` beta in the Python test extra.

Raise the Rust toolchain and minimum supported version to 1.98.0 as
required by Lance, and address the new Clippy diagnostics.

Co-authored-by: Xuanwo <github@xuanwo.io>
2026-11-26 05:39:46 +08:00
Lance Release 8441dab874 Bump version: 0.42.0-beta.30 → 0.42.0-beta.31 2026-11-25 21:32:03 +00:00
LanceDB RobotandXuanwo da6aa8c779 chore: update lance dependency to v15.1.0-beta.1 (#5213)
Update the Rust workspace and Java dependencies to [Lance
v15.1.0-beta.1](https://github.com/lance-format/lance/releases/tag/v15.1.0-beta.1).
Pin the Python test extra to the matching pylance 15.1.0b1 release and
refresh the lockfile.

---------

Co-authored-by: Xuanwo <github@xuanwo.io>
2026-11-25 13:30:32 -08:00
Xuanwo 60519d42ce feat(remote): add presigned direct Blob V2 reads (#5210)
## What

Add a capability-gated client path for large Blob V2 reads over LanceDB
Enterprise:

- A successful `describe` advertises `x-lancedb-blob-locations: 1`; the
SDK then resolves pinned row locations through `POST
/v1/table/{id}/blob_locations/`.
- Whole reads (`fetch_blobs`) and seekable handles (`fetch_blob_files` /
`open_blob_file`) read presigned object-store URLs directly for eligible
values and ranges at or above a provisional internal 10 MiB threshold.
- Small ranges and `fetch_blob_ranges` stay on the existing proxy path,
including aggregate batches whose total exceeds the proxy byte limit.
- Shared `Packed` / `Managed` sidecars translate logical ranges to
physical offsets and validate the full numeric `Content-Range` tuple,
not just its start or total.
- Presigned traffic uses a separate HTTP client with no Enterprise
default headers, so service credentials never reach object storage.
- The first resolver response must carry a valid query-snapshot
identity. That identity is then required on every later partition and
preserved through object-URL refresh, proxy fallback and oversized
whole-value recovery. A resolver `503` falls back once to the proxy path
using any version and identity already pinned; other resolver errors
propagate. Object-store `503`s do not masquerade as resolver
unavailability.
- A read that starts without the capability reuses its supplied
`ReadSnapshot` if a later describe enables direct opening mid-operation.
- Version and query-snapshot pinning, NULL/order alignment and empty
values are preserved.

## Client network requirement

On Enterprise clusters that enable direct Blob reads, large values and
individual ranges may be fetched from short-lived object-store URLs
instead of the LanceDB proxy. Clients then need network access to the
object-store endpoint, including private endpoint routing, DNS, TLS
trust and egress rules, in addition to the LanceDB endpoint. Small reads
stay on the LanceDB proxy.

## Why

Large Blob V2 reads currently stream every payload byte through `Object
Store -> Plan Executor -> Query Node -> client`. That consumes internal
bandwidth, inflates PE/QN memory use and pollutes executor caches with
low-locality `.blob` data. This is the SDK half of ENT-4358; the server
implementation is in Sophon.

## Compatibility

No public SDK signatures change. Old clusters omit the capability header
and keep the existing proxy behaviour with zero extra round trips. The
10 MiB threshold is an internal prototype choice pending the paired
acceptance measurement; it is not a public knob.

## Validation

- `cargo check -p lancedb --quiet --features remote --tests` passes.
- `cargo test -p lancedb --quiet --features remote --lib
remote::table::blobs::tests` passes: 65 tests.
- New coverage includes direct whole reads, shared-sidecar physical
offsets and Content-Range rejection, small-range proxy routing, mixed
large/small range batches, resolver `503` fallback with pinned state, no
second resolver after fallback, object-store `503` not triggering proxy
fallback, missing/mismatched resolver identity rejection, resolver
identity preservation through refresh/proxy/oversized recovery,
supplied-snapshot reuse on mid-operation capability refresh, and
NULL/order/null-preserving paths.

A real-QN acceptance run with the candidate SDK binary is separate and
still pending deployment of the candidate server image.
2026-11-26 03:16:25 +08:00
147fdb25a0 feat(python): add two-phase shuffled reads (2PSR) to elastic dataloader (#5066)
Supersedes #4263, which I can no longer push to. This PR continues the
same branch, so the review history is there.

## Summary

Adds two-phase shuffled reads (2PSR) to `StreamingDataset`, enabled with
`block_size`:

1. **Block shuffle:** contiguous blocks of `block_size` live rows are
shuffled and assigned to splits. This replaces 1-phase's per-row take
with mostly contiguous range scans, which are much cheaper on object
storage.
2. **Bounded row shuffle:** each split shuffles rows over a rolling
window of `window_blocks` blocks. `max_shuffle_distance` bounds how far
a row can move.

The feature also supports `filter` (sparse takes of live rows),
`reshuffle_blocks_per_epoch`, resume and checkpointing, background block
prefetch, and multi-worker DataLoaders. 2PSR stays opt-in:
`block_size=None` keeps today's 1-phase behavior.

Since the last review round:

- **Fixed worker startup with small blocks.** The pickled dataset no
longer grows with the number of blocks; the block order is rebuilt in
`__setstate__`. Once that pickle passed the 64 KiB pipe buffer, spawned
DataLoader workers started one at a time (~280 s with 128 workers at
≤2,048-row blocks).
- **Fixed per-call block copies.** Each loaded block is combined into a
single chunk. Before, `take` on a multi-chunk block concatenated the
whole block on every call.
- **Fixed early eviction.** Blocks are evicted only behind the
contiguous prefix of rows already served. With `io_queue_depth > 1`,
calls can arrive out of order and previously evicted blocks that were
still needed, causing 5–40% extra reads.
- **New default:** `window_blocks` now defaults to 8, and the docstring
recommends `block_size=512` with DataLoader workers.

None of these fixes changes which rows are read or their order. A check
across 12 config, epoch and seed combinations on 8 ranks gave identical
per-rank order before and after.

## Benchmarks

Throughput was measured on EC2 i4i.32xlarge in us-west-2, reading a
FineWeb-Edu table of 4,096 B rows. Each number is the median of 3
trials, and each trial is a full pass. 2PSR used 512-row blocks, 256
splits, 128 workers and `io_queue_depth=4`. 1-phase used 32 splits, 8
workers and `io_queue_depth=32`.

| Storage | Rows | 2PSR | 1-phase | Speedup |
|---|---|---|---|---|
| S3 | 8.4M (34 GB) | 16.9 s | 230 s | 13.6× |
| S3 | 33.6M (137 GB) | 45.6 s | 781 s | 17.1× |
| S3 | 134M (550 GB) | 168 s | 3,098 s | 18.4× |
| Local NVMe | 8.4M | 16.4 s | 116 s | 7.1× |

On the 8.4M-row S3 table, 2PSR reads 1.5–2.0 GB/s at every block size
from 128 to 65,536 rows. A fit across the three S3 sizes gives 2PSR
about 7 s fixed cost plus 3.4 GB/s, and 1-phase about 39 s plus 0.18
GB/s. That puts the large-table limit near 19×.

Quality was measured by pretraining GPT-2 124M on 2^21 FineWeb-Edu docs
for 16 epochs on 8×H100. The table shows final validation loss, mean ±
SD over 3 seeds:

| Reader | Final val loss |
|---|---|
| 1-phase | 2.8464 ± 0.0006 |
| 2PSR, `block_size=128`, msd 4,096 | 2.8457 ± 0.0011 |
| 2PSR, `block_size=512`, msd 4,096 | 2.8457 ± 0.0007 |
| 2PSR, `block_size=2048`, msd 32,768 | 2.8466 ± 0.0009 |
| No shuffle (1 seed) | 2.8606 |

Every 2PSR config is within seed noise of 1-phase. The 95% confidence
intervals of the difference all include zero and are at most 13% of the
no-shuffle penalty. Training throughput was the same for every reader
(3.15–3.18M tok/s, GPU-bound).

## Testing

- `test_elastic_dataloader.py` and `test_permutation.py`: all 324 tests
pass after merging `main`. The new tests cover:
  - pickle size independent of block count;
  - single-chunk blocks;
  - no re-reads under out-of-order calls;
  - window defaults;
  - resume, filter, worker and checkpoint behavior.
- `ruff check` and `ruff format --check` are clean.

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

---------

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
Co-authored-by: Xuanwo <github@xuanwo.io>
2026-11-25 09:08:39 -08:00
Yang Cen 757dcc0a6b feat(functions): declare multiple bindings in one add_columns call (#5202)
Allow Python callers to pass several registered Function applications to
`add_columns`. Rust callers can use `function_bindings` to submit the
same atomic declaration. An application can consume another output in
the mapping, including one declared later.

The SDK checks the Enterprise server's batch-declaration capability
before sending the mutation. Single-binding callers continue to use the
existing request shape. This change covers declaration only.

Coverage includes Python mapping validation, the Rust HTTP request with
dependent bindings, and older servers with missing or unknown capability
values. Correctness tests run in CI.
2026-11-25 13:39:57 +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
LanceDB Robot 73d44232d4 chore: update lance dependency to v15.0.0-beta.35 (#5201)
Bump the Rust Lance crates and Java lance-core to v15.0.0-beta.35, and
pin the Python tests to pylance 15.0.0b35. The Cargo and Python
lockfiles are refreshed for the [Lance
tag](https://github.com/lance-format/lance/tree/v15.0.0-beta.35).
2026-11-24 19:06:43 -08:00
LanceDB Robot 85522224f2 chore: update lance dependency to v15.0.0-beta.34 (#5199)
Updates the Rust and Java Lance dependencies to v15.0.0-beta.34 and pins
the Python test dependency to pylance 15.0.0b34. See the [Lance
release](https://github.com/lance-format/lance/releases/tag/v15.0.0-beta.34).
2026-11-25 08:05:02 +08:00
Tanay fc6dfca11a feat(python): add map() method to Permutation for dict-based transforms (#3264)
### Summary

Adds `Permutation.map(fn, *, batched=False)`, a dict-based alternative
to `with_transform` so users can write `fn(dict) -> dict` without
touching `pyarrow.RecordBatch`.

- `batched=False` (default): `fn` receives one row as a dict and returns
a dict.
- `batched=True`: `fn` receives the batch as `dict[str, list]` and
returns the same shape, with one value per input row.
- `map` calls can be chained. Callbacks run in order and the returned
dict replaces the row, so the next callback only sees what the previous
one returned. Unlike HuggingFace's `Dataset.map`, the output is not
merged into the row.
- A mapped permutation always yields `list[dict]`, whatever `batched`
is, so it works with the default `DataLoader` collate. Rows keep their
position, including duplicate offsets, and `take_offsets([])` returns
`[]`.
- `map` cannot be combined with an explicit `with_format` or
`with_transform`, in either order. Doing so raises `ValueError` when the
chain is built, whether or not the format's optional dependency is
installed.
- `select_columns`, `remove_columns` and `schema` describe the columns
read from the base table, which are the input of the first callback.
- The chain is stored in a module-level callable, so a mapped
permutation can be pickled into `spawn` `DataLoader` workers as long as
the callbacks themselves are picklable.
- `with_transform` remains available for direct Arrow access.

### Documentation

- Docstrings for `map`, `with_format` and `with_transform` cover the
mixing rule, with a `DataLoader` + `collate_fn` example on `map`.
- Adds a "Transforming rows with map" section to the Permutation guide.

### Testing

- `test_permutation.py`: chaining, mixing errors in both orders, output
validation, duplicate and empty offsets, projection and schema, and a
pickle round-trip for both `batched` modes.
- `test_permutation.py`: the mixing check with `polars` unimportable,
with pickles written before the `explicit_transform` flag, and with a
transform passed to the constructor.
- `test_torch.py`: a map chain read through `DataLoader(...,
multiprocessing_context="spawn", num_workers=1)`.

Closes [#3246](https://github.com/lancedb/lancedb/issues/3246)
2026-11-25 06:35:28 +08:00
Xuanwoandsaudademjj 7a8661759d fix(python): skip OpenAI embedding requests when no valid text remains (#5195)
## Summary

Follows up on #4005, which handled mixed batches in
`OpenAIEmbeddings.generate_embeddings`. On `main`, when the input batch
is empty (`[]`) or filtering leaves no valid texts (such as `[None,
""]`), `generate_embeddings` still imports the `openai` SDK and calls
`embeddings.create(input=[], ...)`.

- Return `[None] * len(texts)` early in
`python/python/lancedb/embeddings/openai.py` when no valid texts remain
(`[]` for empty input, one `None` per item when all inputs are
filtered), before importing the `openai` SDK or sending a request.
- Add regression tests in `python/python/tests/test_embeddings.py`
covering empty batches, all-filtered batches, and native-backed
`table.add(..., on_bad_vectors="null")` verifying rows are kept with
null vectors and no OpenAI request is made.

## Attribution

Successor to #3152. The early return and nullable ingestion test were
originally contributed by @saudademjj in #3152.

## Verification

- 3 new regression tests failed before the fix (observing
`embeddings.create(input=[], ...)`) and passed after.
- Related embedding test suite: `148 passed, 1 skipped, 9 deselected`
(mocked client only; no live OpenAI API calls).
- Ruff check and format checks are clean for the changed `python/` tree
(scoped to `python/` only).

Co-authored-by: saudademjj
<128795969+saudademjj@users.noreply.github.com>

Co-authored-by: saudademjj <128795969+saudademjj@users.noreply.github.com>
2026-11-24 23:14:13 +08: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
Xuanwo 5dd54822f4 chore(docs): upgrade mkdocs-material to 9.8.2 and mkdocstrings (#5192)
Supersedes #5179 (which only bumped `mkdocs-material` to `9.7.7` in
`docs/requirements.txt`) by upgrading `mkdocs-material` to `9.8.2`
together with compatible `mkdocstrings` tooling across both the SDK
Pages workflow and the Python `docs` extra, while retaining external
type cross-references.

## Changes

- **`docs/requirements.txt`** (used by `.github/workflows/docs.yml`):
pin `mkdocs-material==9.8.2`, update `mkdocstrings[python]>=1.0.7,<2`
and `mkdocs-autorefs>=1.4`, remove the legacy `griffe>=0.40,<1.0`
constraint so the Python handler selects its compatible Griffe
dependency, and declare `pymdown-extensions>=11.0.1` explicitly (also
required by Material `9.8.2` and loaded directly by the site's Markdown
extensions).
- **`python/pyproject.toml` & `python/uv.lock`**: raise the `docs` extra
floors to `mkdocs-material>=9.8.2` and `mkdocstrings[python]>=1.0.7,<2`.
Only `mkdocs-material` (`9.7.6` -> `9.8.2`) and `mkdocstrings` (`1.0.4`
-> `1.0.7`) change in `python/uv.lock` (lock revision 3 preserved; other
extras unchanged).
- **`docs/mkdocs.yml`**: switch the `mkdocstrings` Python handler key
from `import` to `inventories` so external type links remain active with
`mkdocstrings-python` 2.x, and update the Pydantic inventory URL to the
canonical `https://pydantic.dev/docs/validation/latest/objects.inv`.

## Verification

- **SDK Pages workflow path (CPython 3.11.18)**: ran both `pip install`
steps from `.github/workflows/docs.yml` (resolving `mkdocs-material
9.8.2`, `mkdocstrings 1.0.8`, `mkdocstrings-python 2.0.11`,
`mkdocs-autorefs 1.4.5`, `griffelib 2.4.1`, `pymdown-extensions
13.1.2`), verified `python -m pip check`, and ran `PYTHONPATH=. mkdocs
build` from `docs/` (exit 0 in 9.65s).
- **Rendered HTML and links check**: inspected
`docs/site/python/python/index.html` (188 API directive headings, 1,881
rendered signatures, 2,121 highlighted blocks). Verified internal
cross-references for representative sync/async APIs and indices
(`lancedb.connect`, `lancedb.connect_async`,
`lancedb.table.Table.search`, `lancedb.table.AsyncTable.search`,
`lancedb.query.BooleanQuery`, `lancedb.schema.blob_array`,
`lancedb.index.FTS`), rendering of `lancedb.rerankers.TypeSafeReranker`,
and external inventory links in the generated HTML (193 Arrow links
including `pyarrow.Table`, 40 Pydantic links including
`pydantic.BaseModel`; all three configured inventories—Arrow, Pandas,
and Pydantic—loaded cleanly).
- **Locked Python `docs` extra (CPython 3.11.18)**: verified `uv lock
--check --python 3.11` and built docs in a separate `uv sync --locked
--no-install-project --extra docs` environment (`mkdocs-material 9.8.2`,
`mkdocstrings 1.0.7`, `mkdocstrings-python 2.0.5`, `pymdown-extensions
11.0.1`) with the Swagger and redirects plugins added; `uv pip check`,
`PYTHONPATH=. mkdocs build`, and the HTML API/external link checks
passed (188 headings, 1,880 signatures, 2,120 highlighted blocks, 197
Arrow and 40 Pydantic external links).
- **Warnings**: the build is not warning-free; both `mkdocs build` runs
exit 0 with pre-existing `mkdocs_autorefs` warnings for duplicate
TypeScript `list` anchors and several unresolved Python docstring
cross-references (and `uv lock --check` still reports the pre-existing
yanked-version warning for `charset-normalizer==3.4.8`).
2026-11-24 21:12:20 +08:00
Xuanwo 726a6f77a5 feat(embeddings): support Cohere v2 endpoints for Foundry text retrieval (#5193)
Continues #2519 (originally contributed by @1jamesthompson1) to address
#2518 for text retrieval with Cohere Embed models deployed on Azure AI
Foundry.

## Summary

Adds an opt-in native Cohere Embed API v2 (`ClientV2`) path to the
existing `cohere` embedding registry entry (`CohereEmbeddingFunction`)
for text-only retrieval against custom endpoints such as Azure AI
Foundry (`https://<resource>.services.ai.azure.com/providers/cohere`,
where the Cohere SDK appends `/v2/embed`).

### Behavior and Defaults

- **Opt-in v2 route (`base_url`)**: When `base_url` is set, requests use
`cohere.ClientV2` (`POST <base_url>/v2/embed`) with
`embedding_types=["float"]`, split inputs into batches of up to 96
texts, disable SDK-level retries, and validate returned vector counts
and dimensions. Application retries use `retry_with_exponential_backoff`
in `embeddings/utils.py`, which adds an optional `do_not_retry`
predicate used only by Cohere v2 so `3xx` redirects fail immediately
without backoff while transient failures such as `429` retry only the
failed batch. Non-string inputs are rejected; this change covers text
retrieval only.
- **Fixed retrieval roles**: In `base_url` mode, document embeddings use
`search_document` and query embeddings use `search_query`. Setting other
`source_input_type` or `query_input_type` values is rejected.
- **Explicit endpoint parameters**: Setting `base_url` requires explicit
`name` (the deployed model name), `output_dimension` (`> 0`, used for
both the Arrow vector column width and the v2 request
`output_dimension`), and `api_key`. Setting `output_dimension` or
`api_key` without `base_url` is rejected.
- **Unchanged hosted path**: When `base_url` is omitted, existing
behavior is preserved — `cohere.Client` (`/v1/embed`), `COHERE_API_KEY`,
existing default model/role settings, legacy table metadata restoration,
and the existing `cohere>=4.0` package floor.
- **Runtime SDK requirement**: Opting into `base_url` checks
`cohere>=5.15.0` at runtime and raises an `ImportError` on older SDK
versions without raising the minimum requirement for hosted users.

### Credentials and Endpoint Trust

- `api_key` is declared in `sensitive_keys()` and must be a registry
`$var:` reference without an inline fallback default (`$var:<name>`
only). Table metadata persists only the variable reference.
- `base_url` must be an HTTP(S) URL without embedded credentials, query
strings, or fragments, and is exposed through `endpoints()` so reopening
a table in a new process requires explicit approval via
`registry.allow_endpoint(...)`.
- `ClientV2` is cached per embedding function instance
(`@cached_property`) with `httpx.Client(follow_redirects=False,
timeout=300)` so redirects cannot forward requests or credentials off
the approved endpoint. Because Cohere v2 classifies `3xx` responses as
non-retryable via `do_not_retry`, a redirected `table.add` or
`table.search` call makes one `POST` with zero application backoff and
no request to the `Location` target (`table.add` surfaces the `307`
inside the existing Arrow/Rust `RuntimeError` wrapper; `table.search`
surfaces the Cohere `ApiError`).

## Verification

- **Loopback HTTP SDK tests (`test_cohere_embeddings.py`)**: Passed
against local loopback HTTP fixtures with real Cohere SDK `5.15.0`
(opt-in minimum), `7.0.5`, and `7.3.2`. Verified exact
`/providers/cohere/v2/embed` path, bearer auth header, JSON payload,
256-dim vector schema, `table.add`/reopen, fresh-process
`UntrustedEmbeddingConfigError` followed by `allow_endpoint(...)`,
deterministic role-based ranking, 96-text batching with
failed-batch-only `429` retry (single backoff), `307` redirect handling
with retries enabled on both `table.add` (wrapped in Arrow/Rust
`RuntimeError`) and `table.search` (Cohere `ApiError`) with one `POST`,
zero application backoff, and no `Location` request, plus invalid
input/dimension rejection.
- **Adjacent embedding, retry, and trust suites (`cohere==7.3.2`)**:
Passed across embedding, registry, trust (including the SDK-independent
Cohere metadata restoration and endpoint authorization test in
`test_embeddings_trust.py`), field metadata, NVIDIA embedding, and retry
suites (OpenAI-key test skipped without a key).
- **No-`cohere` environment**: Cohere config/legacy unit tests and
SDK-independent `test_embeddings_trust.py` metadata restoration and
endpoint authorization tests passed without `cohere` installed (real-SDK
loopback tests skipped).
- **Legacy SDK (`cohere==4.57`)**: Loopback wire check confirmed hosted
document/query requests continue targeting `/v1/embed` and opt-in
`base_url` usage raises `Cohere base_url requires cohere>=5.15.0`.
- **Docs & lint**: Offline Foundry schema test
(`test_embedding_cohere_foundry`), byte-identical regenerated snippet
(`docs/web/snippets/integrations.mdx`), and `python/` Ruff format/lint
checks passed.

### Scope of Verification

All HTTP request, authentication, redirect, trust, and ranking checks
were exercised against local loopback HTTP fixtures modeled on [Cohere's
Azure Foundry
workshop](https://github.com/cohere-ai/cohere-azure-workshops/tree/ca1c4cb162e2/lab-1-embed)
and the [Cohere Embed v2 API
reference](https://docs.cohere.com/v2/reference/embed). Acceptance
against a live Azure AI Foundry service (real Foundry credentials and
specific `output_dimension` overrides) has not been verified.
2026-11-24 20:20:18 +08:00
Xuanwo d605943e9b feat(python): add Bedrock image embeddings (#5190)
Continues #2320. Thank you @qingyuan18 for starting this work!

## Summary

Adds the `bedrock-image` (`BedrockImage`) embedding function for AWS
Bedrock image embeddings, exports it from `lancedb.embeddings`, updates
the AWS Bedrock docs, and extracts shared Bedrock runtime client setup
into `_BedrockEmbeddingFunction`.

- **Models**:
- `amazon.titan-embed-image-v1` (default, 1024 dims): PNG and JPEG
source images.
- `cohere.embed-v4:0` (1536 dims): PNG, JPEG, WebP, and GIF source
images (`search_document` for ingestion, `search_query` for queries).
Cohere v3 models remain text-only under `bedrock-text`.
- **Input & search**: Source columns accept encoded image `bytes` or
local file paths (`str`), with format detected from decoded bytes via
Pillow and `None` entries yielding `None` embeddings. Queries accept
text (`str`) or `PIL.Image.Image` (converted to RGB PNG);
`AsyncTable.search` requires `query_type="vector"` for Pillow image
queries.
- **Credentials**: `bedrock-image` uses `boto3.Session()`'s default
credential chain (e.g., `AWS_PROFILE` or the application's IAM role) and
rejects `profile_name`, `assumed_role`, and `role_session_name` on both
`create()` and metadata restore. `bedrock-text` retains its released
`profile_name`, `assumed_role`, and `role_session_name` settings.

## Validation

- Local Python tests cover the public `get_registry()` API, Arrow table
creation and ingestion (`bytes` and local path sources), table reopen
from persisted Arrow metadata, sync text and `PIL.Image` search, async
`query_type="vector"` `PIL.Image` search, credential-option rejection on
`bedrock-image` create/restore, and `bedrock-text` credential-setting
restoration and Cohere v3 text requests.
- SDK requests and payloads were validated at the `boto3`/`botocore`
`bedrock-runtime` client boundary using `botocore.stub.Stubber`. No live
AWS Bedrock service calls were run, so live IAM/STS credential
resolution, region model availability, and Bedrock service-side
validation are not covered.
2026-11-24 20:12:04 +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
LanceDB RobotandBubbleCal c960c6f7ec chore: update lance dependency to v15.0.0-beta.32 (#5188)
Update the Rust workspace and Java lance-core to Lance v15.0.0-beta.32,
and pin the Python test extra to pylance 15.0.0b32. Refresh both
lockfiles for the [Lance
release](https://github.com/lance-format/lance/releases/tag/v15.0.0-beta.32).

The Java artifact finished publishing after the first CI attempt. On
commit `75d11726c`, the Java 11 and Java 17 runners each downloaded the
241 MB `lance-core-15.0.0-beta.32.jar` from the Lance Maven repository
and passed all 37 tests. [Java 11
build](https://github.com/lancedb/lancedb/actions/runs/45372396192/job/138372148863)
· [Java 17
build](https://github.com/lancedb/lancedb/actions/runs/45372396192/job/138372148496)

Co-authored-by: BubbleCal <bubble-cal@outlook.com>
2026-11-24 19:45:16 +08:00
Lance Release abe829f4a3 Bump version: 0.42.0-beta.27 → 0.42.0-beta.28 2026-11-24 09:20:21 +00:00
Yang Cen c568f150c9 perf(query): avoid opening vector indexes during cosine ANN planning (#5186)
Planning a cosine ANN query opens each distinct index segment to
determine its distance scale. Opening the index loads centroids and
quantizer data even though the planner only needs the physical index
type.

Use Lance's batch physical-type lookup for the segment UUIDs in each ANN
plan. The planner uses those types to select the existing distance
conversion. Query execution still searches the selected segments. The
lookup ships in [Lance
v15.0.0-beta.31](https://github.com/lance-format/lance/releases/tag/v15.0.0-beta.31).
This PR updates the Rust and Java dependencies and the Python test pin
to that release.

The regression test creates an IVF_RQ index, removes its auxiliary
quantizer file, reopens the table in a fresh session, and verifies that
a cosine ANN plan can still be built. Existing tests cover modern and
legacy PQ scores and ordering across mixed tiers.
2026-11-24 17:19:10 +08:00
Lance Release f6bb017535 Bump version: 0.42.0-beta.26 → 0.42.0-beta.27 2026-11-24 07:13:40 +00:00
LanceDB RobotandXuanwo f800758117 chore: update lance dependency to v15.0.0-beta.29 (#5180)
Update the Rust and Java Lance dependencies to v15.0.0-beta.29 and pin
the Python test extra to pylance 15.0.0b29. The Python lockfile includes
all seven published wheels for the [Lance
release](https://github.com/lance-format/lance/releases/tag/v15.0.0-beta.29).

Co-authored-by: Xuanwo <github@xuanwo.io>
2026-11-24 15:11:43 +08:00
Jack Ye df1d3318df feat: add Azure storage account access key support to SDKs (#5177)
Add `azure_storage_account_access_key_secret` to the sync and async
Python storage integration APIs, with a matching Rust constructor. The
SDK sends a Secret reference in SQL and decodes the reference returned
by CREATE and DESCRIBE.

```python
info = db.create_storage_integration(
    "blobs", "az://customer-data/raw/",
    storage_provider="AZURE",
    azure_storage_account="customeraccount",
    azure_storage_account_access_key_secret="azure_key",
)
```

Azure requires a storage account and one authentication mode. The
account access key uses a single Secret. Service principal
authentication uses the existing three Secret references.
2026-11-23 22:49:41 -08:00
Xuanwo a6cca1efb0 feat(python)!: declare streaming Blob outputs for Functions (#5171)
BREAKING CHANGE: Rust callers constructing
`lancedb::function::FunctionOutput` with a struct literal now supply
`blob_writer_paths`. Use `Vec::new()` for an output without
writer-capable fields.

LanceDB Functions that generate large Blob v2 values can declare their
output with `BlobWriter` and write chunks during a computed column
refresh in a compatible LanceDB Enterprise environment. Row-wise and
vectorized callables use the same logical Blob schema. Named and nested
outputs can mark specific leaves with `BlobWriter.field` while retaining
ordinary binary siblings and nullable fields.

The SDK preserves writer requirements through native registration and
computed column binding. A distinct output kind lets earlier Enterprise
versions reject registrations that require a writer. Existing bytes-only
registrations retain their wire format and adapter.

On SDK commit
[`a19e7b87`](https://github.com/lancedb/lancedb/commit/a19e7b873c36aec865f092a368760be8846233ed),
a rebuilt extension preserved nested writer paths through Flight SQL
registration and version readback. Enterprise 1.14.1 rejected the writer
registration before building the Function image. With the compatible
runtime candidate, a real Flight SQL refresh published a 2 GiB + 137
byte value in each Blob layout against Moto. Independent reads verified
length and SHA-256 before and after cleanup of an older version. The run
also confirmed multipart abort and cumulative descriptor accounting.
[Runtime
evidence](https://linear.app/lancedb/issue/ENT-4209#comment-26e69e0e-faad-4aac-b148-3f4591181182)
· [Descriptor
accounting](https://linear.app/lancedb/issue/ENT-4209#comment-4d05e27a-8ff2-4003-804a-8af2f29ce2f4)

This SDK change is part of the coordinated Enterprise delivery.
[ENT-4209](https://linear.app/lancedb/issue/ENT-4209)
2026-11-24 13:53:06 +08:00
52209f10c3 chore!: drop Python 3.10 support (#5172)
Closes #5106.

Python 3.10 reached end of life on 2026-10-01. This raises the minimum
to 3.11, following #2955 for 3.9. It's marked `chore!:` because it's a
breaking change for 3.10 users.

- `python/pyproject.toml`: `requires-python = ">=3.11"`, and the 3.10
classifier is removed. The `pillow` lower bound in the `clip`, `siglip`
and `embeddings` extras goes up to `>=13.0.0`, the release with the CVE
fixes, which needs 3.11+. The `typing-extensions; python_version <
"3.11"` dev dependency is removed, since it no longer applies.
- `python/Cargo.toml`: pyo3 `abi3-py310` becomes `abi3-py311`, so wheels
are built as `cp311-abi3`.
- `python/lancedb/query.py`: `Self` comes from `typing`, without the
`typing_extensions` fallback.
- CI: the Linux test matrix goes from `["10", "13"]` to `["11", "13"]`,
and the minimum-dependencies job, the release build (`pypi-publish.yml`)
and the docs build move from 3.10 to 3.11.
- `python/uv.lock`: regenerated with `uv lock --extra-index-url
https://pypi.fury.io/lance-format/`. The only changes are the 3.10-only
resolutions going away: all 74 `python_full_version < '3.11'` markers,
`async-timeout`, `backports-asyncio-runner`, `exceptiongroup`, `tomli`,
and the older numpy, scipy, pandas, pyarrow and pillow pins. No package
version changes for 3.11+.

Checks run locally: `ruff check` and `ruff format --check` pass, and
`cargo metadata` succeeds for the workspace. I haven't run the Python
test suite, which needs the native build, so I'm relying on CI for that.

pylance still declares `>=3.10`. As the issue says, lancedb can move
first because pylance is optional.


![Evidence](https://raw.githubusercontent.com/rahulsjha/lancedb/pr-assets/lance5106-evidence.png)

---------

Co-authored-by: Will Jones <willjones127@gmail.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 17:30:18 -08:00
Lance Release de81c35ba0 Bump version: 0.42.0-beta.25 → 0.42.0-beta.26 2026-11-23 06:14:22 +00:00
Lance Release b5ec7d6af4 Bump version: 0.42.0-beta.24 → 0.42.0-beta.25 2026-11-23 02:50:01 +00:00
LanceDB Robot e3a55690e8 chore: update lance dependency to v15.0.0-beta.28 (#5163)
Updates the Rust workspace and Java dependencies to [Lance
v15.0.0-beta.28](https://github.com/lance-format/lance/releases/tag/v15.0.0-beta.28).
Pins the Python test extra to pylance 15.0.0b28 and refreshes its
lockfile.
2026-11-23 10:47:17 +08:00
Lance Release f38d42e9db Bump version: 0.42.0-beta.23 → 0.42.0-beta.24 2026-11-22 21:22:21 +00:00
Lance Release b654cd42ae Bump version: 0.42.0-beta.22 → 0.42.0-beta.23 2026-11-22 18:55:29 +00:00
LanceDB Robot b37de4edfe chore: update lance dependency to v15.0.0-beta.27 (#5159)
Update the Rust workspace Lance crates and Java `lance-core` to
`15.0.0-beta.27` and pin the Python test extra to `pylance==15.0.0b27`.
The Python lockfile includes the published wheels for the new version.

[Lance v15.0.0-beta.27
release](https://github.com/lance-format/lance/releases/tag/v15.0.0-beta.27)
2026-11-23 02:53:53 +08:00
Lance Release 21f074cb02 Bump version: 0.42.0-beta.21 → 0.42.0-beta.22 2026-11-22 14:27:15 +00:00
LanceDB RobotandXuanwo a09cd6fb8c chore: update lance dependency to v15.0.0-beta.26 (#5157)
Update the Rust, Java, and Python dependencies to [Lance
v15.0.0-beta.26](https://github.com/lance-format/lance/releases/tag/v15.0.0-beta.26).
Align the transitive Jieba macro version with Lance’s lockfile and fix
the Clippy diagnostics exposed by workspace validation.

Co-authored-by: Xuanwo <github@xuanwo.io>
2026-11-22 22:25:33 +08:00
Yang Cen d9b49e8889 feat: report capacity waits in function refresh job status (#5154)
An Enterprise Function refresh can spend time waiting for execution
workers. Applications polling `job.status()` currently see `running`
during that wait. Return `waiting_for_capacity` when the server reports
that phase for an active Function refresh. The next status request
reports `running` when execution resumes. Applications can use
`job.wait()` to wait through both states until completion.

Rust, Python and Node read the phase from the existing job description
response.

## Validation

Two HTTP regression tests exercise the public job handle. They cover the
wait, work resuming, completion after another wait, a stale phase at
completion, queued and paused refreshes, other job types, and servers
that omit the phase. The Rust CI remote job runs these tests.
2026-11-22 16:00:50 +08:00
Yang Cen 08ddcdb7d7 feat: resume a failed Function refresh from its table (#5153)
LanceDB Enterprise users can resume a failed Function refresh from its
table with `table.resume_refresh(job_id)`. The synchronous and
asynchronous Python APIs return a typed job handle. Waiting on that
handle uses the same table freshness tracking as a newly submitted
refresh.

The request carries the current table identifier and branch to the
server. The server decides whether the original attempt can be resumed
and supplies the reason when it cannot. The Python refresh methods also
accept a positive `max_job_attempts` option for automatic recovery.
These features require server support for Function refresh recovery.

The PR adds remote request, branch, error propagation, and typed result
tests. Python and Rust validation runs in PR CI.
2026-11-22 15:40:22 +08:00
Jack Ye 2b1b2a29dd feat!: layer GPU settings and total execution limits (#5146)
BREAKING CHANGE: Resource inputs use the same names at Function
registration, column/MV creation, and refresh. Use total_cpu_millis,
total_memory_bytes, and total_gpu_count for execution-wide worker
budgets, plus gpu_class and positive gpu_count for each worker. Replace
budget dictionary inputs and unprefixed aggregate limits with these
fields. Move existing refresh gpu_count caps to total_gpu_count;
gpu_count now selects devices per worker.

Each setting resolves independently: refresh > column/MV creation >
Function annotation > deployment. Creation settings also apply to
initial MV population and automatic refresh. MVs sum total budgets
across distinct pinned Function versions; per-worker GPU counts use the
largest Function default unless overridden. An unset GPU class resolves
to gpu_class="any" after inheritance; an explicit "any" overrides a
registered concrete class. Use gpu_class="default" to pin the default
pool explicitly.

```python
@function(
    gpu=True, gpu_class="h100", gpu_count=2,
    total_cpu_millis=8000,
    total_memory_bytes=16 * 1024**3,
    total_gpu_count=4,
)
def embed(text: str) -> list[float]: ...

version = db.create_function(embed)
table.add_columns(
    {"embedding": version(text=col("text"))},
    gpu_class="any", gpu_count=1, total_gpu_count=8,
)
table.refresh_column_async(
    "embedding", gpu_class="h100", gpu_count=4, total_gpu_count=8,
)

mv = db.create_materialized_view(
    "embeddings", query="SELECT embed(text) AS embedding FROM documents",
    gpu_class="any", gpu_count=2, total_gpu_count=8,
)
mv.refresh(gpu_count=4, total_gpu_count=8)
```

```mermaid
flowchart TD
    R["Refresh settings"] --> E["Effective settings, resolved per field"]
    D["Column or MV creation settings"] --> E
    F["Function settings"] --> E
    C["Deployment defaults"] --> E
    E --> W["GPU class and device count per worker"]
    E --> T["Total CPU, memory and GPU ceilings"]
```

Pinned Function images retain their identity. Registration GPU counts
are defaults; execution overrides determine worker allocation. Admission
rejects GPU counts below an image's minimum requirement or above the
total budget. Python, Rust, SQL/REST and supported TypeScript operations
use the same resource model.

No local builds or tests, as requested; regression coverage runs in CI.
2026-11-21 15:04:34 -08:00
Jack Ye e3e55844bc fix: add SQL query timeout and cancellation controls
Add per-query SQL deadlines, read timeouts, and drop cancellation controls for Rust and Python.
2026-11-21 14:35:04 -08:00
Xuanwo 564f8f93d4 test(python): cover embedded plans over enterprise bases (#5150)
## Summary

Clarify in the persistence guide and `persist` docstring that only the
plan destination must be Embedded. The base table can be Embedded or
Enterprise; an Enterprise base is pinned through the plan's recorded
base branch/version.

Add a focused loopback regression that persists a plan from a mock
remote base into an Embedded database, reopens the plan by destination
with `db.open_table`, advances the mock base's latest version to v2, and
verifies a fresh remote handle observes v2 while `Permutation` still
reads the plan's recorded main/v1 coordinates. Sequential iteration and
duplicate/unsorted offsets follow the stored plan order, and the mock
records nonempty v1 scan/gather requests.

## Verification

- Focused test plus affected remote mock tests: 3 passed.
- `ruff format --check` and `ruff check` passed.
- `git diff --check` passed.

This is a docs/test-only follow-up. It does not add Enterprise-resident
plan persistence or change plan ordering.
2026-11-21 17:09:53 +08:00
Lance Release b35cce60d6 Bump version: 0.42.0-beta.20 → 0.42.0-beta.21 2026-11-21 08:53:41 +00:00
Jack Ye 0511aed6e9 feat: profile Enterprise Function workers from official clients 2026-11-21 00:51:08 -08:00
Jack Ye 49dedd4329 fix: expose Function metadata in SDK job listings (#5096)
Expose affected columns, pinned Function name/version, completion time,
duration and failure summaries on `JobInfo` in the Rust, Python and
TypeScript SDKs. Values come from the listing response, so callers can
inspect recent computed column refreshes without opening every job.
Older servers keep optional values absent; measured zero durations stay
zero.

```python
latest = next((info for info in db.list_jobs(table="events", job_type="function_refresh") if "embedding" in info.columns), None)
if latest is not None:
    print(latest.function_name, latest.function_version, latest.duration_millis)
    if latest.failure is not None:
        print(latest.failure.message)
```

Duration is creation-to-completion wall time, including queueing and
pauses. Adds listing response coverage across SDKs and documents the
metadata contract, including SQL `SHOW JOBS EXTENDED` for the expanded
listing. Plain `SHOW JOBS` preserves its original columns. Local builds
and tests were skipped as requested.

The dependency advisory check also fails on current main because
`libsais-rs 0.2.0` is yanked ([main
job](https://github.com/lancedb/lancedb/actions/runs/44470513618/job/135378545456));
this PR does not change dependencies.

This changes the public shape of Rust and TypeScript `JobInfo`: callers
constructing summaries must supply the added fields (including
TypeScript `columns`). TypeScript table filtering remains a separate
concern; the guide now shows its client-side selection and namespace
limitation alongside Python and Rust server-side filters.

Refs ENT-3903.
2026-11-21 00:18:29 -08:00
Jack Ye b44807e4db fix!: preserve job attempt lineage, retries, and lifecycle states
BREAKING CHANGE: JobDescription, JobEventsRequest, FunctionErrorsRequest, and FunctionErrors gain optional Rust metadata/cursor fields. Existing struct literals must initialize them; use None when unavailable.

Preserve typed attempt state, pinned retry lineage, result decoders and freshness fences, and retained diagnostic paging across SDKs. Keep Python job data access method-only.
2026-11-20 20:35:59 -08:00
Jack Ye bfb55c72e9 feat(python)!: make job data access method-only (#5095)
Make all Python `Job` and `AsyncJob` data access method-only. Cached
property accessors are private and underscore-prefixed; public reads use
`id()`, `state()`, `job_type()`, `creation_ms()`, `spec()`, `result()`
and `failure()`. `checkout_latest()` refreshes the complete cached
registry record in place and returns `None`.

```python
job.checkout_latest()
print(job.state(), job.result(), job.failure())
print(job.id(), job.job_type(), job.creation_ms(), job.spec())
```

Cached read methods are synchronous on both handle types. Async handles
use `await job.checkout_latest()` for the live refresh; event history
remains a separate request through `events()`. Update Python SDK
callers, tests and guides to use method calls, including
progress/timeout handling and bounded repr. Cover method-only visibility
and holistic snapshot freshness through both sync and async clients.

BREAKING CHANGE: Python job data access now requires method calls, such
as `job.state()` instead of `job.state`. No property compatibility
aliases remain.

Fixes
https://linear.app/lancedb/issue/ENT-3902/sdk-make-cached-versus-live-job-accessors-unambiguous
2026-11-20 17:37:12 -08:00
Xuanwo 8dc03bd288 feat: add table.delta for version-to-version row changes (#5135)
Adds native `Table::delta(from_version, to_version=None)` and Python
sync/async `table.delta(...)` for version-to-version row changes.
`TableDelta` exposes streaming `inserted_rows()`, `updated_rows()`,
`upserted_rows()`, `deleted_row_ids()`, and `list_transactions()`.

Endpoints are resolved once on independent dataset handles.
`to_version=None` uses the table handle's visible snapshot, and the
handle's checkout is not changed. Only versions `>= 1` and tags on the
current branch are accepted; cross-branch tags, reversed ranges, version
0, and missing endpoints are rejected. Equal valid endpoints return
empty readers with the same schemas.

Row-level readers require stable row ids at both endpoints and report
the `storage_options={"new_table_enable_stable_row_ids": "true"}`
creation guidance when they are absent. `list_transactions()` does not
require stable row ids.

Row-level readers also fail closed when the range contains a `Restore`,
or when transaction history cannot prove the range is restore-free,
because restored rows can retain older row-version metadata that the
delta readers omit. The error directs consumers to a full rescan and
reinitializing the checkpoint at the range end version.
`list_transactions()` remains available for readable history. The
Versioning guide includes Python and Rust checkpoint-delta examples with
stable-row-ID setup and this Embedded limitation.

Embedded `branches.diff()` remains a separate API.

Refs OSS-2860
2026-11-21 06:41:38 +08:00
Bruno Ramirez baea02eebd feat: add cleanup jobs and previews across SDKs (#5107)
LanceDB SDK users connected to Enterprise had no explicit API to submit
durable cleanup or preview its work; Python's existing cleanup helper
remained a warning-only no-op. This PR adds the SDK support for
[ENT-2687](https://linear.app/lancedb/issue/ENT-2687) through public SQL
and Job APIs. It requires a compatible Enterprise release supporting
`VACUUM`, JSON preview and result format version 1. Existing
cleanup/optimize helpers retain their behavior; the new APIs reject
Embedded and historical-version handles.

This was accomplished with the following changes:

- Add `cleanup_async()` / `cleanupAsync()` and `explain_cleanup()` /
`explainCleanup()` in Python sync/async, TypeScript and Rust.
- Preserve the handle's namespace/branch and resolve retention as
invocation → table/branch TTL → deployment default. Omission inherits,
zero is explicit, and malformed options fail rather than being
discarded.
- Require one nonempty durable SQL receipt, preserving diagnostics
without REST fallback, query-ID substitution or automatic resubmission
after ambiguous acceptance.
- Add versioned `CleanupPlan` estimates and `CleanupResult`
measurements. Preview creates no cleanup job or reservation; results
preserve known zero, unknown retry/recovery totals and nonfatal failed
deletes, excluding auxiliary sweeps.
- Retain typed results on reopening and reuse shared
status/progress/events/wait/cancel APIs. Timeout leaves work running;
cancellation cannot undo deletion or prove storage I/O stopped.
- Document Ownership/parent Usage and required coordination at every
retention value: disable/drain automatic cleanup and prevent competing
cleanup, tag creation/update, branch creation and restore across all
clients until completion. The server does not enforce exclusion;
concurrent restore can leave the current table unreadable.
- Update Python's legacy no-op warning and the maintenance, Python, Rust
and generated TypeScript references.

| Interface | Submit with seven-day retention |
| --- | --- |
| SQL | `VACUUM events WITH (min_age_seconds = 604800);` |
| CLI | `lancedb admin table cleanup --table events --min-age-seconds
604800 --wait` |
| Python | `job = table.cleanup_async(min_age_seconds=604800)` (use
`await` with AsyncTable) |
| TypeScript | `const job = await table.cleanupAsync({ minAgeSeconds:
604800 });` |
| Rust | `let job =
table.cleanup_async(CleanupOptions::new().min_age_seconds(604800)).await?;`
|

### Testing

Added submission/preview, validation, typed-result and reopening tests,
and updated the legacy no-op warning assertion. Focused Python
cleanup/Job and compaction/prewarm regressions passed, alongside **34
TypeScript** and **46 Rust** tests. **31 end-to-end scenarios** passed
against a real Enterprise server, covering CLI/SQL/REST/SDK submission,
retention precedence, restart/reopening, timeouts, cancellation and
branch/namespace isolation.

Local native SDK validation used a separate `libsais-rs 0.2.0` lockfile
because the registry could not resolve `0.2.4`; this PR retains main's
dependency pins and lockfile.
2026-11-20 14:34:07 -08:00
Xuanwo 8fd1c716d9 feat(python): persist permutation plans and reopen pinned snapshots (#5137)
## Summary

Add `permutation_builder(base).persist(db, table_name, *,
namespace_path=None, mode="create").execute()` for embedded local and
object-store destinations. The native create request carries the
namespace and create/overwrite mode, with no drop-before-create. The
returned table keeps the destination connection context so it can be
pickled and reopened directly, including namespaced and manifest-enabled
connections.

Persisted plans pickle by reference to their own branch and version, so
a later overwrite or cross-branch checkout does not change what an
existing pickle reads. In-memory plans, old serialized state, and
shallow copies keep their existing behavior. `Permutation.base_version`
and `base_branch` expose the recorded base snapshot from loaded
metadata. Enterprise destinations remain rejected in v1 because
reproducible remote plan ordering is follow-up work.

## Verification

- `test_permutation.py`: 93 passed.
- `test_torch.py`: 23 passed in a compatible torch 2.15 / NumPy 2.2 /
PyArrow 26 environment using the abi3 extension.
- S3 direct-result persistence/pickle test passed against a disposable
loopback Moto server using the existing fixture's fake keys and explicit
storage options.
- Earlier targeted checks predate the live snapshot pin repair: Rust
builder tests 12 passed; Rust check/clippy and Node type-check passed.
- The live snapshot pin repair added private PyO3 glue and was verified
with a rebuilt extension: `test_permutation.py` 93 passed,
`test_torch.py` 23 passed, and one loopback S3 direct-result test
passed.
- `ruff format --check`, `ruff check`, `pyright`, `git diff --check`:
passed.
2026-11-21 06:27:27 +08:00
Xuanwo 8b8778938f perf(python): stream plain sync batches on demand (#5143)
## Problem

Synchronous local `table.search().to_batches()` creates one Python
future per batch through the background event loop. At the default
1024-row cap, a large scan pays that Python round trip thousands of
times even though the Rust stream can produce the next batch
immediately.

## Change

Use a pull-driven synchronous reader for native, non-namespace, ordinary
lazy plain scans. The query is executed once with the same
`QueryExecutionOptions` as the async path: `None` keeps the 1024-row
cap, `0` leaves sizing to the engine, and a positive value caps each
returned batch. Each `__next__` releases the GIL, waits for exactly one
batch from the same Rust stream through the reviewed
`block_on_interruptible`, and stores the stream back on success.

- No background producer and no Python `LOOP.run` per batch.
- A read error, interrupt, EOF, or the last owner drops the stream. A
normal early `break` can resume the same reader.
- The public `pa.RecordBatchReader` still comes from `from_batches`, so
the schema, Arrow capsule, and exception types stay unchanged. Existing
PyArrow `close()` behavior is unchanged; the known PyArrow close issue
is separately scoped.
- Routing is limited to native, non-namespace, lazy plain scans. Vector,
take, FTS/hybrid, remote, namespace, `to_arrow` direct eager routes, and
Blob `bytes`/`descriptions` keep their existing paths. Take ordering
from #5140 remains on the take path.
- Forward explicit `scan_in_order` through the pull launch; base-only
ordered `to_batches` results and the incompatible `order_by`/fragment
behavior are included in the scan-order suite.
- Adds a public RTE `to_batches` regression: the default LSM route sees
pending memtable writes, while `use_rte(False)` remains base-only.

## Validation

- `test_sync_pull_reader.py`, `test_merge_insert_lsm.py`, and
`test_sync_query_direct.py`: 53 passed.
- `test_query.py`, `test_blob.py`, and
`test_blob_query_without_pylance.py`: 539 passed, 1 skipped.
- `test_table.py`: 552 passed, 17 skipped.
- `test_remote_db.py -k "to_batches or take"`: 16 passed.
- `test_background_loop.py`: 4 passed.
- Rust `cargo test --manifest-path python/Cargo.toml --lib sync_stream`:
5 passed.
- `cargo check -j 1 --manifest-path python/Cargo.toml --lib --tests`
passed; no full Rust doctests were run.

A matched same-base release-with-debug streaming comparison is a
follow-up and is not claimed here.

Tracking: [OSS-2865](https://linear.app/lancedb/issue/OSS-2865)
2026-11-21 06:25:05 +08:00
Xuanwo 87262842e0 docs(function): document GPU row deadline guidance (#5144)
Enterprise GPU Functions on 1.13.0 through 1.14.1 and on 1.15.0 builds
before the shared 300-second default was restored reject a refresh
without an explicit positive `row_timeout_seconds`.

The GPU authoring example and the `@function`/`@udf` docstrings now
carry the requirement, the definition/request precedence, and sizing
guidance. The 600-second value is a working example from the reported
workload, not a recommendation.
2026-11-21 05:37:28 +08:00
Xuanwo c55b7c0390 feat!: add explicit scan order contract for local queries (#5138)
BREAKING CHANGE: `QueryRequest` now has a public `scan_in_order:
Option<bool>` field. Existing code that constructs `QueryRequest` with
an exhaustive struct literal must add `scan_in_order: None` to retain
the previous backend default, or use `..Default::default()` where
appropriate. Python defaults are unchanged: leaving `scan_in_order()`
uncalled keeps `None`.

## Problem

Plain Embedded LanceDB scans already use Lance's ordered scan on a fixed
snapshot, but the storage-order contract was undocumented and callers
had no way to require it. Explicit `order_by` sorts the whole result.
Ranked, Enterprise, RTE/LSM, legacy scalar-index and namespace-pushdown
paths cannot always preserve base manifest order.

## Behavior

- `scan_in_order(true)` requires manifest order without adding a sort:
fragments in manifest order, then rows in fragment order.
- `true` disables scalar-index filter planning. Legacy scalar-index
plans can materialize index rows in a different sequence, so filters are
evaluated over the manifest-ordered scan instead. Filter semantics are
unchanged, but the scan can read more data. Default filtered scans can
still use those plans and may not preserve manifest order.
- `scan_in_order(false)` permits the backend to scan unordered. It does
**not** guarantee a different order; an explicit nonempty `order_by`
still sorts.
- Leaving the option unset preserves the backend default. The documented
manifest-order default applies to an unfiltered base-only scan of a
pinned Embedded table version. RTE tables scan the LSM by default and
need `use_rte(false)` for the base-only guarantee. Enterprise and
namespace-pushed scans have no order guarantee.
- `true` conflicts with nonempty `order_by`, take queries,
vector/full-text/hybrid/reranked queries, RTE/LSM reads, and Enterprise
tables. These fail explicitly instead of silently dropping the
requirement. Take conflict validation happens at the shared
take-preparation boundary before offset or row-id selectors are
stripped.
- `with_fragments()` is rejected with `scan_in_order(true)` because
fragment objects cannot be validated against the pinned dataset version.
Use `fragment_ids()`, which resolves fragment ids from the manifest and
preserves manifest order. Both sync and async pandas scanner paths share
this rule.
- Namespace `QueryTable` pushdown executes `true` against Embedded
storage instead of dropping the order. The existing path preserves
projection, filtering, limits, version/branch selection, and RTE
routing; if Embedded storage cannot be read, the query fails.

Supported entry points are plain Rust `Table::query()`, Python sync
`table.search()` and async `table.query()`. The Python pandas scanner
fast path forwards the option and disables scalar-index planning for
explicit order. Existing takes and `with_fragments()` calls with `None`
or `false` are unchanged.

## Validation

- Rust: 6 `scan_in_order` tests, 32 take tests, 25 query-route tests.
- Python: `test_query.py` and `test_namespace.py` 352 passed, 1 skipped
against a matching extension.
- Scoped `pytest --doctest-modules python/lancedb/query.py -k
scan_in_order`: 2 passed. The Rust/Python examples create their own
tables and are executable.
- Regressions cover legacy 0.1 and stable BTREE tables with update and a
filter admitting every row, across pinned versions before and after
update; reversed `fragment_ids`; explicit `with_fragments()` rejection;
and fixed-version multi-fragment reads with deletions, one-row batches,
and limit/offset. No `SortExec` is added.
- `cargo clippy --features remote --tests --examples`; `cargo fmt
--check`; Ruff format/check; `git diff --check`.
- Local checks ran on this branch. CI on this PR evaluates the merge
with current `main`; no combined local binary validation is claimed
here.

Refs OSS-3109.
2026-11-21 05:20:16 +08:00
Xuanwo 0d2655edba test(python): isolate the background-loop fork scenario (#5142)
## Summary

Follow-up to #5111.

`test_forked_child_starts_background_loop_lazily` forked the shared
pytest process. On CI that process may already own native
Tokio/parking_lot state from earlier tests such as `test_authz.py`, so
the forked child can crash in a non-Python native thread during
`table_names()` for reasons unrelated to this scenario.

Run the entire fork scenario in a fresh `python -c` subprocess. The
parent still starts `LOOP` via `parent-before`, forks while holding
`LOOP._start_lock` (released in `finally`), and the child still verifies
that it sees no inherited loop, thread, or background threads before
using the real native sync API (`connect("memory://")` /
`table_names()`). The child must then gain exactly one live daemon
thread, while the parent's original thread stays alive and serves
`parent-after`.

This is test isolation, not a production fix or a root-cause claim. The
original assertions and cleanup are preserved, with a 40s outer timeout
for `join(20)`, `terminate()` + `join(5)`, `queue.get(5)`, and
diagnostics.

## CI evidence

The failure was observed on a docs-only main run (`b4459f35`), so it is
not caused by a product change in that run:

- [Minimum dependencies job
136441279987](https://github.com/lancedb/lancedb/actions/runs/44780367013/job/136441279987):
timed out at ~20s.
- [Linux Python 3.13 job
136441280394](https://github.com/lancedb/lancedb/actions/runs/44780367013/job/136441280394):
native SIGSEGV in a non-Python native thread during `table_names()`
after `connect`, following `test_authz.py` in the same stage.

## Validation

- `python/tests/test_background_loop.py`: 4 passed.
- Same pytest process, `test_authz.py` followed by
`test_background_loop.py`: 83 passed.
- `uv run make check`: cargo fmt, ruff format, cargo clippy, and ruff
check passed.

No production code changes.
2026-11-21 05:04:30 +08:00
Xuanwo 668fb1e256 feat(python): add tag-based branch creation and default tag versions (#5136)
Python `tags.create()` now defaults `version` to the handle's currently
visible version, including checked-out handles. Existing `from_ref` /
`from_version` branch selection and explicit tag versions keep their
current behavior.

`branches.create()` gains keyword-only `from_tag`, so a branch can fork
from a tag through the existing `Ref::Tag` path. This preserves the
tag's actual branch snapshot; resolving only its numeric version could
fork from `main` when both branches share a version number. `from_tag`
conflicts with `from_ref` / `from_version` are rejected before
`from_ref="main"` normalization.

When `from_ref` names a tag instead of a branch, the native
missing-branch failure keeps its classification and receives a static
`from_tag=` hint without another lookup. A missing version and an
ambiguous Enterprise 404 keep their original errors.

The Python sync and async APIs, PyO3 binding, stubs and docstrings are
updated together, with native Rust coverage for a tag on a branch that
shares main's numeric version. Node.js `fromTag` and optional `version`
will follow in a separate PR after this one.
2026-11-21 04:59:34 +08:00