From 3e3878b223844cd27cdc58a86d200d6c79097feb Mon Sep 17 00:00:00 2001 From: LanceDB Robot Date: Tue, 8 Sep 2026 05:12:45 -0700 Subject: [PATCH] chore: update lance dependency to v12.0.0-beta.15 (#4143) Updates the Rust workspace Lance dependencies, Cargo lockfile, and Java lance-core from v12.0.0-beta.14 to [v12.0.0-beta.15](https://github.com/lance-format/lance/releases/tag/v12.0.0-beta.15). No compatibility fixes were required; `cargo clippy --quiet --workspace --tests --all-features -- -D warnings`, `cargo fmt --all --quiet`, and `git diff --check` passed. --------- Co-authored-by: Jack Ye --- Cargo.lock | 84 +++++++++++++------------- Cargo.toml | 28 ++++----- java/pom.xml | 2 +- nodejs/__test__/table.test.ts | 4 +- python/python/tests/test_blob.py | 5 +- python/python/tests/test_namespace.py | 8 ++- python/python/tests/test_query.py | 48 ++++++++++++--- python/python/tests/test_table.py | 20 ++++-- rust/lancedb/src/blob.rs | 18 +++--- rust/lancedb/src/materialized_view.rs | 11 +++- rust/lancedb/src/table.rs | 2 +- rust/lancedb/tests/blob_integration.rs | 12 +++- 12 files changed, 155 insertions(+), 87 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d979cb95f..7c50a92a1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3526,8 +3526,8 @@ checksum = "42703706b716c37f96a77aea830392ad231f44c9e9a67872fa5548707e11b11c" [[package]] name = "fsst" -version = "12.0.0-beta.14" -source = "git+https://github.com/lance-format/lance.git?tag=v12.0.0-beta.14#a8a101774a1c9647065cc60137094feadbe55296" +version = "12.0.0-beta.15" +source = "git+https://github.com/lance-format/lance.git?tag=v12.0.0-beta.15#271a155ba505fd8e1094c095d4ce356707e93866" dependencies = [ "arrow-array", "rand 0.9.5", @@ -4886,8 +4886,8 @@ checksum = "e037a2e1d8d5fdbd49b16a4ea09d5d6401c1f29eca5ff29d03d3824dba16256a" [[package]] name = "lance" -version = "12.0.0-beta.14" -source = "git+https://github.com/lance-format/lance.git?tag=v12.0.0-beta.14#a8a101774a1c9647065cc60137094feadbe55296" +version = "12.0.0-beta.15" +source = "git+https://github.com/lance-format/lance.git?tag=v12.0.0-beta.15#271a155ba505fd8e1094c095d4ce356707e93866" dependencies = [ "arc-swap", "arrow", @@ -4959,8 +4959,8 @@ dependencies = [ [[package]] name = "lance-arrow" -version = "12.0.0-beta.14" -source = "git+https://github.com/lance-format/lance.git?tag=v12.0.0-beta.14#a8a101774a1c9647065cc60137094feadbe55296" +version = "12.0.0-beta.15" +source = "git+https://github.com/lance-format/lance.git?tag=v12.0.0-beta.15#271a155ba505fd8e1094c095d4ce356707e93866" dependencies = [ "arrow-array", "arrow-buffer", @@ -4982,7 +4982,7 @@ dependencies = [ [[package]] name = "lance-arrow-scalar" version = "58.0.0" -source = "git+https://github.com/lance-format/lance.git?tag=v12.0.0-beta.14#a8a101774a1c9647065cc60137094feadbe55296" +source = "git+https://github.com/lance-format/lance.git?tag=v12.0.0-beta.15#271a155ba505fd8e1094c095d4ce356707e93866" dependencies = [ "arrow-array", "arrow-buffer", @@ -4996,7 +4996,7 @@ dependencies = [ [[package]] name = "lance-arrow-stats" version = "58.0.0" -source = "git+https://github.com/lance-format/lance.git?tag=v12.0.0-beta.14#a8a101774a1c9647065cc60137094feadbe55296" +source = "git+https://github.com/lance-format/lance.git?tag=v12.0.0-beta.15#271a155ba505fd8e1094c095d4ce356707e93866" dependencies = [ "arrow-array", "arrow-schema", @@ -5005,8 +5005,8 @@ dependencies = [ [[package]] name = "lance-bitpacking" -version = "12.0.0-beta.14" -source = "git+https://github.com/lance-format/lance.git?tag=v12.0.0-beta.14#a8a101774a1c9647065cc60137094feadbe55296" +version = "12.0.0-beta.15" +source = "git+https://github.com/lance-format/lance.git?tag=v12.0.0-beta.15#271a155ba505fd8e1094c095d4ce356707e93866" dependencies = [ "arrayref", "crunchy", @@ -5016,8 +5016,8 @@ dependencies = [ [[package]] name = "lance-core" -version = "12.0.0-beta.14" -source = "git+https://github.com/lance-format/lance.git?tag=v12.0.0-beta.14#a8a101774a1c9647065cc60137094feadbe55296" +version = "12.0.0-beta.15" +source = "git+https://github.com/lance-format/lance.git?tag=v12.0.0-beta.15#271a155ba505fd8e1094c095d4ce356707e93866" dependencies = [ "arrow-array", "arrow-buffer", @@ -5054,8 +5054,8 @@ dependencies = [ [[package]] name = "lance-datafusion" -version = "12.0.0-beta.14" -source = "git+https://github.com/lance-format/lance.git?tag=v12.0.0-beta.14#a8a101774a1c9647065cc60137094feadbe55296" +version = "12.0.0-beta.15" +source = "git+https://github.com/lance-format/lance.git?tag=v12.0.0-beta.15#271a155ba505fd8e1094c095d4ce356707e93866" dependencies = [ "arrow", "arrow-array", @@ -5085,8 +5085,8 @@ dependencies = [ [[package]] name = "lance-datagen" -version = "12.0.0-beta.14" -source = "git+https://github.com/lance-format/lance.git?tag=v12.0.0-beta.14#a8a101774a1c9647065cc60137094feadbe55296" +version = "12.0.0-beta.15" +source = "git+https://github.com/lance-format/lance.git?tag=v12.0.0-beta.15#271a155ba505fd8e1094c095d4ce356707e93866" dependencies = [ "arrow", "arrow-array", @@ -5103,8 +5103,8 @@ dependencies = [ [[package]] name = "lance-derive" -version = "12.0.0-beta.14" -source = "git+https://github.com/lance-format/lance.git?tag=v12.0.0-beta.14#a8a101774a1c9647065cc60137094feadbe55296" +version = "12.0.0-beta.15" +source = "git+https://github.com/lance-format/lance.git?tag=v12.0.0-beta.15#271a155ba505fd8e1094c095d4ce356707e93866" dependencies = [ "proc-macro2", "quote", @@ -5113,8 +5113,8 @@ dependencies = [ [[package]] name = "lance-encoding" -version = "12.0.0-beta.14" -source = "git+https://github.com/lance-format/lance.git?tag=v12.0.0-beta.14#a8a101774a1c9647065cc60137094feadbe55296" +version = "12.0.0-beta.15" +source = "git+https://github.com/lance-format/lance.git?tag=v12.0.0-beta.15#271a155ba505fd8e1094c095d4ce356707e93866" dependencies = [ "arrow-arith", "arrow-array", @@ -5147,8 +5147,8 @@ dependencies = [ [[package]] name = "lance-file" -version = "12.0.0-beta.14" -source = "git+https://github.com/lance-format/lance.git?tag=v12.0.0-beta.14#a8a101774a1c9647065cc60137094feadbe55296" +version = "12.0.0-beta.15" +source = "git+https://github.com/lance-format/lance.git?tag=v12.0.0-beta.15#271a155ba505fd8e1094c095d4ce356707e93866" dependencies = [ "arrow-arith", "arrow-array", @@ -5179,8 +5179,8 @@ dependencies = [ [[package]] name = "lance-index" -version = "12.0.0-beta.14" -source = "git+https://github.com/lance-format/lance.git?tag=v12.0.0-beta.14#a8a101774a1c9647065cc60137094feadbe55296" +version = "12.0.0-beta.15" +source = "git+https://github.com/lance-format/lance.git?tag=v12.0.0-beta.15#271a155ba505fd8e1094c095d4ce356707e93866" dependencies = [ "arc-swap", "arrow", @@ -5244,8 +5244,8 @@ dependencies = [ [[package]] name = "lance-index-core" -version = "12.0.0-beta.14" -source = "git+https://github.com/lance-format/lance.git?tag=v12.0.0-beta.14#a8a101774a1c9647065cc60137094feadbe55296" +version = "12.0.0-beta.15" +source = "git+https://github.com/lance-format/lance.git?tag=v12.0.0-beta.15#271a155ba505fd8e1094c095d4ce356707e93866" dependencies = [ "arrow-array", "arrow-schema", @@ -5267,8 +5267,8 @@ dependencies = [ [[package]] name = "lance-io" -version = "12.0.0-beta.14" -source = "git+https://github.com/lance-format/lance.git?tag=v12.0.0-beta.14#a8a101774a1c9647065cc60137094feadbe55296" +version = "12.0.0-beta.15" +source = "git+https://github.com/lance-format/lance.git?tag=v12.0.0-beta.15#271a155ba505fd8e1094c095d4ce356707e93866" dependencies = [ "arrow", "arrow-array", @@ -5308,8 +5308,8 @@ dependencies = [ [[package]] name = "lance-linalg" -version = "12.0.0-beta.14" -source = "git+https://github.com/lance-format/lance.git?tag=v12.0.0-beta.14#a8a101774a1c9647065cc60137094feadbe55296" +version = "12.0.0-beta.15" +source = "git+https://github.com/lance-format/lance.git?tag=v12.0.0-beta.15#271a155ba505fd8e1094c095d4ce356707e93866" dependencies = [ "arrow-array", "arrow-schema", @@ -5323,8 +5323,8 @@ dependencies = [ [[package]] name = "lance-namespace" -version = "12.0.0-beta.14" -source = "git+https://github.com/lance-format/lance.git?tag=v12.0.0-beta.14#a8a101774a1c9647065cc60137094feadbe55296" +version = "12.0.0-beta.15" +source = "git+https://github.com/lance-format/lance.git?tag=v12.0.0-beta.15#271a155ba505fd8e1094c095d4ce356707e93866" dependencies = [ "arrow", "async-trait", @@ -5338,8 +5338,8 @@ dependencies = [ [[package]] name = "lance-namespace-impls" -version = "12.0.0-beta.14" -source = "git+https://github.com/lance-format/lance.git?tag=v12.0.0-beta.14#a8a101774a1c9647065cc60137094feadbe55296" +version = "12.0.0-beta.15" +source = "git+https://github.com/lance-format/lance.git?tag=v12.0.0-beta.15#271a155ba505fd8e1094c095d4ce356707e93866" dependencies = [ "arrow", "arrow-ipc", @@ -5392,8 +5392,8 @@ dependencies = [ [[package]] name = "lance-select" -version = "12.0.0-beta.14" -source = "git+https://github.com/lance-format/lance.git?tag=v12.0.0-beta.14#a8a101774a1c9647065cc60137094feadbe55296" +version = "12.0.0-beta.15" +source = "git+https://github.com/lance-format/lance.git?tag=v12.0.0-beta.15#271a155ba505fd8e1094c095d4ce356707e93866" dependencies = [ "arrow-array", "arrow-buffer", @@ -5407,8 +5407,8 @@ dependencies = [ [[package]] name = "lance-table" -version = "12.0.0-beta.14" -source = "git+https://github.com/lance-format/lance.git?tag=v12.0.0-beta.14#a8a101774a1c9647065cc60137094feadbe55296" +version = "12.0.0-beta.15" +source = "git+https://github.com/lance-format/lance.git?tag=v12.0.0-beta.15#271a155ba505fd8e1094c095d4ce356707e93866" dependencies = [ "arrow", "arrow-array", @@ -5448,8 +5448,8 @@ dependencies = [ [[package]] name = "lance-testing" -version = "12.0.0-beta.14" -source = "git+https://github.com/lance-format/lance.git?tag=v12.0.0-beta.14#a8a101774a1c9647065cc60137094feadbe55296" +version = "12.0.0-beta.15" +source = "git+https://github.com/lance-format/lance.git?tag=v12.0.0-beta.15#271a155ba505fd8e1094c095d4ce356707e93866" dependencies = [ "arrow-array", "arrow-schema", @@ -5462,8 +5462,8 @@ dependencies = [ [[package]] name = "lance-tokenizer" -version = "12.0.0-beta.14" -source = "git+https://github.com/lance-format/lance.git?tag=v12.0.0-beta.14#a8a101774a1c9647065cc60137094feadbe55296" +version = "12.0.0-beta.15" +source = "git+https://github.com/lance-format/lance.git?tag=v12.0.0-beta.15#271a155ba505fd8e1094c095d4ce356707e93866" dependencies = [ "frostem", "icu_segmenter", diff --git a/Cargo.toml b/Cargo.toml index 5c5b0362d..e3cba6366 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,20 +13,20 @@ categories = ["database-implementations"] rust-version = "1.91.0" [workspace.dependencies] -lance = { "version" = "=12.0.0-beta.14", default-features = false, "tag" = "v12.0.0-beta.14", "git" = "https://github.com/lance-format/lance.git" } -lance-core = { "version" = "=12.0.0-beta.14", "tag" = "v12.0.0-beta.14", "git" = "https://github.com/lance-format/lance.git" } -lance-datagen = { "version" = "=12.0.0-beta.14", "tag" = "v12.0.0-beta.14", "git" = "https://github.com/lance-format/lance.git" } -lance-file = { "version" = "=12.0.0-beta.14", "tag" = "v12.0.0-beta.14", "git" = "https://github.com/lance-format/lance.git" } -lance-io = { "version" = "=12.0.0-beta.14", default-features = false, "tag" = "v12.0.0-beta.14", "git" = "https://github.com/lance-format/lance.git" } -lance-index = { "version" = "=12.0.0-beta.14", "tag" = "v12.0.0-beta.14", "git" = "https://github.com/lance-format/lance.git" } -lance-linalg = { "version" = "=12.0.0-beta.14", "tag" = "v12.0.0-beta.14", "git" = "https://github.com/lance-format/lance.git" } -lance-namespace = { "version" = "=12.0.0-beta.14", "tag" = "v12.0.0-beta.14", "git" = "https://github.com/lance-format/lance.git" } -lance-namespace-impls = { "version" = "=12.0.0-beta.14", default-features = false, "tag" = "v12.0.0-beta.14", "git" = "https://github.com/lance-format/lance.git" } -lance-table = { "version" = "=12.0.0-beta.14", "tag" = "v12.0.0-beta.14", "git" = "https://github.com/lance-format/lance.git" } -lance-testing = { "version" = "=12.0.0-beta.14", "tag" = "v12.0.0-beta.14", "git" = "https://github.com/lance-format/lance.git" } -lance-datafusion = { "version" = "=12.0.0-beta.14", "tag" = "v12.0.0-beta.14", "git" = "https://github.com/lance-format/lance.git" } -lance-encoding = { "version" = "=12.0.0-beta.14", "tag" = "v12.0.0-beta.14", "git" = "https://github.com/lance-format/lance.git" } -lance-arrow = { "version" = "=12.0.0-beta.14", "tag" = "v12.0.0-beta.14", "git" = "https://github.com/lance-format/lance.git" } +lance = { "version" = "=12.0.0-beta.15", default-features = false, "tag" = "v12.0.0-beta.15", "git" = "https://github.com/lance-format/lance.git" } +lance-core = { "version" = "=12.0.0-beta.15", "tag" = "v12.0.0-beta.15", "git" = "https://github.com/lance-format/lance.git" } +lance-datagen = { "version" = "=12.0.0-beta.15", "tag" = "v12.0.0-beta.15", "git" = "https://github.com/lance-format/lance.git" } +lance-file = { "version" = "=12.0.0-beta.15", "tag" = "v12.0.0-beta.15", "git" = "https://github.com/lance-format/lance.git" } +lance-io = { "version" = "=12.0.0-beta.15", default-features = false, "tag" = "v12.0.0-beta.15", "git" = "https://github.com/lance-format/lance.git" } +lance-index = { "version" = "=12.0.0-beta.15", "tag" = "v12.0.0-beta.15", "git" = "https://github.com/lance-format/lance.git" } +lance-linalg = { "version" = "=12.0.0-beta.15", "tag" = "v12.0.0-beta.15", "git" = "https://github.com/lance-format/lance.git" } +lance-namespace = { "version" = "=12.0.0-beta.15", "tag" = "v12.0.0-beta.15", "git" = "https://github.com/lance-format/lance.git" } +lance-namespace-impls = { "version" = "=12.0.0-beta.15", default-features = false, "tag" = "v12.0.0-beta.15", "git" = "https://github.com/lance-format/lance.git" } +lance-table = { "version" = "=12.0.0-beta.15", "tag" = "v12.0.0-beta.15", "git" = "https://github.com/lance-format/lance.git" } +lance-testing = { "version" = "=12.0.0-beta.15", "tag" = "v12.0.0-beta.15", "git" = "https://github.com/lance-format/lance.git" } +lance-datafusion = { "version" = "=12.0.0-beta.15", "tag" = "v12.0.0-beta.15", "git" = "https://github.com/lance-format/lance.git" } +lance-encoding = { "version" = "=12.0.0-beta.15", "tag" = "v12.0.0-beta.15", "git" = "https://github.com/lance-format/lance.git" } +lance-arrow = { "version" = "=12.0.0-beta.15", "tag" = "v12.0.0-beta.15", "git" = "https://github.com/lance-format/lance.git" } lancedb = { path = "rust/lancedb", default-features = false } ahash = "0.8" # Note that this one does not include pyarrow diff --git a/java/pom.xml b/java/pom.xml index 8f64bd4d9..56a30b983 100644 --- a/java/pom.xml +++ b/java/pom.xml @@ -28,7 +28,7 @@ UTF-8 15.0.0 - 12.0.0-beta.14 + 12.0.0-beta.15 false 2.30.0 1.7 diff --git a/nodejs/__test__/table.test.ts b/nodejs/__test__/table.test.ts index 6f80ca74e..d11169b46 100644 --- a/nodejs/__test__/table.test.ts +++ b/nodejs/__test__/table.test.ts @@ -281,7 +281,7 @@ describe.each([arrow15, arrow16, arrow17, arrow18])( numIndices: 0, numRows: 3, // Full on-disk size of the two data files, footers and metadata included. - totalBytes: 684, + totalBytes: 550, }); // Index files count toward totalBytes too (only deletion files and @@ -289,7 +289,7 @@ describe.each([arrow15, arrow16, arrow17, arrow18])( await table.createIndex("id", { config: Index.btree() }); const statsWithIndex = await table.stats(); expect(statsWithIndex.numIndices).toBe(1); - expect(statsWithIndex.totalBytes).toBeGreaterThan(684); + expect(statsWithIndex.totalBytes).toBeGreaterThan(550); }); it("should overwrite data if asked", async () => { diff --git a/python/python/tests/test_blob.py b/python/python/tests/test_blob.py index 1f158fb49..298b021df 100644 --- a/python/python/tests/test_blob.py +++ b/python/python/tests/test_blob.py @@ -297,7 +297,10 @@ def test_blob_v2_projection_sources_use_typed_column_name(): def _legacy_v1_table(name): - db = lancedb.connect("memory:///") + # Legacy v1 blob columns are only writable at file version <= 2.1. + db = lancedb.connect( + "memory:///", storage_options={"new_table_data_storage_version": "2.1"} + ) schema = pa.schema( [ pa.field("id", pa.int64()), diff --git a/python/python/tests/test_namespace.py b/python/python/tests/test_namespace.py index f8cbfe92c..7f095b71d 100644 --- a/python/python/tests/test_namespace.py +++ b/python/python/tests/test_namespace.py @@ -193,7 +193,13 @@ class TestNamespaceConnection: ), ) - table = db.create_table("blob_table", data, namespace_path=["test_ns"]) + # Legacy v1 blob columns are only writable at file version <= 2.1. + table = db.create_table( + "blob_table", + data, + namespace_path=["test_ns"], + storage_options={"new_table_data_storage_version": "2.1"}, + ) df = table.to_pandas(blob_mode="lazy").sort_values("id") blob = df["blob"].iloc[0] diff --git a/python/python/tests/test_query.py b/python/python/tests/test_query.py index 6fbe0689b..e3d55917d 100644 --- a/python/python/tests/test_query.py +++ b/python/python/tests/test_query.py @@ -40,6 +40,10 @@ from utils import exception_output from importlib.util import find_spec +# Legacy v1 blob columns are only writable at file version <= 2.1. +LEGACY_BLOB_STORAGE_OPTIONS = {"new_table_data_storage_version": "2.1"} + + def _blob_query_data(): return pa.table( { @@ -119,13 +123,17 @@ def _assert_blob_bytes_projection(df): def _blob_query_table(db, name, blob_schema): if blob_schema == "v1": - return db.create_table(name, _blob_query_data()) + return db.create_table( + name, _blob_query_data(), storage_options=LEGACY_BLOB_STORAGE_OPTIONS + ) return _create_blob_v2_query_table(db, name) async def _blob_query_table_async(db, name, blob_schema): if blob_schema == "v1": - return await db.create_table(name, _blob_query_data()) + return await db.create_table( + name, _blob_query_data(), storage_options=LEGACY_BLOB_STORAGE_OPTIONS + ) return await _create_blob_v2_query_table_async(db, name) @@ -275,7 +283,9 @@ async def test_query_to_pandas_kwargs(table, table_async): def test_plain_scan_query_to_pandas_blob_modes(tmp_db, blob_mode): pytest.importorskip("lance") table = tmp_db.create_table( - f"test_query_to_pandas_blob_{blob_mode}", _blob_query_data() + f"test_query_to_pandas_blob_{blob_mode}", + _blob_query_data(), + storage_options=LEGACY_BLOB_STORAGE_OPTIONS, ) df = ( @@ -322,7 +332,9 @@ def test_plain_scan_query_to_pandas_blob_mode_does_not_collect_arrow( ): pytest.importorskip("lance") table = tmp_db.create_table( - "test_query_to_pandas_blob_no_arrow_collect", _blob_query_data() + "test_query_to_pandas_blob_no_arrow_collect", + _blob_query_data(), + storage_options=LEGACY_BLOB_STORAGE_OPTIONS, ) query = table.search().where("id = 1").select(["id", "blob"]) @@ -347,7 +359,9 @@ def test_plain_scan_query_to_pandas_blob_descriptions_flatten_uses_scanner( ): pytest.importorskip("lance") table = tmp_db.create_table( - "test_query_to_pandas_blob_desc_flatten", _blob_query_data() + "test_query_to_pandas_blob_desc_flatten", + _blob_query_data(), + storage_options=LEGACY_BLOB_STORAGE_OPTIONS, ) query = table.search().where("id = 1").select(["id", "blob"]) @@ -365,7 +379,11 @@ def test_plain_scan_query_to_pandas_blob_descriptions_flatten_uses_scanner( def test_plain_scan_query_to_pandas_scanner_state(tmp_db): pytest.importorskip("lance") data = _blob_query_data() - table = tmp_db.create_table("test_query_to_pandas_scanner_state", data.slice(0, 2)) + table = tmp_db.create_table( + "test_query_to_pandas_scanner_state", + data.slice(0, 2), + storage_options=LEGACY_BLOB_STORAGE_OPTIONS, + ) table.add(data.slice(2, 2)) fragments = table.to_lance().get_fragments() @@ -400,7 +418,9 @@ def test_plain_scan_query_to_pandas_scanner_state(tmp_db): async def test_async_plain_scan_query_to_pandas_blob_projection(tmp_db_async): pytest.importorskip("lance") table = await tmp_db_async.create_table( - "test_async_query_to_pandas_blob_projection", _blob_query_data() + "test_async_query_to_pandas_blob_projection", + _blob_query_data(), + storage_options=LEGACY_BLOB_STORAGE_OPTIONS, ) lazy_df = await ( @@ -452,7 +472,9 @@ async def test_async_plain_scan_query_to_pandas_blob_mode_does_not_collect_arrow ): pytest.importorskip("lance") table = await tmp_db_async.create_table( - "test_async_query_to_pandas_blob_no_arrow_collect", _blob_query_data() + "test_async_query_to_pandas_blob_no_arrow_collect", + _blob_query_data(), + storage_options=LEGACY_BLOB_STORAGE_OPTIONS, ) query = table.query().where("id = 1").select(["id", "blob"]) @@ -474,7 +496,11 @@ async def test_async_plain_scan_query_to_pandas_blob_mode_does_not_collect_arrow def test_vector_query_to_pandas_blob_mode_requires_native_path(tmp_db): pytest.importorskip("lance") - table = tmp_db.create_table("test_vector_query_blob_mode", _blob_query_data()) + table = tmp_db.create_table( + "test_vector_query_blob_mode", + _blob_query_data(), + storage_options=LEGACY_BLOB_STORAGE_OPTIONS, + ) with pytest.raises(RuntimeError, match="Lance native pandas conversion"): table.search([1.0, 0.0]).select(["blob", "vector"]).limit(1).to_pandas( @@ -485,7 +511,9 @@ def test_vector_query_to_pandas_blob_mode_requires_native_path(tmp_db): def test_vector_query_to_pandas_blob_descriptions_requires_plain_scan(tmp_db): pytest.importorskip("lance") table = tmp_db.create_table( - "test_vector_query_blob_descriptions", _blob_query_data() + "test_vector_query_blob_descriptions", + _blob_query_data(), + storage_options=LEGACY_BLOB_STORAGE_OPTIONS, ) with pytest.raises(RuntimeError, match="plain scan query"): diff --git a/python/python/tests/test_table.py b/python/python/tests/test_table.py index 82ad045c8..3e1f6fb37 100644 --- a/python/python/tests/test_table.py +++ b/python/python/tests/test_table.py @@ -64,15 +64,23 @@ async def _blob_v2_table_async(db: AsyncConnection, name: str): return table +# Legacy v1 blob columns are only writable at file version <= 2.1. +LEGACY_BLOB_STORAGE_OPTIONS = {"new_table_data_storage_version": "2.1"} + + def _blob_table(db: DBConnection, name: str, blob_schema: str): if blob_schema == "v1": - return db.create_table(name, data=_blob_test_data()) + return db.create_table( + name, data=_blob_test_data(), storage_options=LEGACY_BLOB_STORAGE_OPTIONS + ) return _blob_v2_table(db, name) async def _blob_table_async(db: AsyncConnection, name: str, blob_schema: str): if blob_schema == "v1": - return await db.create_table(name, data=_blob_test_data()) + return await db.create_table( + name, data=_blob_test_data(), storage_options=LEGACY_BLOB_STORAGE_OPTIONS + ) return await _blob_v2_table_async(db, name) @@ -147,7 +155,11 @@ def test_table_to_pandas_invalid_blob_mode_non_blob_table(tmp_db: DBConnection): @pytest.mark.parametrize("blob_mode", ["lazy", "bytes", "descriptions"]) def test_table_to_pandas_blob_modes(tmp_db: DBConnection, blob_mode): pytest.importorskip("lance") - table = tmp_db.create_table(f"test_to_pandas_blob_{blob_mode}", _blob_test_data()) + table = tmp_db.create_table( + f"test_to_pandas_blob_{blob_mode}", + _blob_test_data(), + storage_options=LEGACY_BLOB_STORAGE_OPTIONS, + ) df = table.to_pandas(blob_mode=blob_mode) @@ -3959,7 +3971,7 @@ def test_stats(mem_db: DBConnection): print(f"{stats=}") assert stats == { # Full on-disk size of the data file, footer and metadata included. - "total_bytes": 633, + "total_bytes": 637, "num_rows": 2, "num_indices": 0, "fragment_stats": { diff --git a/rust/lancedb/src/blob.rs b/rust/lancedb/src/blob.rs index 6a0d968b0..cbc0724c6 100644 --- a/rust/lancedb/src/blob.rs +++ b/rust/lancedb/src/blob.rs @@ -532,10 +532,11 @@ mod tests { fn storage_version_bumps_to_v2_2() { let mut params = WriteParams::default(); ensure_blob_storage_version(&blob_schema(), &mut params); - assert_eq!( - params.data_storage_version.unwrap().resolve(), - ConcreteFileVersion::V2_2 - ); + let resolved = params + .data_storage_version + .unwrap_or(LanceFileVersion::Stable) + .resolve(); + assert_eq!(resolved, ConcreteFileVersion::V2_2); assert!(!params.enable_stable_row_ids); } @@ -547,10 +548,11 @@ mod tests { }; ensure_blob_storage_version(&blob_schema(), &mut params); assert!(params.enable_stable_row_ids); - assert_eq!( - params.data_storage_version.unwrap().resolve(), - ConcreteFileVersion::V2_2 - ); + let resolved = params + .data_storage_version + .unwrap_or(LanceFileVersion::Stable) + .resolve(); + assert_eq!(resolved, ConcreteFileVersion::V2_2); } #[test] diff --git a/rust/lancedb/src/materialized_view.rs b/rust/lancedb/src/materialized_view.rs index 80546b4a4..98f1338d0 100644 --- a/rust/lancedb/src/materialized_view.rs +++ b/rust/lancedb/src/materialized_view.rs @@ -1917,7 +1917,16 @@ mod tests { /// declaration buried in a struct child binds as hard as one on top. #[tokio::test] async fn test_nested_projection_metadata_and_declarations() { - let conn = connect("memory://").execute().await.unwrap(); + // The schema below carries the legacy v1 blob marker, which Lance only + // allows writing at file version <= 2.1. + let conn = connect("memory://") + .storage_options([( + crate::database::listing::OPT_NEW_TABLE_STORAGE_VERSION, + "2.1", + )]) + .execute() + .await + .unwrap(); let payload = crate::blob("payload", true).with_metadata(HashMap::from([ ("lance-encoding:blob".to_string(), "true".to_string()), ( diff --git a/rust/lancedb/src/table.rs b/rust/lancedb/src/table.rs index 56d7ce518..636aaefd0 100644 --- a/rust/lancedb/src/table.rs +++ b/rust/lancedb/src/table.rs @@ -5678,7 +5678,7 @@ mod tests { TableStatistics { num_rows: 250, num_indices: 0, - total_bytes: 8925, + total_bytes: 8969, fragment_stats: FragmentStatistics { num_fragments: 11, num_small_fragments: 11, diff --git a/rust/lancedb/tests/blob_integration.rs b/rust/lancedb/tests/blob_integration.rs index b884a48f7..118ecf5c9 100644 --- a/rust/lancedb/tests/blob_integration.rs +++ b/rust/lancedb/tests/blob_integration.rs @@ -19,6 +19,7 @@ use lancedb::{ connect, connect_namespace, database::listing::{ ListingDatabaseOptions, NewTableConfig, OPT_NEW_TABLE_ENABLE_STABLE_ROW_IDS, + OPT_NEW_TABLE_STORAGE_VERSION, }, query::{ExecutableQuery, QueryBase}, table::{AddDataMode, CompactionOptions, OptimizeAction, OptimizeStats, WriteOptions}, @@ -146,7 +147,10 @@ async fn non_blob_table_keeps_default_format_and_row_id_setting() -> Result<()> let schema = Arc::new(Schema::new(vec![Field::new("id", DataType::Int64, false)])); let table = db.create_empty_table("t", schema).execute().await?; - assert!(!supports_blob_v2(storage_format_version(&table).await)); + assert_eq!( + storage_format_version(&table).await, + LanceFileVersion::Stable.resolve() + ); assert!(!uses_stable_row_ids(&table).await); Ok(()) } @@ -809,7 +813,11 @@ async fn fetch_blobs_rejects_unknown_column() -> Result<()> { #[tokio::test] async fn fetch_blobs_rejects_legacy_v1_blob_column() -> Result<()> { let tmp = tempdir().unwrap(); - let db = connect(tmp.path().to_str().unwrap()).execute().await?; + // Legacy v1 blob columns are only writable at file version <= 2.1. + let db = connect(tmp.path().to_str().unwrap()) + .storage_options([(OPT_NEW_TABLE_STORAGE_VERSION, "2.1")]) + .execute() + .await?; let legacy = Field::new("image", DataType::LargeBinary, true).with_metadata( std::collections::HashMap::from([("lance-encoding:blob".to_string(), "true".to_string())]), );