From a663417fa97bc29b42308508d84ddb130bd9eacb Mon Sep 17 00:00:00 2001
From: "lancedb-gatefixer[bot]"
<313497061+lancedb-gatefixer[bot]@users.noreply.github.com>
Date: Fri, 27 Nov 2026 15:50:20 +0800
Subject: [PATCH 1/6] fix: validate remote tag checkout branch and version
(#4853)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Remote tag checkout discarded the tag's branch and pinned its version on
the handle's own branch without checking that the version existed. This
could read a different snapshot or leave the handle pinned to a
nonexistent version.
Resolve the complete tag reference and reject cross-branch tags with an
error naming both branches. For a tag on the handle's branch, reuse
numeric checkout to validate the version before committing the selector
and freshness state. This also protects Python's
`open_table(version=tag)`, which delegates to tag checkout. To read a
tag on another branch, obtain that branch's handle first with
`checkout_branch` in Rust or `table.branches.checkout(...)` in Python.
The Python checkout docstrings and tag-based versioning guide document
this requirement.
Add 17 regression cases covering cross-branch tags in both directions,
main-branch aliases, same-branch reads, and failed validation on
writable and pinned handles. Twelve cases failed against the original
implementation. Update the existing freshness and schema-cache tests for
the validation request.
Validation:
- `cargo test --locked --profile ci --features remote -p lancedb --lib
remote:: -- --quiet` — 921 tests passed using mocked remote endpoints.
- `cargo fmt --all` — passed.
- `cargo clippy --locked --profile ci --features remote -p lancedb
--tests --examples` — passed.
- Python documentation: Ruff lint and formatting checks passed for the
Python tree, using Ruff 0.15.20 from `python/uv.lock`. Python syntax
checks passed; executable ASTs are unchanged. Repository-wide `ruff
check .` reports 59 pre-existing errors in six unchanged
`docs/web-tests` files; unrelated formatter changes were excluded.
Fixes #4843
## Change walkthrough
```mermaid
flowchart TD
resolve["Resolve tag reference"] --> branch{"Same branch?"}
branch -->|No| reject["Return branch error"]
branch -->|Yes| validate["Describe tag version"]
validate -->|Error| error["Return version error"]
validate -->|Success| pin["Pin validated snapshot"]
```
The selector and freshness state commit together under the version lock.
**Read:** [branch
guard](https://github.com/lancedb/lancedb/blob/35f8db881e36b83b9aab478cb5db72e485c9eca7/rust/lancedb/src/remote/table.rs#L4075-L4092)
→ [validation and
commit](https://github.com/lancedb/lancedb/blob/35f8db881e36b83b9aab478cb5db72e485c9eca7/rust/lancedb/src/remote/table.rs#L2865-L2893)
→ [tag and branch
guidance](https://github.com/lancedb/lancedb/blob/35f8db881e36b83b9aab478cb5db72e485c9eca7/docs/web/management/table.mdx#L1745-L1755).
Snapshot:
[35f8db8](https://github.com/lancedb/lancedb/commit/35f8db881e36b83b9aab478cb5db72e485c9eca7)
---------
Co-authored-by: Gatefixer <313497061+lancedb-gatefixer[bot]@users.noreply.github.com>
---
docs/web/management/table.mdx | 7 +
python/python/lancedb/remote/table.py | 10 +
python/python/lancedb/table.py | 12 ++
rust/lancedb/src/remote/table.rs | 276 +++++++++++++++++++++++---
rust/lancedb/src/table.rs | 4 +
5 files changed, 281 insertions(+), 28 deletions(-)
diff --git a/docs/web/management/table.mdx b/docs/web/management/table.mdx
index fef2a5707..9c836c9d3 100644
--- a/docs/web/management/table.mdx
+++ b/docs/web/management/table.mdx
@@ -1736,6 +1736,13 @@ page).
The tags API supports the standard CRUD operations (create, list, update, delete),
plus checking out by tag name.
+A tag identifies both a branch and a version. On Enterprise tables, a tag must belong
+to the handle's current branch; checking out a tag on another branch raises an
+error without changing the current selection. Obtain a handle for the tag's
+branch first: in Python, use `branch_table = table.branches.checkout("exp")`, then
+`branch_table.checkout("baseline")` to read a tag named `baseline` on `exp`.
+See [Branches](/tables/branching) for more on branch handles.
+
In Python, `tags.create()` accepts an optional `version`. If you omit it, the
tag uses the version the table handle currently shows. That includes a handle
checked out to an older version, so pass `version` explicitly when the tag must
diff --git a/python/python/lancedb/remote/table.py b/python/python/lancedb/remote/table.py
index 04e0190a3..eee954345 100644
--- a/python/python/lancedb/remote/table.py
+++ b/python/python/lancedb/remote/table.py
@@ -332,6 +332,16 @@ class RemoteTable(Table):
)
def checkout(self, version: Union[int, str]):
+ """Check out a version number or tag as a read-only view in place.
+
+ A tag must belong to this handle's current branch. To read a tag on
+ another branch, first obtain that branch's handle with
+ `table.branches.checkout("branch_name")`, then call `checkout(tag)` on
+ that handle. A tag on another branch raises an error without changing
+ the current selection.
+
+ Call `checkout_latest()` to return to the latest version of this branch.
+ """
result = LOOP.run(self._table.checkout(version))
self._checkout_version = self.version
return result
diff --git a/python/python/lancedb/table.py b/python/python/lancedb/table.py
index a34a36465..d7486af09 100644
--- a/python/python/lancedb/table.py
+++ b/python/python/lancedb/table.py
@@ -4247,6 +4247,12 @@ class Table(ABC):
out state. To return the table to a normal state use
`[Self::checkout_latest]`.
+ For Enterprise tables, a tag must belong to this handle's current branch.
+ To read a tag on another branch, first obtain that branch's handle with
+ `table.branches.checkout("branch_name")`, then call `checkout(tag)` on
+ that handle. A tag on another branch raises an error without changing
+ the current selection.
+
Parameters
----------
version: int | str,
@@ -10036,6 +10042,12 @@ class AsyncTable:
out state. To return the table to a normal state use
`[Self::checkout_latest]`.
+ For Enterprise tables, a tag must belong to this handle's current branch.
+ To read a tag on another branch, first obtain that branch's handle with
+ `await table.branches.checkout("branch_name")`, then call
+ `await branch_table.checkout(tag)` on that handle. A tag on another
+ branch raises an error without changing the current selection.
+
Parameters
----------
version: int | str,
diff --git a/rust/lancedb/src/remote/table.rs b/rust/lancedb/src/remote/table.rs
index ab5b65893..2f88d7f2f 100644
--- a/rust/lancedb/src/remote/table.rs
+++ b/rust/lancedb/src/remote/table.rs
@@ -1269,7 +1269,7 @@ impl RemoteTable {
}
/// Resolve a tag to its `(branch, version)` coordinate via the `tags/version`
- /// endpoint, since the `/branches/create` contract accepts no `from_tag`.
+ /// endpoint.
async fn resolve_tag_ref(&self, tag: &str) -> Result<(Option, u64)> {
let request = self
.client
@@ -4286,22 +4286,19 @@ impl BaseTable for RemoteTable {
// Resolve the tag without attaching freshness headers; a stale
// `min_version` from a previous write should not ride along on an
// explicit time-travel request.
- let request = self
- .client
- .post(&format!("/v1/table/{}/tags/version/", self.identifier));
- let version = self
- .resolve_tag_version_with_request(tag, request, false)
- .await?;
+ let (branch, version) = self.resolve_tag_ref(tag).await?;
+ if branch != self.branch {
+ return Err(Error::InvalidInput {
+ message: format!(
+ "Tag '{tag}' belongs to branch '{}', but this table handle is scoped to branch '{}'. Check out the tag's branch first.",
+ branch.as_deref().unwrap_or("main"),
+ self.branch.as_deref().unwrap_or("main"),
+ ),
+ });
+ }
- let mut write_guard = self.version.write().await;
- // Commit the selector and its freshness mode while holding the selector
- // write lock, with no cancellation point between the two updates.
- self.reset_freshness(None, true);
- *write_guard = Some(version);
- self.invalidate_schema_cache();
- drop(write_guard);
-
- Ok(())
+ // Validate the version before pinning the handle.
+ self.checkout(version).await
}
/// Only `OptimizeAction::Compact` with supported `options` and no custom
/// `remap_options` is supported remotely: it submits a durable
@@ -16191,12 +16188,13 @@ mod tests {
.checkout_tag("v2")
.await
.expect("checkout_tag should succeed");
+ assert_eq!(call_count.load(Ordering::SeqCst), 2);
// Schema call after checkout_tag should re-fetch (cache was invalidated)
let schema3 = table.schema().await.unwrap();
assert_eq!(
call_count.load(Ordering::SeqCst),
- 2,
+ 3,
"Cache should have been invalidated and re-fetched"
);
assert_ne!(
@@ -18130,12 +18128,13 @@ mod tests {
}
#[tokio::test]
- async fn test_freshness_checkout_tag_resolve_sends_no_min_version() {
- // Same invariant for checkout_tag: the tag-resolve request must not
- // pick up a stale min_version from a prior write.
+ async fn test_freshness_checkout_tag_validation_sends_no_min_version() {
+ // Neither the tag lookup nor the version validation should pick up a
+ // stale min_version from a prior write.
let (handler, captured) = path_capturing_handler(|path| match path {
"/v1/table/my_table/update/" => r#"{"rows_updated":1,"version":7}"#.to_string(),
"/v1/table/my_table/tags/version/" => r#"{"version":5}"#.to_string(),
+ "/v1/table/my_table/describe/" => r#"{"version":5,"schema":{"fields":[]}}"#.to_string(),
_ => panic!("unexpected path: {}", path),
});
let table = Table::new_with_handler("my_table", handler);
@@ -18144,14 +18143,20 @@ mod tests {
table.checkout_tag("v_initial").await.unwrap();
let captured = captured.lock().unwrap();
- let resolve_headers = captured
- .get("/v1/table/my_table/tags/version/")
- .expect("tags/version should have been called by checkout_tag");
- assert!(
- !resolve_headers.contains_key("x-lancedb-min-version"),
- "checkout_tag resolve must not carry stale min_version",
- );
- assert!(!resolve_headers.contains_key("x-lancedb-min-timestamp"));
+ for path in [
+ "/v1/table/my_table/tags/version/",
+ "/v1/table/my_table/describe/",
+ ] {
+ let headers = captured
+ .get(path)
+ .expect("checkout_tag should call endpoint");
+ assert!(
+ !headers.contains_key("x-lancedb-min-version"),
+ "{path} must not carry stale min_version",
+ );
+ assert!(!headers.contains_key("x-lancedb-min-timestamp"));
+ assert!(!headers.contains_key("x-lancedb-min-read-version"));
+ }
}
#[tokio::test]
@@ -19017,6 +19022,221 @@ mod tests {
}
}
+ #[rstest]
+ #[case(None, Some("exp"))]
+ #[case(Some("exp"), None)]
+ #[case(Some("exp"), Some("main"))]
+ #[case(Some("exp"), Some("other"))]
+ #[tokio::test]
+ async fn test_checkout_tag_rejects_other_branch(
+ #[case] handle_branch: Option<&'static str>,
+ #[case] tag_branch: Option<&'static str>,
+ #[values(None, Some(1))] initial_version: Option,
+ ) {
+ let table = RemoteTable::new_mock(
+ "my_table".to_string(),
+ move |request| {
+ let body = request_body_json(&request);
+ let response = match request.url().path() {
+ "/v1/table/my_table/tags/version/" => {
+ assert_eq!(body, json!({"tag": "cross_branch"}));
+ json!({"branch": tag_branch, "version": 2}).to_string()
+ }
+ "/v1/table/my_table/describe/" => {
+ assert_eq!(body["branch"].as_str(), handle_branch);
+ assert_eq!(body["version"].as_u64(), initial_version);
+ json!({"version": initial_version.unwrap_or(7), "schema": {"fields": []}})
+ .to_string()
+ }
+ "/v1/table/my_table/count_rows/" => {
+ assert_eq!(body["branch"].as_str(), handle_branch);
+ assert_eq!(body["version"].as_u64(), initial_version);
+ "3".to_string()
+ }
+ path => panic!("unexpected request: {path}"),
+ };
+ http::Response::builder()
+ .status(200)
+ .body(response)
+ .unwrap()
+ },
+ None,
+ )
+ .with_branch(handle_branch.map(String::from));
+ if let Some(version) = initial_version {
+ table.checkout(version).await.unwrap();
+ } else {
+ table.checkout_latest().await.unwrap();
+ }
+ let schema = table.schema().await.unwrap();
+ let before = table.snapshot_read_state().await;
+
+ let error = table.checkout_tag("cross_branch").await.unwrap_err();
+ assert!(matches!(error, Error::InvalidInput { .. }), "{error:?}");
+ let message = error.to_string();
+ assert!(message.contains("cross_branch"), "{message}");
+ assert!(message.contains(tag_branch.unwrap_or("main")), "{message}");
+ assert!(
+ message.contains(handle_branch.unwrap_or("main")),
+ "{message}"
+ );
+
+ let after = table.snapshot_read_state().await;
+ assert_eq!(after.version, before.version);
+ assert_eq!(
+ after.freshness_state.generation,
+ before.freshness_state.generation
+ );
+ assert_eq!(after.freshness_state.pinned, before.freshness_state.pinned);
+ assert_eq!(
+ after.freshness_state.min_version,
+ before.freshness_state.min_version
+ );
+ assert_eq!(
+ after.freshness_state.min_read_version,
+ before.freshness_state.min_read_version
+ );
+ assert_eq!(
+ after.freshness_state.checkout_baseline,
+ before.freshness_state.checkout_baseline
+ );
+ assert_eq!(table.current_branch().as_deref(), handle_branch);
+ assert!(Arc::ptr_eq(&schema, &table.schema().await.unwrap()));
+ assert_eq!(table.count_rows(None).await.unwrap(), 3);
+ }
+
+ #[rstest]
+ #[case(None, None)]
+ #[case(None, Some("main"))]
+ #[case(None, Some(""))]
+ #[case(None, Some(" main "))]
+ #[case(Some("exp"), Some("exp"))]
+ #[tokio::test]
+ async fn test_checkout_tag_on_same_branch(
+ #[case] handle_branch: Option<&'static str>,
+ #[case] tag_branch: Option<&'static str>,
+ ) {
+ let table = RemoteTable::new_mock(
+ "my_table".to_string(),
+ move |request| {
+ let body = request_body_json(&request);
+ let response = match request.url().path() {
+ "/v1/table/my_table/tags/version/" => {
+ assert_eq!(body, json!({"tag": "snapshot"}));
+ json!({"branch": tag_branch, "version": 2}).to_string()
+ }
+ "/v1/table/my_table/describe/" => {
+ assert_eq!(body["branch"].as_str(), handle_branch);
+ assert_eq!(body["version"], 2);
+ for header in [
+ MIN_VERSION_HEADER,
+ MIN_READ_VERSION_HEADER,
+ MIN_TIMESTAMP_HEADER,
+ ] {
+ assert!(!request.headers().contains_key(header));
+ }
+ r#"{"version":2,"schema":{"fields":[]}}"#.to_string()
+ }
+ "/v1/table/my_table/count_rows/" => {
+ assert_eq!(body["branch"].as_str(), handle_branch);
+ if body["version"].is_null() {
+ "4".to_string()
+ } else {
+ assert_eq!(body["version"], 2);
+ "3".to_string()
+ }
+ }
+ path => panic!("unexpected request: {path}"),
+ };
+ http::Response::builder()
+ .status(200)
+ .body(response)
+ .unwrap()
+ },
+ None,
+ )
+ .with_branch(handle_branch.map(String::from));
+
+ table.checkout_latest().await.unwrap();
+ table.checkout_tag("snapshot").await.unwrap();
+ assert_eq!(table.count_rows(None).await.unwrap(), 3);
+ assert_eq!(table.current_branch().as_deref(), handle_branch);
+ table.checkout_latest().await.unwrap();
+ assert_eq!(table.count_rows(None).await.unwrap(), 4);
+ assert_eq!(table.current_branch().as_deref(), handle_branch);
+ }
+
+ #[rstest]
+ #[case(None)]
+ #[case(Some("exp"))]
+ #[tokio::test]
+ async fn test_checkout_tag_missing_version_leaves_handle_unchanged(
+ #[case] branch: Option<&'static str>,
+ #[values(None, Some(1))] initial_version: Option,
+ ) {
+ let table = RemoteTable::new_mock(
+ "my_table".to_string(),
+ move |request| {
+ let body = request_body_json(&request);
+ if request.url().path() == "/v1/table/my_table/tags/version/" {
+ return http::Response::builder()
+ .status(200)
+ .body(json!({"branch": branch, "version": 99}).to_string())
+ .unwrap();
+ }
+ assert_eq!(body["branch"].as_str(), branch);
+ if body["version"] == 99 {
+ assert_eq!(request.url().path(), "/v1/table/my_table/describe/");
+ return http::Response::builder()
+ .status(404)
+ .body("not found".to_string())
+ .unwrap();
+ }
+ assert_eq!(body["version"].as_u64(), initial_version);
+ let response = match request.url().path() {
+ "/v1/table/my_table/describe/" => {
+ json!({"version": initial_version.unwrap_or(7), "schema": {"fields": []}})
+ .to_string()
+ }
+ "/v1/table/my_table/count_rows/" => "3".to_string(),
+ path => panic!("unexpected request: {path}"),
+ };
+ http::Response::builder()
+ .status(200)
+ .body(response)
+ .unwrap()
+ },
+ None,
+ )
+ .with_branch(branch.map(String::from));
+ if let Some(version) = initial_version {
+ table.checkout(version).await.unwrap();
+ } else {
+ table.checkout_latest().await.unwrap();
+ }
+ let schema = table.schema().await.unwrap();
+ let before = table.snapshot_read_state().await;
+
+ let error = table.checkout_tag("missing_version").await.unwrap_err();
+ assert!(matches!(error, Error::TableNotFound { .. }), "{error:?}");
+ assert!(error.to_string().contains("version: 99"));
+ let after = table.snapshot_read_state().await;
+ assert_eq!(after.version, before.version);
+ assert_eq!(
+ after.freshness_state.generation,
+ before.freshness_state.generation
+ );
+ assert_eq!(
+ after.freshness_state.checkout_baseline,
+ before.freshness_state.checkout_baseline
+ );
+ // HTTP errors invalidate the schema cache, but the refreshed schema
+ // must still come from the original selector.
+ assert_eq!(schema, table.schema().await.unwrap());
+ assert_eq!(table.current_branch().as_deref(), branch);
+ assert_eq!(table.count_rows(None).await.unwrap(), 3);
+ }
+
#[tokio::test]
async fn test_checkout_branch_validates_via_list() {
let table = Table::new_with_handler("my_table", |request| {
diff --git a/rust/lancedb/src/table.rs b/rust/lancedb/src/table.rs
index 0f1e7bb1c..428e960e1 100644
--- a/rust/lancedb/src/table.rs
+++ b/rust/lancedb/src/table.rs
@@ -3075,6 +3075,10 @@ impl Table {
/// Checks out a specific version of the Table by tag
///
+ /// On Enterprise tables, the tag must belong to this handle's branch. Use
+ /// [`Self::checkout_branch`] to obtain a handle for another branch first.
+ /// A failed Enterprise tag checkout leaves the handle unchanged.
+ ///
/// Any read operation on the table will now access the data at the version referenced by the tag.
/// As a consequence, calling this method will disable any read consistency interval
/// that was previously set.
From 0736ef02b0c40dcbe5d3f31dacd26b934d2527fb Mon Sep 17 00:00:00 2001
From: "lancedb-gatefixer[bot]"
<313497061+lancedb-gatefixer[bot]@users.noreply.github.com>
Date: Fri, 27 Nov 2026 15:50:37 +0800
Subject: [PATCH 2/6] fix: reject merge inserts on version-pinned tables
(#4851)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Local `merge_insert` skipped the mutability check, allowing a
version-pinned handle to commit onto its branch's latest version. Add
`ensure_mutable()` at the start of `NativeTable::merge_insert` so it
returns the same `InvalidInput` error as other writes before processing
the merge. This shared Rust path serves both Python and TypeScript local
tables.
Extend the existing branch-version and time-travel tests to cover pinned
opens and checkouts on main and named branches. Assert that rejection
preserves pinned data and the latest version, and that
`checkout_latest()` restores merge writes.
Validation:
- Both regression tests failed before the fix, reproducing successful
commits from pinned handles.
- Table tests: 405 passed (`cargo test --quiet --locked --profile ci
--features remote -p lancedb --lib table::tests::`).
- Merge tests: 20 passed (`cargo test --quiet --locked --profile ci
--features remote -p lancedb --lib table::merge::tests::`).
- `cargo clippy --quiet --locked --profile ci --features remote -p
lancedb --tests --examples` passed.
- `cargo fmt --all` and `git diff --check` passed.
Fixes #4844
## Change walkthrough
```mermaid
flowchart LR
A["Native merge_insert"] --> B{"ensure_mutable"}
B -->|Pinned version| C["Return InvalidInput"]
B -->|Latest handle| D["Process merge"]
D --> E["Write data"]
```
**Read:** [Entry
guard](https://github.com/lancedb/lancedb/blob/aa58a4d28a7596753bb44e3655d2839e07484398/rust/lancedb/src/table.rs#L3972-L3986)
→ [Branch
pins](https://github.com/lancedb/lancedb/blob/aa58a4d28a7596753bb44e3655d2839e07484398/rust/lancedb/src/table.rs#L5141-L5158)
→ [Main pins and
reattachment](https://github.com/lancedb/lancedb/blob/aa58a4d28a7596753bb44e3655d2839e07484398/rust/lancedb/src/table.rs#L5488-L5518).
Snapshot:
[aa58a4d](https://github.com/lancedb/lancedb/commit/aa58a4d28a7596753bb44e3655d2839e07484398)
Co-authored-by: Gatefixer <313497061+lancedb-gatefixer[bot]@users.noreply.github.com>
---
rust/lancedb/src/table.rs | 46 ++++++++++++++++++++++++++++++++++++++-
1 file changed, 45 insertions(+), 1 deletion(-)
diff --git a/rust/lancedb/src/table.rs b/rust/lancedb/src/table.rs
index 428e960e1..296061e64 100644
--- a/rust/lancedb/src/table.rs
+++ b/rust/lancedb/src/table.rs
@@ -4805,6 +4805,7 @@ impl BaseTable for NativeTable {
params: MergeInsertBuilder,
new_data: Box,
) -> Result {
+ self.dataset.ensure_mutable()?;
let source_schema = arrow_array::RecordBatchReader::schema(&new_data);
self.ensure_not_a_view("merge insert into").await?;
computed_columns::ensure_not_written(
@@ -6005,6 +6006,22 @@ mod tests {
// a pinned version is a detached head: writes are rejected
assert!(pinned.add(sample_rows(vec![9])).execute().await.is_err());
+ let exp_head = head.version().await.unwrap();
+ for pinned_table in [&pinned, &pinned_direct] {
+ let mut merge = pinned_table.merge_insert(&["i"]);
+ merge
+ .when_matched_update_all(None)
+ .when_not_matched_insert_all();
+ let err = merge.execute(sample_rows(vec![300])).await.unwrap_err();
+ assert!(matches!(err, Error::InvalidInput { message }
+ if message == "table cannot be modified when a specific version is checked out"));
+ assert_eq!(pinned_table.version().await.unwrap(), exp_v2);
+ assert_eq!(pinned_table.count_rows(None).await.unwrap(), 2);
+ }
+ assert_eq!(head.version().await.unwrap(), exp_head);
+ assert_eq!(head.count_rows(None).await.unwrap(), 3);
+ assert_eq!(table.version().await.unwrap(), main_v2);
+ assert_eq!(table.count_rows(None).await.unwrap(), 4);
// version-only (no branch) time-travels main itself: its fork-point
// version holds only main's first row, and the shared version number
@@ -6390,8 +6407,35 @@ mod tests {
.unwrap();
let version = table.version().await.unwrap();
table.add(some_sample_data()).execute().await.unwrap();
+ let latest_version = table.version().await.unwrap();
+ let opened = conn
+ .open_table("my_table")
+ .version(version)
+ .execute()
+ .await
+ .unwrap();
table.checkout(version).await.unwrap();
- assert!(table.add(some_sample_data()).execute().await.is_err())
+ assert!(table.add(some_sample_data()).execute().await.is_err());
+ for pinned_table in [&table, &opened] {
+ let mut merge = pinned_table.merge_insert(&["i"]);
+ merge
+ .when_matched_update_all(None)
+ .when_not_matched_insert_all();
+ let err = merge.execute(sample_rows(vec![300])).await.unwrap_err();
+ assert!(matches!(err, Error::InvalidInput { message }
+ if message == "table cannot be modified when a specific version is checked out"));
+ assert_eq!(pinned_table.version().await.unwrap(), version);
+ assert_eq!(pinned_table.count_rows(None).await.unwrap(), 1);
+ }
+
+ table.checkout_latest().await.unwrap();
+ assert_eq!(table.version().await.unwrap(), latest_version);
+ assert_eq!(table.count_rows(None).await.unwrap(), 2);
+ let mut merge = table.merge_insert(&["i"]);
+ merge.when_not_matched_insert_all();
+ let result = merge.execute(sample_rows(vec![300])).await.unwrap();
+ assert_eq!(result.num_inserted_rows, 1);
+ assert_eq!(table.count_rows(None).await.unwrap(), 3);
}
#[tokio::test]
From fdfbb98a9cf3371cd1abd2f38493e92cee212210 Mon Sep 17 00:00:00 2001
From: Henry Su
Date: Fri, 27 Nov 2026 02:23:03 -0600
Subject: [PATCH 3/6] fix(python): give tied FTS scores full weight in hybrid
normalization (#4858)
## Why
Hybrid search normalizes FTS scores with min-max. When all FTS scores
are equal (one match, or a tie), the range is 0 and every score became
0. `LinearCombinationReranker` treats 0 as a missing FTS match. So a
lone keyword match could rank below documents without the keyword. Fixes
#4857.
## What changed
- `_normalize_scores` takes a `tie_value` for the zero-range case. The
default stays 0, so vector distances are unchanged.
- The FTS leg passes `tie_value=1.0`, so tied FTS matches count as the
best FTS result.
## Scope
- Covers the zero-range case for both `normalize="score"` and
`normalize="rank"`.
- Leaves out how `_rank` breaks ties among equal scores. That is a
separate question.
## Blast Radius
The change only affects hybrid queries where every FTS hit has the same
score. RRF and MRR use list position, so their results don't change.
LinearCombination and custom score-based rerankers now give those hits
full FTS weight.
## Verification
- A new test in `test_hybrid_query.py` fails on main in both normalize
modes and passes with the fix.
- `pytest python/tests -m "not slow and not s3_test"`: 3272 passed, 167
skipped.
- `ruff format --check` and `ruff check` (0.9.9, the version pinned by
pre-commit) pass.
---
python/python/lancedb/query.py | 15 ++++++++----
python/python/tests/test_hybrid_query.py | 31 ++++++++++++++++++++++++
2 files changed, 41 insertions(+), 5 deletions(-)
diff --git a/python/python/lancedb/query.py b/python/python/lancedb/query.py
index 650584d46..94f8f0149 100644
--- a/python/python/lancedb/query.py
+++ b/python/python/lancedb/query.py
@@ -3491,7 +3491,9 @@ class LanceHybridQueryBuilder(LanceQueryBuilder):
fts_results = fts_results.set_column(
score_i,
fts_results.field(score_i),
- LanceHybridQueryBuilder._normalize_scores(fts_results.column(score_i)),
+ LanceHybridQueryBuilder._normalize_scores(
+ fts_results.column(score_i), tie_value=1.0
+ ),
)
results = reranker.rerank_hybrid(fts_query, vector_results, fts_results)
@@ -3552,7 +3554,9 @@ class LanceHybridQueryBuilder(LanceQueryBuilder):
return results
@staticmethod
- def _normalize_scores(scores: pa.Array, invert=False) -> pa.Array:
+ def _normalize_scores(
+ scores: pa.Array, invert=False, tie_value: float = 0.0
+ ) -> pa.Array:
if len(scores) == 0:
return scores
# normalize the scores by subtracting the min and dividing by the max
@@ -3561,9 +3565,10 @@ class LanceHybridQueryBuilder(LanceQueryBuilder):
if not pc.equal(rng, pa.scalar(0.0)).as_py():
scores = pc.divide(pc.subtract(scores, min), rng)
- elif not pc.equal(max, pa.scalar(0.0)).as_py():
- # If rng is 0, then we at least want the scores to be 0
- scores = pc.subtract(scores, min)
+ else:
+ # All scores are equal, so they are equally relevant. Distances
+ # tie at 0 (best), while higher-is-better scores tie at 1.
+ scores = pc.add(pc.subtract(scores, min), pa.scalar(tie_value, scores.type))
if invert:
scores = pc.subtract(1, scores)
diff --git a/python/python/tests/test_hybrid_query.py b/python/python/tests/test_hybrid_query.py
index ec6060db3..7d5fbb3e2 100644
--- a/python/python/tests/test_hybrid_query.py
+++ b/python/python/tests/test_hybrid_query.py
@@ -604,6 +604,37 @@ def test_normalize_scores():
)
+@pytest.mark.parametrize("normalize", ["score", "rank"])
+def test_hybrid_single_fts_match_keeps_fts_weight(tmp_path, normalize):
+ from lancedb.rerankers import LinearCombinationReranker
+
+ db = lancedb.connect(tmp_path)
+ table = db.create_table(
+ "test",
+ [
+ {"text": "apple banana", "vector": [0.0, 0.0]},
+ {"text": "zebra unicorn", "vector": [0.1, 0.0]},
+ {"text": "cherry grape", "vector": [5.0, 5.0]},
+ ],
+ )
+ table.create_fts_index("text")
+
+ results = (
+ table.search(query_type="hybrid")
+ .vector([0.0, 0.0])
+ .text("zebra")
+ .rerank(LinearCombinationReranker(weight=0.3), normalize=normalize)
+ .limit(3)
+ .to_arrow()
+ )
+
+ assert results["text"].to_pylist() == [
+ "zebra unicorn",
+ "apple banana",
+ "cherry grape",
+ ]
+
+
def test_hybrid_query_rejects_query_with_vector(sync_table: Table):
# Pins the full message: the space between "hybrid search." and "But" is
# load-bearing (see the _validate_query literal concatenation).
From 09beba532e8d903a2b417db00d01dca88d61025f Mon Sep 17 00:00:00 2001
From: Bilal Atique <74999164+BilalAtique@users.noreply.github.com>
Date: Fri, 27 Nov 2026 14:10:43 +0500
Subject: [PATCH 4/6] feat(node): accept Expr values in select() (#4878)
Closes #3042.
Node `select()` now takes `Expr` values, the same expression builder
that `where()` already accepts. A `Map` or a plain object can mix `Expr`
values and SQL strings:
```ts
import { col } from "@lancedb/lancedb";
const rows = await table
.query()
.select({
id: "id",
name: col("firstName"),
total: col("unitPrice").mul(col("quantity")),
})
.toArray();
```
This works on every query with `select()`: `query()`, `vectorSearch()`,
`search()` and the take queries. The parameter type is now `Map` and `Record`. Nothing else in the
TypeScript API changes.
### How it works
`select()` turns each `Expr` into SQL with `toSql()` and passes the
pairs to the native `select` that SQL strings already use. `where()`
handles an `Expr` the same way, so Node treats expressions alike in both
places. `toSql()` quotes camelCase names and SQL keywords with
backticks, so `col("firstName")` reads `firstName`.
I also looked at passing the expressions to Rust as `Select::Expr`, as
Python's `select_expr` does. I didn't go that way:
- Before a local or remote query runs, Rust turns `Select::Expr` back
into SQL with the same `expr_to_sql_string`. The query is the same
either way.
- A map that mixes SQL strings and expressions can't become a
`Select::Expr` without parsing the strings. Python's `AsyncQuery.select`
sends a mixed dict through `select_expr` and wraps each string with
`lit()` (`_coerce`), so `select({"id": "id", "doubled": col("score") *
lit(2)})` returns the string `'id'` in the `id` column. Sending SQL
keeps every string a SQL expression.
- I found one path that accepts `Select::Expr` and rejects
`Select::Dynamic`: namespace `QueryTable` pushdown. Node can't turn
pushdown on today, so nothing changes yet. If Node gets that option,
`select()` can send `Select::Expr` when every value is an `Expr`.
`blobMode: "bytes"` (#4353) finds blob columns by name in the `[output,
source]` list of the selection. For a camelCase column, `toSql()` gives
`` `imageData` ``, which doesn't match `imageData`. So when an `Expr` is
a bare column reference, the match uses its plain name. For this, the
native `Expr` gets a small `columnName()` helper, like `column_name()`
in the Python bindings, which Python uses for the same match. A blob
renamed with `col()` gets its bytes, as with a SQL string. Other
expressions are not filled with bytes, as before.
A value that is neither a string nor an `Expr` now throws a `TypeError`
that names the key, instead of the native conversion error.
### Tests
New tests in `expr.test.ts`:
- a `Map` that mixes SQL strings with `col("firstName")` and
`col("unitPrice").mul(2)` on a plain query, with the column order
- a `Record` with `upper()`, `func("lower", ...)` and a SQL string,
filtered with an `Expr` in `where()`
- `Expr` values on a vector query, an automatic `search()` (full-text
search) and a take query
- `blobMode: "bytes"` with a camelCase blob column selected with
`col()`: renamed, next to a computed `Expr` column, and in a take query
- a number as a value throws a `TypeError`
The whole Node suite passes. The Node docs under `docs/src/js` are
regenerated. The `@example` in the middle of the `select()` docstring
used to swallow the two paragraphs after it into the code block, so I
moved the example to the end, which is why each query class page
changes.
Left out: `Expr` items in the plain column list (`select([col("a")])`),
because an expression needs an output name. The `select` of a
materialized view still takes SQL strings only.
---
docs/src/js/classes/AutoQuery.md | 28 +--
docs/src/js/classes/Query.md | 28 +--
docs/src/js/classes/QueryBase.md | 28 +--
docs/src/js/classes/TakeQuery.md | 28 +--
docs/src/js/classes/VectorQuery.md | 28 +--
.../js/interfaces/QueryExecutionOptions.md | 5 +-
nodejs/__test__/expr.test.ts | 168 +++++++++++++++++-
nodejs/lancedb/query.ts | 61 +++++--
nodejs/src/expr.rs | 9 +
9 files changed, 298 insertions(+), 85 deletions(-)
diff --git a/docs/src/js/classes/AutoQuery.md b/docs/src/js/classes/AutoQuery.md
index 60f568e07..48fd52121 100644
--- a/docs/src/js/classes/AutoQuery.md
+++ b/docs/src/js/classes/AutoQuery.md
@@ -341,16 +341,24 @@ You can also use this method to create new "dynamic" columns based on your exist
For example, you may not care about "a" or "b" but instead simply want "a + b". This is often
seen in the SELECT clause of an SQL query (e.g. `SELECT a+b FROM my_table`).
-To create dynamic columns you can pass in a Map. A column will be returned
-for each entry in the map. The key provides the name of the column. The value is
-an SQL string used to specify how the column is calculated.
+To create dynamic columns you can pass in a Map. A column will be
+returned for each entry in the map. The key provides the name of the column. The value is
+an SQL string or an `Expr` that specifies how the column is calculated. An `Expr` built
+with `col` keeps the exact, case-sensitive column name.
For example, an SQL query might state `SELECT a + b AS combined, c`. The equivalent
-input to this method would be:
+input to this method would be `new Map([["combined", "a + b"], ["c", "c"]])`.
+
+Columns will always be returned in the order given, even if that order is different than
+the order used when adding the data.
+
+Note that you can pass in a `Record` (e.g. an object literal). This
+method uses `Object.entries` which should preserve the insertion order of the object.
+However, object insertion order is easy to get wrong and `Map` is more foolproof.
#### Parameters
-* **columns**: `string` \| `string`[] \| `Map`<`string`, `string`> \| `Record`<`string`, `string`>
+* **columns**: `string` \| `string`[] \| `Map`<`string`, `string` \| [`Expr`](Expr.md)> \| `Record`<`string`, `string` \| [`Expr`](Expr.md)>
#### Returns
@@ -359,14 +367,8 @@ input to this method would be:
#### Example
```ts
-new Map([["combined", "a + b"], ["c", "c"]])
-
-Columns will always be returned in the order given, even if that order is different than
-the order used when adding the data.
-
-Note that you can pass in a `Record` (e.g. an object literal). This method
-uses `Object.entries` which should preserve the insertion order of the object. However,
-object insertion order is easy to get wrong and `Map` is more foolproof.
+table.query().select(new Map([["combined", "a + b"], ["c", "c"]]));
+table.query().select({ id: "id", doubled: col("unitPrice").mul(2) });
```
#### Inherited from
diff --git a/docs/src/js/classes/Query.md b/docs/src/js/classes/Query.md
index 7434e7b8e..a2613cccf 100644
--- a/docs/src/js/classes/Query.md
+++ b/docs/src/js/classes/Query.md
@@ -415,16 +415,24 @@ You can also use this method to create new "dynamic" columns based on your exist
For example, you may not care about "a" or "b" but instead simply want "a + b". This is often
seen in the SELECT clause of an SQL query (e.g. `SELECT a+b FROM my_table`).
-To create dynamic columns you can pass in a Map. A column will be returned
-for each entry in the map. The key provides the name of the column. The value is
-an SQL string used to specify how the column is calculated.
+To create dynamic columns you can pass in a Map. A column will be
+returned for each entry in the map. The key provides the name of the column. The value is
+an SQL string or an `Expr` that specifies how the column is calculated. An `Expr` built
+with `col` keeps the exact, case-sensitive column name.
For example, an SQL query might state `SELECT a + b AS combined, c`. The equivalent
-input to this method would be:
+input to this method would be `new Map([["combined", "a + b"], ["c", "c"]])`.
+
+Columns will always be returned in the order given, even if that order is different than
+the order used when adding the data.
+
+Note that you can pass in a `Record` (e.g. an object literal). This
+method uses `Object.entries` which should preserve the insertion order of the object.
+However, object insertion order is easy to get wrong and `Map` is more foolproof.
#### Parameters
-* **columns**: `string` \| `string`[] \| `Map`<`string`, `string`> \| `Record`<`string`, `string`>
+* **columns**: `string` \| `string`[] \| `Map`<`string`, `string` \| [`Expr`](Expr.md)> \| `Record`<`string`, `string` \| [`Expr`](Expr.md)>
#### Returns
@@ -433,14 +441,8 @@ input to this method would be:
#### Example
```ts
-new Map([["combined", "a + b"], ["c", "c"]])
-
-Columns will always be returned in the order given, even if that order is different than
-the order used when adding the data.
-
-Note that you can pass in a `Record` (e.g. an object literal). This method
-uses `Object.entries` which should preserve the insertion order of the object. However,
-object insertion order is easy to get wrong and `Map` is more foolproof.
+table.query().select(new Map([["combined", "a + b"], ["c", "c"]]));
+table.query().select({ id: "id", doubled: col("unitPrice").mul(2) });
```
#### Inherited from
diff --git a/docs/src/js/classes/QueryBase.md b/docs/src/js/classes/QueryBase.md
index 0ef4fa286..20ee8e558 100644
--- a/docs/src/js/classes/QueryBase.md
+++ b/docs/src/js/classes/QueryBase.md
@@ -184,16 +184,24 @@ You can also use this method to create new "dynamic" columns based on your exist
For example, you may not care about "a" or "b" but instead simply want "a + b". This is often
seen in the SELECT clause of an SQL query (e.g. `SELECT a+b FROM my_table`).
-To create dynamic columns you can pass in a Map. A column will be returned
-for each entry in the map. The key provides the name of the column. The value is
-an SQL string used to specify how the column is calculated.
+To create dynamic columns you can pass in a Map. A column will be
+returned for each entry in the map. The key provides the name of the column. The value is
+an SQL string or an `Expr` that specifies how the column is calculated. An `Expr` built
+with `col` keeps the exact, case-sensitive column name.
For example, an SQL query might state `SELECT a + b AS combined, c`. The equivalent
-input to this method would be:
+input to this method would be `new Map([["combined", "a + b"], ["c", "c"]])`.
+
+Columns will always be returned in the order given, even if that order is different than
+the order used when adding the data.
+
+Note that you can pass in a `Record` (e.g. an object literal). This
+method uses `Object.entries` which should preserve the insertion order of the object.
+However, object insertion order is easy to get wrong and `Map` is more foolproof.
#### Parameters
-* **columns**: `string` \| `string`[] \| `Map`<`string`, `string`> \| `Record`<`string`, `string`>
+* **columns**: `string` \| `string`[] \| `Map`<`string`, `string` \| [`Expr`](Expr.md)> \| `Record`<`string`, `string` \| [`Expr`](Expr.md)>
#### Returns
@@ -202,14 +210,8 @@ input to this method would be:
#### Example
```ts
-new Map([["combined", "a + b"], ["c", "c"]])
-
-Columns will always be returned in the order given, even if that order is different than
-the order used when adding the data.
-
-Note that you can pass in a `Record` (e.g. an object literal). This method
-uses `Object.entries` which should preserve the insertion order of the object. However,
-object insertion order is easy to get wrong and `Map` is more foolproof.
+table.query().select(new Map([["combined", "a + b"], ["c", "c"]]));
+table.query().select({ id: "id", doubled: col("unitPrice").mul(2) });
```
***
diff --git a/docs/src/js/classes/TakeQuery.md b/docs/src/js/classes/TakeQuery.md
index 65bc35f08..459f34998 100644
--- a/docs/src/js/classes/TakeQuery.md
+++ b/docs/src/js/classes/TakeQuery.md
@@ -191,16 +191,24 @@ You can also use this method to create new "dynamic" columns based on your exist
For example, you may not care about "a" or "b" but instead simply want "a + b". This is often
seen in the SELECT clause of an SQL query (e.g. `SELECT a+b FROM my_table`).
-To create dynamic columns you can pass in a Map. A column will be returned
-for each entry in the map. The key provides the name of the column. The value is
-an SQL string used to specify how the column is calculated.
+To create dynamic columns you can pass in a Map. A column will be
+returned for each entry in the map. The key provides the name of the column. The value is
+an SQL string or an `Expr` that specifies how the column is calculated. An `Expr` built
+with `col` keeps the exact, case-sensitive column name.
For example, an SQL query might state `SELECT a + b AS combined, c`. The equivalent
-input to this method would be:
+input to this method would be `new Map([["combined", "a + b"], ["c", "c"]])`.
+
+Columns will always be returned in the order given, even if that order is different than
+the order used when adding the data.
+
+Note that you can pass in a `Record` (e.g. an object literal). This
+method uses `Object.entries` which should preserve the insertion order of the object.
+However, object insertion order is easy to get wrong and `Map` is more foolproof.
#### Parameters
-* **columns**: `string` \| `string`[] \| `Map`<`string`, `string`> \| `Record`<`string`, `string`>
+* **columns**: `string` \| `string`[] \| `Map`<`string`, `string` \| [`Expr`](Expr.md)> \| `Record`<`string`, `string` \| [`Expr`](Expr.md)>
#### Returns
@@ -209,14 +217,8 @@ input to this method would be:
#### Example
```ts
-new Map([["combined", "a + b"], ["c", "c"]])
-
-Columns will always be returned in the order given, even if that order is different than
-the order used when adding the data.
-
-Note that you can pass in a `Record` (e.g. an object literal). This method
-uses `Object.entries` which should preserve the insertion order of the object. However,
-object insertion order is easy to get wrong and `Map` is more foolproof.
+table.query().select(new Map([["combined", "a + b"], ["c", "c"]]));
+table.query().select({ id: "id", doubled: col("unitPrice").mul(2) });
```
#### Inherited from
diff --git a/docs/src/js/classes/VectorQuery.md b/docs/src/js/classes/VectorQuery.md
index 2eef209bf..3ab4f1068 100644
--- a/docs/src/js/classes/VectorQuery.md
+++ b/docs/src/js/classes/VectorQuery.md
@@ -734,16 +734,24 @@ You can also use this method to create new "dynamic" columns based on your exist
For example, you may not care about "a" or "b" but instead simply want "a + b". This is often
seen in the SELECT clause of an SQL query (e.g. `SELECT a+b FROM my_table`).
-To create dynamic columns you can pass in a Map. A column will be returned
-for each entry in the map. The key provides the name of the column. The value is
-an SQL string used to specify how the column is calculated.
+To create dynamic columns you can pass in a Map. A column will be
+returned for each entry in the map. The key provides the name of the column. The value is
+an SQL string or an `Expr` that specifies how the column is calculated. An `Expr` built
+with `col` keeps the exact, case-sensitive column name.
For example, an SQL query might state `SELECT a + b AS combined, c`. The equivalent
-input to this method would be:
+input to this method would be `new Map([["combined", "a + b"], ["c", "c"]])`.
+
+Columns will always be returned in the order given, even if that order is different than
+the order used when adding the data.
+
+Note that you can pass in a `Record` (e.g. an object literal). This
+method uses `Object.entries` which should preserve the insertion order of the object.
+However, object insertion order is easy to get wrong and `Map` is more foolproof.
#### Parameters
-* **columns**: `string` \| `string`[] \| `Map`<`string`, `string`> \| `Record`<`string`, `string`>
+* **columns**: `string` \| `string`[] \| `Map`<`string`, `string` \| [`Expr`](Expr.md)> \| `Record`<`string`, `string` \| [`Expr`](Expr.md)>
#### Returns
@@ -752,14 +760,8 @@ input to this method would be:
#### Example
```ts
-new Map([["combined", "a + b"], ["c", "c"]])
-
-Columns will always be returned in the order given, even if that order is different than
-the order used when adding the data.
-
-Note that you can pass in a `Record` (e.g. an object literal). This method
-uses `Object.entries` which should preserve the insertion order of the object. However,
-object insertion order is easy to get wrong and `Map` is more foolproof.
+table.query().select(new Map([["combined", "a + b"], ["c", "c"]]));
+table.query().select({ id: "id", doubled: col("unitPrice").mul(2) });
```
#### Inherited from
diff --git a/docs/src/js/interfaces/QueryExecutionOptions.md b/docs/src/js/interfaces/QueryExecutionOptions.md
index cd36343b8..65c01a3fd 100644
--- a/docs/src/js/interfaces/QueryExecutionOptions.md
+++ b/docs/src/js/interfaces/QueryExecutionOptions.md
@@ -26,8 +26,9 @@ How to return blob v2 columns. Applies to `toArrow()` and `toArray()`.
called. All the bytes are held in memory.
Selecting a parent struct or directly aliasing a blob or struct also returns
-bytes. Blobs inside lists keep their descriptors. Arbitrary projection
-expressions are not materialized as bytes.
+bytes, including through an `Expr` that only references a column, such as
+`col("image")`. Blobs inside lists keep their descriptors. Arbitrary
+projection expressions are not materialized as bytes.
The rows and bytes come from the same snapshot. Remote queries require
authoritative query version and snapshot identity headers, verified again
diff --git a/nodejs/__test__/expr.test.ts b/nodejs/__test__/expr.test.ts
index 492929c04..d2b7c858c 100644
--- a/nodejs/__test__/expr.test.ts
+++ b/nodejs/__test__/expr.test.ts
@@ -5,7 +5,7 @@ import * as http from "http";
import type { AddressInfo } from "net";
import * as tmp from "tmp";
-import { type Table, connect } from "../lancedb";
+import { type Table, blob, connect } from "../lancedb";
import {
Table as ArrowTable,
Field,
@@ -15,6 +15,7 @@ import {
tableToIPC,
} from "../lancedb/arrow";
import { Expr, col, func, lit, litBool, litInt } from "../lancedb/expr";
+import { Index } from "../lancedb/indices";
describe("expr", () => {
describe("col", () => {
@@ -271,6 +272,171 @@ describe("expr", () => {
});
});
+ describe("select", () => {
+ let db: Awaited>;
+ let table: Table;
+ let tmpDir: tmp.DirResult;
+
+ beforeAll(async () => {
+ tmpDir = tmp.dirSync({ unsafeCleanup: true });
+ db = await connect(tmpDir.name);
+ table = await db.createTable("items", [
+ { id: 1, firstName: "Alice", unitPrice: 10, vector: [1, 0] },
+ { id: 2, firstName: "Bob", unitPrice: 20, vector: [0, 1] },
+ { id: 3, firstName: "Charlie", unitPrice: 30, vector: [-1, 0] },
+ ]);
+ await table.createIndex("firstName", { config: Index.fts() });
+ });
+
+ afterAll(() => {
+ table.close();
+ db.close();
+ tmpDir.removeCallback();
+ });
+
+ it("accepts Expr values in a Map, mixed with SQL strings", async () => {
+ const rows = await table
+ .query()
+ .select(
+ new Map([
+ ["id", "id"],
+ ["name", col("firstName")],
+ ["doubled", col("unitPrice").mul(2)],
+ ]),
+ )
+ .toArray();
+ expect(Object.keys(rows[0])).toEqual(["id", "name", "doubled"]);
+ expect(rows.map((row) => [row.id, row.name, row.doubled])).toEqual([
+ [1, "Alice", 20],
+ [2, "Bob", 40],
+ [3, "Charlie", 60],
+ ]);
+ });
+
+ it("accepts Expr values in a Record, mixed with SQL strings", async () => {
+ const [row] = await table
+ .query()
+ .where(col("firstName").eq("Bob"))
+ .select({
+ shout: col("firstName").upper(),
+ quiet: func("lower", col("firstName")),
+ id: "id",
+ })
+ .toArray();
+ expect(Object.keys(row)).toEqual(["shout", "quiet", "id"]);
+ expect([row.shout, row.quiet, row.id]).toEqual(["BOB", "bob", 2]);
+ });
+
+ it("accepts Expr values in a vector query", async () => {
+ const rows = await table
+ .vectorSearch([1, 0])
+ .select({ name: col("firstName"), doubled: col("unitPrice").mul(2) })
+ .limit(1)
+ .toArray();
+ expect(rows).toHaveLength(1);
+ expect([rows[0].name, rows[0].doubled]).toEqual(["Alice", 20]);
+ });
+
+ it("accepts Expr values in an automatic search", async () => {
+ const rows = await table
+ .search("Bob")
+ .select({ name: col("firstName"), doubled: col("unitPrice").mul(2) })
+ .toArray();
+ expect(rows).toHaveLength(1);
+ expect([rows[0].name, rows[0].doubled]).toEqual(["Bob", 40]);
+ });
+
+ it("accepts Expr values in a take query", async () => {
+ const rows = await table
+ .takeOffsets([2, 0])
+ .select(
+ new Map([
+ ["name", col("firstName")],
+ ["doubled", col("unitPrice").mul(2)],
+ ]),
+ )
+ .toArray();
+ expect(
+ rows.map((row) => [row.name, row.doubled]).sort((a, b) => a[1] - b[1]),
+ ).toEqual([
+ ["Alice", 20],
+ ["Charlie", 60],
+ ]);
+ });
+
+ it("rejects a value that is neither SQL nor an Expr", () => {
+ const select = () => table.query().select({ id: 1 as unknown as string });
+ expect(select).toThrow(TypeError);
+ expect(select).toThrow(
+ 'select() values must be SQL strings or Expr objects, got number for "id"',
+ );
+ });
+
+ describe("with blobMode bytes", () => {
+ const alpha = Buffer.from("alpha");
+ const beta = Buffer.from("beta");
+ let blobs: Table;
+
+ beforeAll(async () => {
+ const schema = new Schema([
+ new Field("id", new Int64(), true),
+ blob("imageData"),
+ ]);
+ blobs = await db.createTable(
+ "blobs",
+ [
+ { id: 1n, imageData: alpha },
+ { id: 2n, imageData: beta },
+ ],
+ { schema },
+ );
+ });
+
+ afterAll(() => {
+ blobs.close();
+ });
+
+ it("fills a camelCase blob column renamed with col()", async () => {
+ const [row] = await blobs
+ .query()
+ .where("id = 2")
+ .select(
+ new Map([
+ ["key", "id"],
+ ["picture", col("imageData")],
+ ]),
+ )
+ .toArray({ blobMode: "bytes" });
+ expect(Object.keys(row)).toEqual(["key", "picture"]);
+ expect(Number(row.key)).toBe(2);
+ expect(Buffer.from(row.picture)).toEqual(beta);
+ });
+
+ it("fills a blob column next to a computed Expr", async () => {
+ const rows = await blobs
+ .query()
+ .select({ imageData: col("imageData"), next: col("id").add(1) })
+ .toArray({ blobMode: "bytes" });
+ expect(Object.keys(rows[0])).toEqual(["imageData", "next"]);
+ expect(
+ rows.map((row) => [Buffer.from(row.imageData), Number(row.next)]),
+ ).toEqual([
+ [alpha, 2],
+ [beta, 3],
+ ]);
+ });
+
+ it("fills a blob column selected with col() in a take query", async () => {
+ const rows = await blobs
+ .takeOffsets([0])
+ .select({ picture: col("imageData") })
+ .toArray({ blobMode: "bytes" });
+ expect(Object.keys(rows[0])).toEqual(["picture"]);
+ expect(Buffer.from(rows[0].picture)).toEqual(alpha);
+ });
+ });
+ });
+
it("sends a quoted expression value to remote as one literal", async () => {
const value = "\\') OR true --";
const schema = new Schema([
diff --git a/nodejs/lancedb/query.ts b/nodejs/lancedb/query.ts
index 6b72f19fd..7ac58c3bb 100644
--- a/nodejs/lancedb/query.ts
+++ b/nodejs/lancedb/query.ts
@@ -283,8 +283,9 @@ export interface QueryExecutionOptions {
* called. All the bytes are held in memory.
*
* Selecting a parent struct or directly aliasing a blob or struct also returns
- * bytes. Blobs inside lists keep their descriptors. Arbitrary projection
- * expressions are not materialized as bytes.
+ * bytes, including through an `Expr` that only references a column, such as
+ * `col("image")`. Blobs inside lists keep their descriptors. Arbitrary
+ * projection expressions are not materialized as bytes.
*
* The rows and bytes come from the same snapshot. Remote queries require
* authoritative query version and snapshot identity headers, verified again
@@ -416,34 +417,62 @@ export class QueryBase<
* For example, you may not care about "a" or "b" but instead simply want "a + b". This is often
* seen in the SELECT clause of an SQL query (e.g. `SELECT a+b FROM my_table`).
*
- * To create dynamic columns you can pass in a Map. A column will be returned
- * for each entry in the map. The key provides the name of the column. The value is
- * an SQL string used to specify how the column is calculated.
+ * To create dynamic columns you can pass in a Map. A column will be
+ * returned for each entry in the map. The key provides the name of the column. The value is
+ * an SQL string or an `Expr` that specifies how the column is calculated. An `Expr` built
+ * with `col` keeps the exact, case-sensitive column name.
*
* For example, an SQL query might state `SELECT a + b AS combined, c`. The equivalent
- * input to this method would be:
- * @example
- * new Map([["combined", "a + b"], ["c", "c"]])
+ * input to this method would be `new Map([["combined", "a + b"], ["c", "c"]])`.
*
* Columns will always be returned in the order given, even if that order is different than
* the order used when adding the data.
*
- * Note that you can pass in a `Record` (e.g. an object literal). This method
- * uses `Object.entries` which should preserve the insertion order of the object. However,
- * object insertion order is easy to get wrong and `Map` is more foolproof.
+ * Note that you can pass in a `Record` (e.g. an object literal). This
+ * method uses `Object.entries` which should preserve the insertion order of the object.
+ * However, object insertion order is easy to get wrong and `Map` is more foolproof.
+ *
+ * @example
+ * ```ts
+ * table.query().select(new Map([["combined", "a + b"], ["c", "c"]]));
+ * table.query().select({ id: "id", doubled: col("unitPrice").mul(2) });
+ * ```
*/
select(
- columns: string[] | Map | Record | string,
+ columns:
+ | string[]
+ | Map
+ | Record
+ | string,
): this {
const selectColumns = (columnArray: string[]) => {
this.doCall((inner: NativeQueryType) => {
inner.selectColumns(columnArray);
});
};
- const selectMapping = (columnTuples: [string, string][]) => {
+ const selectMapping = (entries: [string, string | Expr][]) => {
+ const columnTuples: [string, string][] = [];
+ const sources: [string, string][] = [];
+ for (const [name, value] of entries) {
+ if (value instanceof Expr) {
+ const sql = value.toSql();
+ columnTuples.push([name, sql]);
+ // toSql() quotes camelCase names and SQL keywords, so blobMode
+ // matches a bare column reference by its plain name instead.
+ sources.push([name, value.inner.columnName() ?? sql]);
+ } else if (typeof value === "string") {
+ columnTuples.push([name, value]);
+ sources.push([name, value]);
+ } else {
+ throw new TypeError(
+ `select() values must be SQL strings or Expr objects, got ${typeof value} for "${name}"`,
+ );
+ }
+ }
this.doCall((inner: NativeQueryType) => {
inner.select(columnTuples);
});
+ return sources;
};
let projection: [string, string][];
@@ -454,11 +483,9 @@ export class QueryBase<
selectColumns(columns);
projection = columns.map((column) => [column, column]);
} else if (columns instanceof Map) {
- projection = Array.from(columns.entries());
- selectMapping(projection);
+ projection = selectMapping(Array.from(columns.entries()));
} else {
- projection = Object.entries(columns);
- selectMapping(projection);
+ projection = selectMapping(Object.entries(columns));
}
if (this.blobContext !== undefined) {
this.blobContext = { ...this.blobContext, projection };
diff --git a/nodejs/src/expr.rs b/nodejs/src/expr.rs
index c12f81a96..0ea18e55d 100644
--- a/nodejs/src/expr.rs
+++ b/nodejs/src/expr.rs
@@ -163,6 +163,15 @@ impl Expr {
})
}
+ /// The column name when this is a bare column reference, otherwise null.
+ #[napi]
+ pub fn column_name(&self) -> Option {
+ match &self.inner {
+ DfExpr::Column(column) if column.relation.is_none() => Some(column.name.clone()),
+ _ => None,
+ }
+ }
+
#[napi]
pub fn to_sql(&self) -> napi::Result {
lancedb::expr::expr_to_sql_string(&self.inner)
From 6acc3b6d911358afcb9d010edf0a3f4ae51d248e Mon Sep 17 00:00:00 2001
From: LanceDB Robot
Date: Fri, 27 Nov 2026 01:39:42 -0800
Subject: [PATCH 5/6] chore: update lance dependency to v16.0.0-beta.5
---
Cargo.lock | 96 +++++++++++++++++++++----------------------
Cargo.toml | 30 +++++++-------
java/pom.xml | 2 +-
python/pyproject.toml | 2 +-
python/uv.lock | 18 ++++----
5 files changed, 74 insertions(+), 74 deletions(-)
diff --git a/Cargo.lock b/Cargo.lock
index a05c79992..b710c22f9 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -3836,8 +3836,8 @@ checksum = "42703706b716c37f96a77aea830392ad231f44c9e9a67872fa5548707e11b11c"
[[package]]
name = "fsst"
-version = "16.0.0-beta.4"
-source = "git+https://github.com/lance-format/lance.git?tag=v16.0.0-beta.4#1686234925dde0289409fa31ff615d724943ccb6"
+version = "16.0.0-beta.5"
+source = "git+https://github.com/lance-format/lance.git?tag=v16.0.0-beta.5#0ea718506941b3e4c8dd0aee279a8ea1b7c7b076"
dependencies = [
"arrow-array",
"rand 0.9.5",
@@ -5315,8 +5315,8 @@ checksum = "e037a2e1d8d5fdbd49b16a4ea09d5d6401c1f29eca5ff29d03d3824dba16256a"
[[package]]
name = "lance"
-version = "16.0.0-beta.4"
-source = "git+https://github.com/lance-format/lance.git?tag=v16.0.0-beta.4#1686234925dde0289409fa31ff615d724943ccb6"
+version = "16.0.0-beta.5"
+source = "git+https://github.com/lance-format/lance.git?tag=v16.0.0-beta.5#0ea718506941b3e4c8dd0aee279a8ea1b7c7b076"
dependencies = [
"arc-swap",
"arrow",
@@ -5392,8 +5392,8 @@ dependencies = [
[[package]]
name = "lance-arrow"
-version = "16.0.0-beta.4"
-source = "git+https://github.com/lance-format/lance.git?tag=v16.0.0-beta.4#1686234925dde0289409fa31ff615d724943ccb6"
+version = "16.0.0-beta.5"
+source = "git+https://github.com/lance-format/lance.git?tag=v16.0.0-beta.5#0ea718506941b3e4c8dd0aee279a8ea1b7c7b076"
dependencies = [
"arrow-array",
"arrow-buffer",
@@ -5416,8 +5416,8 @@ dependencies = [
[[package]]
name = "lance-bitpacking"
-version = "16.0.0-beta.4"
-source = "git+https://github.com/lance-format/lance.git?tag=v16.0.0-beta.4#1686234925dde0289409fa31ff615d724943ccb6"
+version = "16.0.0-beta.5"
+source = "git+https://github.com/lance-format/lance.git?tag=v16.0.0-beta.5#0ea718506941b3e4c8dd0aee279a8ea1b7c7b076"
dependencies = [
"arrayref",
"crunchy",
@@ -5427,8 +5427,8 @@ dependencies = [
[[package]]
name = "lance-core"
-version = "16.0.0-beta.4"
-source = "git+https://github.com/lance-format/lance.git?tag=v16.0.0-beta.4#1686234925dde0289409fa31ff615d724943ccb6"
+version = "16.0.0-beta.5"
+source = "git+https://github.com/lance-format/lance.git?tag=v16.0.0-beta.5#0ea718506941b3e4c8dd0aee279a8ea1b7c7b076"
dependencies = [
"arrow-array",
"arrow-buffer",
@@ -5466,8 +5466,8 @@ dependencies = [
[[package]]
name = "lance-datafusion"
-version = "16.0.0-beta.4"
-source = "git+https://github.com/lance-format/lance.git?tag=v16.0.0-beta.4#1686234925dde0289409fa31ff615d724943ccb6"
+version = "16.0.0-beta.5"
+source = "git+https://github.com/lance-format/lance.git?tag=v16.0.0-beta.5#0ea718506941b3e4c8dd0aee279a8ea1b7c7b076"
dependencies = [
"arrow",
"arrow-array",
@@ -5498,8 +5498,8 @@ dependencies = [
[[package]]
name = "lance-datafusion-exec"
-version = "16.0.0-beta.4"
-source = "git+https://github.com/lance-format/lance.git?tag=v16.0.0-beta.4#1686234925dde0289409fa31ff615d724943ccb6"
+version = "16.0.0-beta.5"
+source = "git+https://github.com/lance-format/lance.git?tag=v16.0.0-beta.5#0ea718506941b3e4c8dd0aee279a8ea1b7c7b076"
dependencies = [
"arrow",
"arrow-array",
@@ -5525,8 +5525,8 @@ dependencies = [
[[package]]
name = "lance-datagen"
-version = "16.0.0-beta.4"
-source = "git+https://github.com/lance-format/lance.git?tag=v16.0.0-beta.4#1686234925dde0289409fa31ff615d724943ccb6"
+version = "16.0.0-beta.5"
+source = "git+https://github.com/lance-format/lance.git?tag=v16.0.0-beta.5#0ea718506941b3e4c8dd0aee279a8ea1b7c7b076"
dependencies = [
"arrow",
"arrow-array",
@@ -5543,8 +5543,8 @@ dependencies = [
[[package]]
name = "lance-derive"
-version = "16.0.0-beta.4"
-source = "git+https://github.com/lance-format/lance.git?tag=v16.0.0-beta.4#1686234925dde0289409fa31ff615d724943ccb6"
+version = "16.0.0-beta.5"
+source = "git+https://github.com/lance-format/lance.git?tag=v16.0.0-beta.5#0ea718506941b3e4c8dd0aee279a8ea1b7c7b076"
dependencies = [
"proc-macro2",
"quote",
@@ -5553,8 +5553,8 @@ dependencies = [
[[package]]
name = "lance-encoding"
-version = "16.0.0-beta.4"
-source = "git+https://github.com/lance-format/lance.git?tag=v16.0.0-beta.4#1686234925dde0289409fa31ff615d724943ccb6"
+version = "16.0.0-beta.5"
+source = "git+https://github.com/lance-format/lance.git?tag=v16.0.0-beta.5#0ea718506941b3e4c8dd0aee279a8ea1b7c7b076"
dependencies = [
"arrow-arith",
"arrow-array",
@@ -5588,8 +5588,8 @@ dependencies = [
[[package]]
name = "lance-file"
-version = "16.0.0-beta.4"
-source = "git+https://github.com/lance-format/lance.git?tag=v16.0.0-beta.4#1686234925dde0289409fa31ff615d724943ccb6"
+version = "16.0.0-beta.5"
+source = "git+https://github.com/lance-format/lance.git?tag=v16.0.0-beta.5#0ea718506941b3e4c8dd0aee279a8ea1b7c7b076"
dependencies = [
"arrow-arith",
"arrow-array",
@@ -5619,8 +5619,8 @@ dependencies = [
[[package]]
name = "lance-geo"
-version = "16.0.0-beta.4"
-source = "git+https://github.com/lance-format/lance.git?tag=v16.0.0-beta.4#1686234925dde0289409fa31ff615d724943ccb6"
+version = "16.0.0-beta.5"
+source = "git+https://github.com/lance-format/lance.git?tag=v16.0.0-beta.5#0ea718506941b3e4c8dd0aee279a8ea1b7c7b076"
dependencies = [
"arrow-array",
"arrow-schema",
@@ -5651,8 +5651,8 @@ dependencies = [
[[package]]
name = "lance-index"
-version = "16.0.0-beta.4"
-source = "git+https://github.com/lance-format/lance.git?tag=v16.0.0-beta.4#1686234925dde0289409fa31ff615d724943ccb6"
+version = "16.0.0-beta.5"
+source = "git+https://github.com/lance-format/lance.git?tag=v16.0.0-beta.5#0ea718506941b3e4c8dd0aee279a8ea1b7c7b076"
dependencies = [
"arc-swap",
"arrow",
@@ -5724,8 +5724,8 @@ dependencies = [
[[package]]
name = "lance-index-core"
-version = "16.0.0-beta.4"
-source = "git+https://github.com/lance-format/lance.git?tag=v16.0.0-beta.4#1686234925dde0289409fa31ff615d724943ccb6"
+version = "16.0.0-beta.5"
+source = "git+https://github.com/lance-format/lance.git?tag=v16.0.0-beta.5#0ea718506941b3e4c8dd0aee279a8ea1b7c7b076"
dependencies = [
"arrow-array",
"arrow-schema",
@@ -5748,8 +5748,8 @@ dependencies = [
[[package]]
name = "lance-io"
-version = "16.0.0-beta.4"
-source = "git+https://github.com/lance-format/lance.git?tag=v16.0.0-beta.4#1686234925dde0289409fa31ff615d724943ccb6"
+version = "16.0.0-beta.5"
+source = "git+https://github.com/lance-format/lance.git?tag=v16.0.0-beta.5#0ea718506941b3e4c8dd0aee279a8ea1b7c7b076"
dependencies = [
"arrow",
"arrow-array",
@@ -5794,8 +5794,8 @@ dependencies = [
[[package]]
name = "lance-jsonb"
-version = "16.0.0-beta.4"
-source = "git+https://github.com/lance-format/lance.git?tag=v16.0.0-beta.4#1686234925dde0289409fa31ff615d724943ccb6"
+version = "16.0.0-beta.5"
+source = "git+https://github.com/lance-format/lance.git?tag=v16.0.0-beta.5#0ea718506941b3e4c8dd0aee279a8ea1b7c7b076"
dependencies = [
"byteorder",
"ethnum",
@@ -5812,8 +5812,8 @@ dependencies = [
[[package]]
name = "lance-linalg"
-version = "16.0.0-beta.4"
-source = "git+https://github.com/lance-format/lance.git?tag=v16.0.0-beta.4#1686234925dde0289409fa31ff615d724943ccb6"
+version = "16.0.0-beta.5"
+source = "git+https://github.com/lance-format/lance.git?tag=v16.0.0-beta.5#0ea718506941b3e4c8dd0aee279a8ea1b7c7b076"
dependencies = [
"argminmax 0.7.1",
"arrow-array",
@@ -5828,8 +5828,8 @@ dependencies = [
[[package]]
name = "lance-namespace"
-version = "16.0.0-beta.4"
-source = "git+https://github.com/lance-format/lance.git?tag=v16.0.0-beta.4#1686234925dde0289409fa31ff615d724943ccb6"
+version = "16.0.0-beta.5"
+source = "git+https://github.com/lance-format/lance.git?tag=v16.0.0-beta.5#0ea718506941b3e4c8dd0aee279a8ea1b7c7b076"
dependencies = [
"arrow",
"async-trait",
@@ -5843,8 +5843,8 @@ dependencies = [
[[package]]
name = "lance-namespace-impls"
-version = "16.0.0-beta.4"
-source = "git+https://github.com/lance-format/lance.git?tag=v16.0.0-beta.4#1686234925dde0289409fa31ff615d724943ccb6"
+version = "16.0.0-beta.5"
+source = "git+https://github.com/lance-format/lance.git?tag=v16.0.0-beta.5#0ea718506941b3e4c8dd0aee279a8ea1b7c7b076"
dependencies = [
"arc-swap",
"arrow",
@@ -5898,8 +5898,8 @@ dependencies = [
[[package]]
name = "lance-select"
-version = "16.0.0-beta.4"
-source = "git+https://github.com/lance-format/lance.git?tag=v16.0.0-beta.4#1686234925dde0289409fa31ff615d724943ccb6"
+version = "16.0.0-beta.5"
+source = "git+https://github.com/lance-format/lance.git?tag=v16.0.0-beta.5#0ea718506941b3e4c8dd0aee279a8ea1b7c7b076"
dependencies = [
"arrow-array",
"arrow-buffer",
@@ -5913,8 +5913,8 @@ dependencies = [
[[package]]
name = "lance-table"
-version = "16.0.0-beta.4"
-source = "git+https://github.com/lance-format/lance.git?tag=v16.0.0-beta.4#1686234925dde0289409fa31ff615d724943ccb6"
+version = "16.0.0-beta.5"
+source = "git+https://github.com/lance-format/lance.git?tag=v16.0.0-beta.5#0ea718506941b3e4c8dd0aee279a8ea1b7c7b076"
dependencies = [
"arrow",
"arrow-array",
@@ -5955,8 +5955,8 @@ dependencies = [
[[package]]
name = "lance-table-runtime"
-version = "16.0.0-beta.4"
-source = "git+https://github.com/lance-format/lance.git?tag=v16.0.0-beta.4#1686234925dde0289409fa31ff615d724943ccb6"
+version = "16.0.0-beta.5"
+source = "git+https://github.com/lance-format/lance.git?tag=v16.0.0-beta.5#0ea718506941b3e4c8dd0aee279a8ea1b7c7b076"
dependencies = [
"arrow-array",
"arrow-buffer",
@@ -6000,8 +6000,8 @@ dependencies = [
[[package]]
name = "lance-testing"
-version = "16.0.0-beta.4"
-source = "git+https://github.com/lance-format/lance.git?tag=v16.0.0-beta.4#1686234925dde0289409fa31ff615d724943ccb6"
+version = "16.0.0-beta.5"
+source = "git+https://github.com/lance-format/lance.git?tag=v16.0.0-beta.5#0ea718506941b3e4c8dd0aee279a8ea1b7c7b076"
dependencies = [
"arrow-array",
"arrow-schema",
@@ -6014,8 +6014,8 @@ dependencies = [
[[package]]
name = "lance-tokenizer"
-version = "16.0.0-beta.4"
-source = "git+https://github.com/lance-format/lance.git?tag=v16.0.0-beta.4#1686234925dde0289409fa31ff615d724943ccb6"
+version = "16.0.0-beta.5"
+source = "git+https://github.com/lance-format/lance.git?tag=v16.0.0-beta.5#0ea718506941b3e4c8dd0aee279a8ea1b7c7b076"
dependencies = [
"frostem",
"icu_segmenter",
diff --git a/Cargo.toml b/Cargo.toml
index e21f256f3..b8a67273a 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -19,21 +19,21 @@ categories = ["database-implementations"]
rust-version = "1.98.0"
[workspace.dependencies]
-lance = { "version" = "=16.0.0-beta.4", default-features = false, "tag" = "v16.0.0-beta.4", "git" = "https://github.com/lance-format/lance.git" }
-lance-core = { "version" = "=16.0.0-beta.4", "tag" = "v16.0.0-beta.4", "git" = "https://github.com/lance-format/lance.git" }
-lance-datagen = { "version" = "=16.0.0-beta.4", "tag" = "v16.0.0-beta.4", "git" = "https://github.com/lance-format/lance.git" }
-lance-file = { "version" = "=16.0.0-beta.4", "tag" = "v16.0.0-beta.4", "git" = "https://github.com/lance-format/lance.git" }
-lance-io = { "version" = "=16.0.0-beta.4", default-features = false, "tag" = "v16.0.0-beta.4", "git" = "https://github.com/lance-format/lance.git" }
-lance-index = { "version" = "=16.0.0-beta.4", "tag" = "v16.0.0-beta.4", "git" = "https://github.com/lance-format/lance.git" }
-lance-jsonb = { "version" = "=16.0.0-beta.4", "tag" = "v16.0.0-beta.4", "git" = "https://github.com/lance-format/lance.git" }
-lance-linalg = { "version" = "=16.0.0-beta.4", "tag" = "v16.0.0-beta.4", "git" = "https://github.com/lance-format/lance.git" }
-lance-namespace = { "version" = "=16.0.0-beta.4", "tag" = "v16.0.0-beta.4", "git" = "https://github.com/lance-format/lance.git" }
-lance-namespace-impls = { "version" = "=16.0.0-beta.4", default-features = false, "tag" = "v16.0.0-beta.4", "git" = "https://github.com/lance-format/lance.git" }
-lance-table = { "version" = "=16.0.0-beta.4", "tag" = "v16.0.0-beta.4", "git" = "https://github.com/lance-format/lance.git" }
-lance-testing = { "version" = "=16.0.0-beta.4", "tag" = "v16.0.0-beta.4", "git" = "https://github.com/lance-format/lance.git" }
-lance-datafusion = { "version" = "=16.0.0-beta.4", "tag" = "v16.0.0-beta.4", "git" = "https://github.com/lance-format/lance.git" }
-lance-encoding = { "version" = "=16.0.0-beta.4", "tag" = "v16.0.0-beta.4", "git" = "https://github.com/lance-format/lance.git" }
-lance-arrow = { "version" = "=16.0.0-beta.4", "tag" = "v16.0.0-beta.4", "git" = "https://github.com/lance-format/lance.git" }
+lance = { "version" = "=16.0.0-beta.5", default-features = false, "tag" = "v16.0.0-beta.5", "git" = "https://github.com/lance-format/lance.git" }
+lance-core = { "version" = "=16.0.0-beta.5", "tag" = "v16.0.0-beta.5", "git" = "https://github.com/lance-format/lance.git" }
+lance-datagen = { "version" = "=16.0.0-beta.5", "tag" = "v16.0.0-beta.5", "git" = "https://github.com/lance-format/lance.git" }
+lance-file = { "version" = "=16.0.0-beta.5", "tag" = "v16.0.0-beta.5", "git" = "https://github.com/lance-format/lance.git" }
+lance-io = { "version" = "=16.0.0-beta.5", default-features = false, "tag" = "v16.0.0-beta.5", "git" = "https://github.com/lance-format/lance.git" }
+lance-index = { "version" = "=16.0.0-beta.5", "tag" = "v16.0.0-beta.5", "git" = "https://github.com/lance-format/lance.git" }
+lance-jsonb = { "version" = "=16.0.0-beta.5", "tag" = "v16.0.0-beta.5", "git" = "https://github.com/lance-format/lance.git" }
+lance-linalg = { "version" = "=16.0.0-beta.5", "tag" = "v16.0.0-beta.5", "git" = "https://github.com/lance-format/lance.git" }
+lance-namespace = { "version" = "=16.0.0-beta.5", "tag" = "v16.0.0-beta.5", "git" = "https://github.com/lance-format/lance.git" }
+lance-namespace-impls = { "version" = "=16.0.0-beta.5", default-features = false, "tag" = "v16.0.0-beta.5", "git" = "https://github.com/lance-format/lance.git" }
+lance-table = { "version" = "=16.0.0-beta.5", "tag" = "v16.0.0-beta.5", "git" = "https://github.com/lance-format/lance.git" }
+lance-testing = { "version" = "=16.0.0-beta.5", "tag" = "v16.0.0-beta.5", "git" = "https://github.com/lance-format/lance.git" }
+lance-datafusion = { "version" = "=16.0.0-beta.5", "tag" = "v16.0.0-beta.5", "git" = "https://github.com/lance-format/lance.git" }
+lance-encoding = { "version" = "=16.0.0-beta.5", "tag" = "v16.0.0-beta.5", "git" = "https://github.com/lance-format/lance.git" }
+lance-arrow = { "version" = "=16.0.0-beta.5", "tag" = "v16.0.0-beta.5", "git" = "https://github.com/lance-format/lance.git" }
lancedb = { path = "rust/lancedb", default-features = false }
ahash = "0.8"
anyhow = "1"
diff --git a/java/pom.xml b/java/pom.xml
index a0a2a6ee3..48f9958e3 100644
--- a/java/pom.xml
+++ b/java/pom.xml
@@ -28,7 +28,7 @@
UTF-8
15.0.0
- 16.0.0-beta.4
+ 16.0.0-beta.5
2.18.12
false
2.30.0
diff --git a/python/pyproject.toml b/python/pyproject.toml
index b0fa12adc..e05e2c705 100644
--- a/python/pyproject.toml
+++ b/python/pyproject.toml
@@ -64,7 +64,7 @@ tests = [
"polars>=0.19, <=1.32.3",
"pyarrow>=16",
"pyarrow-stubs>=16.0",
- "pylance==16.0.0b4",
+ "pylance==16.0.0b5",
"requests>=2.31.0",
"datafusion>=54,<55",
"opentelemetry-sdk>=1.30.0",
diff --git a/python/uv.lock b/python/uv.lock
index 90b13bcb2..86a1611b6 100644
--- a/python/uv.lock
+++ b/python/uv.lock
@@ -1912,7 +1912,7 @@ requires-dist = [
{ name = "pyarrow-stubs", marker = "extra == 'tests'", specifier = ">=16.0" },
{ name = "pydantic", specifier = ">=2.7.4,<3" },
{ name = "pylance", marker = "extra == 'pylance'", specifier = ">=16.0.0b2" },
- { name = "pylance", marker = "extra == 'tests'", specifier = "==16.0.0b4" },
+ { name = "pylance", marker = "extra == 'tests'", specifier = "==16.0.0b5" },
{ name = "pyright", marker = "extra == 'dev'", specifier = ">=1.1.350" },
{ name = "pytest", marker = "extra == 'tests'", specifier = ">=7.0" },
{ name = "pytest-asyncio", marker = "extra == 'tests'", specifier = ">=0.21" },
@@ -3649,20 +3649,20 @@ crypto = [
[[package]]
name = "pylance"
-version = "16.0.0b4"
+version = "16.0.0b5"
source = { registry = "https://pypi.fury.io/lance-format/" }
dependencies = [
{ name = "lance-namespace" },
{ name = "pyarrow" },
]
wheels = [
- { url = "https://pypi.fury.io/lance-format/-/ver_oJPBj/pylance-16.0.0b4-cp310-abi3-macosx_11_0_arm64.whl", hash = "sha256:495789f4c6376aed8c5ad41fd04a828910120245e7d021cc2f59651f01ec7e45" },
- { url = "https://pypi.fury.io/lance-format/-/ver_bll8w/pylance-16.0.0b4-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:7579acd634b3d1513bb836d437d1f13bc4eb76625b0795e65b583007b16f223b" },
- { url = "https://pypi.fury.io/lance-format/-/ver_2d4iLq/pylance-16.0.0b4-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:e5cf1c63d612ac36141399ceff30f46be16e537cd4d01562bc0453e8d79f19e8" },
- { url = "https://pypi.fury.io/lance-format/-/ver_1X7cLu/pylance-16.0.0b4-cp310-abi3-manylinux_2_28_aarch64.whl", hash = "sha256:b478f6ffef5a4e938e5578a6ec8f5b00866098b253daadd8f704008851d58417" },
- { url = "https://pypi.fury.io/lance-format/-/ver_pZ4HP/pylance-16.0.0b4-cp310-abi3-manylinux_2_28_x86_64.whl", hash = "sha256:be9d95a9d22dad0371139faf982297cdd918aded1d59bc3ab4dd27394f55ba79" },
- { url = "https://pypi.fury.io/lance-format/-/ver_1M3BoM/pylance-16.0.0b4-cp310-abi3-win_amd64.whl", hash = "sha256:1f84164d895df4522722cc7f8f10eaa42449c3c997f25476fb07ab48ef3b2969" },
- { url = "https://pypi.fury.io/lance-format/-/ver_1AAGRf/pylance-16.0.0b4-cp310-abi3-win_arm64.whl", hash = "sha256:9423e6f4edef4f4048fab6cde69dd5cf2d2acdfc6dbe6171ce720753136b6b0a" },
+ { url = "https://pypi.fury.io/lance-format/-/ver_FqwvG/pylance-16.0.0b5-cp310-abi3-macosx_11_0_arm64.whl", hash = "sha256:9af1722a63e0955e4c0a5dc6e88a543a7a0a4e7b5684734259a7dda797093b10" },
+ { url = "https://pypi.fury.io/lance-format/-/ver_ILl4l/pylance-16.0.0b5-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:67d7cdc4cc05542bcab58fec45b221eb58f4d43f2913347f6438dce7104b3c2a" },
+ { url = "https://pypi.fury.io/lance-format/-/ver_qJKmC/pylance-16.0.0b5-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:f2f61729281f80c56ae5b2f237f6a4953f5499dbabda1c7d126942705665a2f1" },
+ { url = "https://pypi.fury.io/lance-format/-/ver_2b3acP/pylance-16.0.0b5-cp310-abi3-manylinux_2_28_aarch64.whl", hash = "sha256:25d6b502672bed79d32b7f07c580ec50228d52aaeb331b5a223b9b3956c4835e" },
+ { url = "https://pypi.fury.io/lance-format/-/ver_quNgL/pylance-16.0.0b5-cp310-abi3-manylinux_2_28_x86_64.whl", hash = "sha256:8d11aa27cb5e4ddbfa4051a4623f91b9a357c10e53989d4dccd5cdb20b904714" },
+ { url = "https://pypi.fury.io/lance-format/-/ver_1X5vSy/pylance-16.0.0b5-cp310-abi3-win_amd64.whl", hash = "sha256:b814413dfc1bc67f6dba51e27d2826e576e4da4b8caf26964174709440d88db3" },
+ { url = "https://pypi.fury.io/lance-format/-/ver_ch7C5/pylance-16.0.0b5-cp310-abi3-win_arm64.whl", hash = "sha256:0f71399e92c9ad0832a761e613a0b5e696a28a2a958cef680ca572ebdeec12e4" },
]
[[package]]
From fdc8041b2a24c86fc25ec36470986afc40d817aa Mon Sep 17 00:00:00 2001
From: Lance Release
Date: Fri, 27 Nov 2026 09:41:08 +0000
Subject: [PATCH 6/6] =?UTF-8?q?Bump=20version:=200.42.0-beta.37=20?=
=?UTF-8?q?=E2=86=92=200.42.0-beta.38?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.bumpversion.toml | 2 +-
Cargo.lock | 8 ++++----
docs/src/java/java.md | 2 +-
java/lancedb-core/pom.xml | 2 +-
java/pom.xml | 2 +-
nodejs/Cargo.toml | 2 +-
nodejs/npm/darwin-arm64/package.json | 2 +-
nodejs/npm/linux-arm64-gnu/package.json | 2 +-
nodejs/npm/linux-arm64-musl/package.json | 2 +-
nodejs/npm/linux-x64-gnu/package.json | 2 +-
nodejs/npm/linux-x64-musl/package.json | 2 +-
nodejs/npm/win32-arm64-msvc/package.json | 2 +-
nodejs/npm/win32-x64-msvc/package.json | 2 +-
nodejs/package.json | 2 +-
python/Cargo.toml | 2 +-
rust/lancedb/Cargo.toml | 2 +-
rust/lancedb/cli/Cargo.toml | 2 +-
17 files changed, 20 insertions(+), 20 deletions(-)
diff --git a/.bumpversion.toml b/.bumpversion.toml
index fec283ac1..7726c9179 100644
--- a/.bumpversion.toml
+++ b/.bumpversion.toml
@@ -1,5 +1,5 @@
[tool.bumpversion]
-current_version = "0.42.0-beta.37"
+current_version = "0.42.0-beta.38"
parse = """(?x)
(?P0|[1-9]\\d*)\\.
(?P0|[1-9]\\d*)\\.
diff --git a/Cargo.lock b/Cargo.lock
index b710c22f9..2bcc69a9c 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -6028,7 +6028,7 @@ dependencies = [
[[package]]
name = "lancedb"
-version = "0.42.0-beta.37"
+version = "0.42.0-beta.38"
dependencies = [
"ahash",
"anyhow",
@@ -6139,7 +6139,7 @@ dependencies = [
[[package]]
name = "lancedb-cli"
-version = "0.42.0-beta.37"
+version = "0.42.0-beta.38"
dependencies = [
"anyhow",
"arrow-array",
@@ -6182,7 +6182,7 @@ dependencies = [
[[package]]
name = "lancedb-nodejs"
-version = "0.42.0-beta.37"
+version = "0.42.0-beta.38"
dependencies = [
"arrow-array",
"arrow-buffer",
@@ -6208,7 +6208,7 @@ dependencies = [
[[package]]
name = "lancedb-python"
-version = "0.42.0-beta.37"
+version = "0.42.0-beta.38"
dependencies = [
"arc-swap",
"arrow",
diff --git a/docs/src/java/java.md b/docs/src/java/java.md
index d392faec8..7149acd93 100644
--- a/docs/src/java/java.md
+++ b/docs/src/java/java.md
@@ -14,7 +14,7 @@ Add the following dependency to your `pom.xml`:
com.lancedb
lancedb-core
- 0.42.0-beta.37
+ 0.42.0-beta.38
```
diff --git a/java/lancedb-core/pom.xml b/java/lancedb-core/pom.xml
index 250dcbda8..5bfbc157f 100644
--- a/java/lancedb-core/pom.xml
+++ b/java/lancedb-core/pom.xml
@@ -8,7 +8,7 @@
com.lancedb
lancedb-parent
- 0.42.0-beta.37
+ 0.42.0-beta.38
../pom.xml
diff --git a/java/pom.xml b/java/pom.xml
index 48f9958e3..7277b628c 100644
--- a/java/pom.xml
+++ b/java/pom.xml
@@ -6,7 +6,7 @@
com.lancedb
lancedb-parent
- 0.42.0-beta.37
+ 0.42.0-beta.38
pom
${project.artifactId}
LanceDB Java SDK Parent POM
diff --git a/nodejs/Cargo.toml b/nodejs/Cargo.toml
index 2c44d4471..7cfb2535c 100644
--- a/nodejs/Cargo.toml
+++ b/nodejs/Cargo.toml
@@ -1,7 +1,7 @@
[package]
name = "lancedb-nodejs"
edition.workspace = true
-version = "0.42.0-beta.37"
+version = "0.42.0-beta.38"
publish = false
license.workspace = true
description.workspace = true
diff --git a/nodejs/npm/darwin-arm64/package.json b/nodejs/npm/darwin-arm64/package.json
index fc6f1a7ea..6a3aead68 100644
--- a/nodejs/npm/darwin-arm64/package.json
+++ b/nodejs/npm/darwin-arm64/package.json
@@ -1,6 +1,6 @@
{
"name": "@lancedb/lancedb-darwin-arm64",
- "version": "0.42.0-beta.37",
+ "version": "0.42.0-beta.38",
"os": ["darwin"],
"cpu": ["arm64"],
"main": "lancedb.darwin-arm64.node",
diff --git a/nodejs/npm/linux-arm64-gnu/package.json b/nodejs/npm/linux-arm64-gnu/package.json
index 41aa1cf3a..ea1506af6 100644
--- a/nodejs/npm/linux-arm64-gnu/package.json
+++ b/nodejs/npm/linux-arm64-gnu/package.json
@@ -1,6 +1,6 @@
{
"name": "@lancedb/lancedb-linux-arm64-gnu",
- "version": "0.42.0-beta.37",
+ "version": "0.42.0-beta.38",
"os": ["linux"],
"cpu": ["arm64"],
"main": "lancedb.linux-arm64-gnu.node",
diff --git a/nodejs/npm/linux-arm64-musl/package.json b/nodejs/npm/linux-arm64-musl/package.json
index 44b9dc419..31e857e27 100644
--- a/nodejs/npm/linux-arm64-musl/package.json
+++ b/nodejs/npm/linux-arm64-musl/package.json
@@ -1,6 +1,6 @@
{
"name": "@lancedb/lancedb-linux-arm64-musl",
- "version": "0.42.0-beta.37",
+ "version": "0.42.0-beta.38",
"os": ["linux"],
"cpu": ["arm64"],
"main": "lancedb.linux-arm64-musl.node",
diff --git a/nodejs/npm/linux-x64-gnu/package.json b/nodejs/npm/linux-x64-gnu/package.json
index 48940a19f..5796d91c9 100644
--- a/nodejs/npm/linux-x64-gnu/package.json
+++ b/nodejs/npm/linux-x64-gnu/package.json
@@ -1,6 +1,6 @@
{
"name": "@lancedb/lancedb-linux-x64-gnu",
- "version": "0.42.0-beta.37",
+ "version": "0.42.0-beta.38",
"os": ["linux"],
"cpu": ["x64"],
"main": "lancedb.linux-x64-gnu.node",
diff --git a/nodejs/npm/linux-x64-musl/package.json b/nodejs/npm/linux-x64-musl/package.json
index 456cc5d97..0f277fa45 100644
--- a/nodejs/npm/linux-x64-musl/package.json
+++ b/nodejs/npm/linux-x64-musl/package.json
@@ -1,6 +1,6 @@
{
"name": "@lancedb/lancedb-linux-x64-musl",
- "version": "0.42.0-beta.37",
+ "version": "0.42.0-beta.38",
"os": ["linux"],
"cpu": ["x64"],
"main": "lancedb.linux-x64-musl.node",
diff --git a/nodejs/npm/win32-arm64-msvc/package.json b/nodejs/npm/win32-arm64-msvc/package.json
index f2d77f108..fc790749f 100644
--- a/nodejs/npm/win32-arm64-msvc/package.json
+++ b/nodejs/npm/win32-arm64-msvc/package.json
@@ -1,6 +1,6 @@
{
"name": "@lancedb/lancedb-win32-arm64-msvc",
- "version": "0.42.0-beta.37",
+ "version": "0.42.0-beta.38",
"os": [
"win32"
],
diff --git a/nodejs/npm/win32-x64-msvc/package.json b/nodejs/npm/win32-x64-msvc/package.json
index f7f192b6d..462fac07b 100644
--- a/nodejs/npm/win32-x64-msvc/package.json
+++ b/nodejs/npm/win32-x64-msvc/package.json
@@ -1,6 +1,6 @@
{
"name": "@lancedb/lancedb-win32-x64-msvc",
- "version": "0.42.0-beta.37",
+ "version": "0.42.0-beta.38",
"os": ["win32"],
"cpu": ["x64"],
"main": "lancedb.win32-x64-msvc.node",
diff --git a/nodejs/package.json b/nodejs/package.json
index 4f89a79e6..3fdc9c76e 100644
--- a/nodejs/package.json
+++ b/nodejs/package.json
@@ -11,7 +11,7 @@
"ann"
],
"private": false,
- "version": "0.42.0-beta.37",
+ "version": "0.42.0-beta.38",
"main": "dist/index.js",
"exports": {
".": "./dist/index.js",
diff --git a/python/Cargo.toml b/python/Cargo.toml
index 45aee7038..dfa849299 100644
--- a/python/Cargo.toml
+++ b/python/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "lancedb-python"
-version = "0.42.0-beta.37"
+version = "0.42.0-beta.38"
publish = false
edition.workspace = true
description = "Python bindings for LanceDB"
diff --git a/rust/lancedb/Cargo.toml b/rust/lancedb/Cargo.toml
index 529a7812e..541d9dfe5 100644
--- a/rust/lancedb/Cargo.toml
+++ b/rust/lancedb/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "lancedb"
-version = "0.42.0-beta.37"
+version = "0.42.0-beta.38"
edition.workspace = true
description = "LanceDB: A serverless, low-latency vector database for AI applications"
license.workspace = true
diff --git a/rust/lancedb/cli/Cargo.toml b/rust/lancedb/cli/Cargo.toml
index 11c70510d..37ee70383 100644
--- a/rust/lancedb/cli/Cargo.toml
+++ b/rust/lancedb/cli/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "lancedb-cli"
-version = "0.42.0-beta.37"
+version = "0.42.0-beta.38"
edition = "2021"
license.workspace = true
repository.workspace = true