mirror of
https://github.com/lancedb/lancedb.git
synced 2026-11-26 12:33:59 +00:00
perf(query): avoid opening vector indexes during cosine ANN planning (#5186)
Planning a cosine ANN query opens each distinct index segment to determine its distance scale. Opening the index loads centroids and quantizer data even though the planner only needs the physical index type. Use Lance's batch physical-type lookup for the segment UUIDs in each ANN plan. The planner uses those types to select the existing distance conversion. Query execution still searches the selected segments. The lookup ships in [Lance v15.0.0-beta.31](https://github.com/lance-format/lance/releases/tag/v15.0.0-beta.31). This PR updates the Rust and Java dependencies and the Python test pin to that release. The regression test creates an IVF_RQ index, removes its auxiliary quantizer file, reopens the table in a fresh session, and verifies that a cosine ANN plan can still be built. Existing tests cover modern and legacy PQ scores and ordering across mixed tiers.
This commit is contained in:
Generated
+46
-46
@@ -3836,8 +3836,8 @@ checksum = "42703706b716c37f96a77aea830392ad231f44c9e9a67872fa5548707e11b11c"
|
||||
|
||||
[[package]]
|
||||
name = "fsst"
|
||||
version = "15.0.0-beta.29"
|
||||
source = "git+https://github.com/lance-format/lance.git?tag=v15.0.0-beta.29#ded121cd9a99dc83040cf41049dc2bd3963241b9"
|
||||
version = "15.0.0-beta.31"
|
||||
source = "git+https://github.com/lance-format/lance.git?tag=v15.0.0-beta.31#d529e8d0d2d0fa8ddb87698d5a7301fee5150e51"
|
||||
dependencies = [
|
||||
"arrow-array",
|
||||
"rand 0.9.5",
|
||||
@@ -5315,8 +5315,8 @@ checksum = "e037a2e1d8d5fdbd49b16a4ea09d5d6401c1f29eca5ff29d03d3824dba16256a"
|
||||
|
||||
[[package]]
|
||||
name = "lance"
|
||||
version = "15.0.0-beta.29"
|
||||
source = "git+https://github.com/lance-format/lance.git?tag=v15.0.0-beta.29#ded121cd9a99dc83040cf41049dc2bd3963241b9"
|
||||
version = "15.0.0-beta.31"
|
||||
source = "git+https://github.com/lance-format/lance.git?tag=v15.0.0-beta.31#d529e8d0d2d0fa8ddb87698d5a7301fee5150e51"
|
||||
dependencies = [
|
||||
"arc-swap",
|
||||
"arrow",
|
||||
@@ -5391,8 +5391,8 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "lance-arrow"
|
||||
version = "15.0.0-beta.29"
|
||||
source = "git+https://github.com/lance-format/lance.git?tag=v15.0.0-beta.29#ded121cd9a99dc83040cf41049dc2bd3963241b9"
|
||||
version = "15.0.0-beta.31"
|
||||
source = "git+https://github.com/lance-format/lance.git?tag=v15.0.0-beta.31#d529e8d0d2d0fa8ddb87698d5a7301fee5150e51"
|
||||
dependencies = [
|
||||
"arrow-array",
|
||||
"arrow-buffer",
|
||||
@@ -5415,8 +5415,8 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "lance-bitpacking"
|
||||
version = "15.0.0-beta.29"
|
||||
source = "git+https://github.com/lance-format/lance.git?tag=v15.0.0-beta.29#ded121cd9a99dc83040cf41049dc2bd3963241b9"
|
||||
version = "15.0.0-beta.31"
|
||||
source = "git+https://github.com/lance-format/lance.git?tag=v15.0.0-beta.31#d529e8d0d2d0fa8ddb87698d5a7301fee5150e51"
|
||||
dependencies = [
|
||||
"arrayref",
|
||||
"crunchy",
|
||||
@@ -5426,8 +5426,8 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "lance-core"
|
||||
version = "15.0.0-beta.29"
|
||||
source = "git+https://github.com/lance-format/lance.git?tag=v15.0.0-beta.29#ded121cd9a99dc83040cf41049dc2bd3963241b9"
|
||||
version = "15.0.0-beta.31"
|
||||
source = "git+https://github.com/lance-format/lance.git?tag=v15.0.0-beta.31#d529e8d0d2d0fa8ddb87698d5a7301fee5150e51"
|
||||
dependencies = [
|
||||
"arrow-array",
|
||||
"arrow-buffer",
|
||||
@@ -5465,8 +5465,8 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "lance-datafusion"
|
||||
version = "15.0.0-beta.29"
|
||||
source = "git+https://github.com/lance-format/lance.git?tag=v15.0.0-beta.29#ded121cd9a99dc83040cf41049dc2bd3963241b9"
|
||||
version = "15.0.0-beta.31"
|
||||
source = "git+https://github.com/lance-format/lance.git?tag=v15.0.0-beta.31#d529e8d0d2d0fa8ddb87698d5a7301fee5150e51"
|
||||
dependencies = [
|
||||
"arrow",
|
||||
"arrow-array",
|
||||
@@ -5497,8 +5497,8 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "lance-datafusion-exec"
|
||||
version = "15.0.0-beta.29"
|
||||
source = "git+https://github.com/lance-format/lance.git?tag=v15.0.0-beta.29#ded121cd9a99dc83040cf41049dc2bd3963241b9"
|
||||
version = "15.0.0-beta.31"
|
||||
source = "git+https://github.com/lance-format/lance.git?tag=v15.0.0-beta.31#d529e8d0d2d0fa8ddb87698d5a7301fee5150e51"
|
||||
dependencies = [
|
||||
"arrow",
|
||||
"arrow-array",
|
||||
@@ -5523,8 +5523,8 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "lance-datagen"
|
||||
version = "15.0.0-beta.29"
|
||||
source = "git+https://github.com/lance-format/lance.git?tag=v15.0.0-beta.29#ded121cd9a99dc83040cf41049dc2bd3963241b9"
|
||||
version = "15.0.0-beta.31"
|
||||
source = "git+https://github.com/lance-format/lance.git?tag=v15.0.0-beta.31#d529e8d0d2d0fa8ddb87698d5a7301fee5150e51"
|
||||
dependencies = [
|
||||
"arrow",
|
||||
"arrow-array",
|
||||
@@ -5541,8 +5541,8 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "lance-derive"
|
||||
version = "15.0.0-beta.29"
|
||||
source = "git+https://github.com/lance-format/lance.git?tag=v15.0.0-beta.29#ded121cd9a99dc83040cf41049dc2bd3963241b9"
|
||||
version = "15.0.0-beta.31"
|
||||
source = "git+https://github.com/lance-format/lance.git?tag=v15.0.0-beta.31#d529e8d0d2d0fa8ddb87698d5a7301fee5150e51"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
@@ -5551,8 +5551,8 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "lance-encoding"
|
||||
version = "15.0.0-beta.29"
|
||||
source = "git+https://github.com/lance-format/lance.git?tag=v15.0.0-beta.29#ded121cd9a99dc83040cf41049dc2bd3963241b9"
|
||||
version = "15.0.0-beta.31"
|
||||
source = "git+https://github.com/lance-format/lance.git?tag=v15.0.0-beta.31#d529e8d0d2d0fa8ddb87698d5a7301fee5150e51"
|
||||
dependencies = [
|
||||
"arrow-arith",
|
||||
"arrow-array",
|
||||
@@ -5586,8 +5586,8 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "lance-file"
|
||||
version = "15.0.0-beta.29"
|
||||
source = "git+https://github.com/lance-format/lance.git?tag=v15.0.0-beta.29#ded121cd9a99dc83040cf41049dc2bd3963241b9"
|
||||
version = "15.0.0-beta.31"
|
||||
source = "git+https://github.com/lance-format/lance.git?tag=v15.0.0-beta.31#d529e8d0d2d0fa8ddb87698d5a7301fee5150e51"
|
||||
dependencies = [
|
||||
"arrow-arith",
|
||||
"arrow-array",
|
||||
@@ -5618,8 +5618,8 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "lance-geo"
|
||||
version = "15.0.0-beta.29"
|
||||
source = "git+https://github.com/lance-format/lance.git?tag=v15.0.0-beta.29#ded121cd9a99dc83040cf41049dc2bd3963241b9"
|
||||
version = "15.0.0-beta.31"
|
||||
source = "git+https://github.com/lance-format/lance.git?tag=v15.0.0-beta.31#d529e8d0d2d0fa8ddb87698d5a7301fee5150e51"
|
||||
dependencies = [
|
||||
"arrow-array",
|
||||
"arrow-schema",
|
||||
@@ -5650,8 +5650,8 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "lance-index"
|
||||
version = "15.0.0-beta.29"
|
||||
source = "git+https://github.com/lance-format/lance.git?tag=v15.0.0-beta.29#ded121cd9a99dc83040cf41049dc2bd3963241b9"
|
||||
version = "15.0.0-beta.31"
|
||||
source = "git+https://github.com/lance-format/lance.git?tag=v15.0.0-beta.31#d529e8d0d2d0fa8ddb87698d5a7301fee5150e51"
|
||||
dependencies = [
|
||||
"arc-swap",
|
||||
"arrow",
|
||||
@@ -5723,8 +5723,8 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "lance-index-core"
|
||||
version = "15.0.0-beta.29"
|
||||
source = "git+https://github.com/lance-format/lance.git?tag=v15.0.0-beta.29#ded121cd9a99dc83040cf41049dc2bd3963241b9"
|
||||
version = "15.0.0-beta.31"
|
||||
source = "git+https://github.com/lance-format/lance.git?tag=v15.0.0-beta.31#d529e8d0d2d0fa8ddb87698d5a7301fee5150e51"
|
||||
dependencies = [
|
||||
"arrow-array",
|
||||
"arrow-schema",
|
||||
@@ -5747,8 +5747,8 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "lance-io"
|
||||
version = "15.0.0-beta.29"
|
||||
source = "git+https://github.com/lance-format/lance.git?tag=v15.0.0-beta.29#ded121cd9a99dc83040cf41049dc2bd3963241b9"
|
||||
version = "15.0.0-beta.31"
|
||||
source = "git+https://github.com/lance-format/lance.git?tag=v15.0.0-beta.31#d529e8d0d2d0fa8ddb87698d5a7301fee5150e51"
|
||||
dependencies = [
|
||||
"arrow",
|
||||
"arrow-array",
|
||||
@@ -5793,8 +5793,8 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "lance-jsonb"
|
||||
version = "15.0.0-beta.29"
|
||||
source = "git+https://github.com/lance-format/lance.git?tag=v15.0.0-beta.29#ded121cd9a99dc83040cf41049dc2bd3963241b9"
|
||||
version = "15.0.0-beta.31"
|
||||
source = "git+https://github.com/lance-format/lance.git?tag=v15.0.0-beta.31#d529e8d0d2d0fa8ddb87698d5a7301fee5150e51"
|
||||
dependencies = [
|
||||
"byteorder",
|
||||
"ethnum",
|
||||
@@ -5811,8 +5811,8 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "lance-linalg"
|
||||
version = "15.0.0-beta.29"
|
||||
source = "git+https://github.com/lance-format/lance.git?tag=v15.0.0-beta.29#ded121cd9a99dc83040cf41049dc2bd3963241b9"
|
||||
version = "15.0.0-beta.31"
|
||||
source = "git+https://github.com/lance-format/lance.git?tag=v15.0.0-beta.31#d529e8d0d2d0fa8ddb87698d5a7301fee5150e51"
|
||||
dependencies = [
|
||||
"argminmax 0.7.1",
|
||||
"arrow-array",
|
||||
@@ -5827,8 +5827,8 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "lance-namespace"
|
||||
version = "15.0.0-beta.29"
|
||||
source = "git+https://github.com/lance-format/lance.git?tag=v15.0.0-beta.29#ded121cd9a99dc83040cf41049dc2bd3963241b9"
|
||||
version = "15.0.0-beta.31"
|
||||
source = "git+https://github.com/lance-format/lance.git?tag=v15.0.0-beta.31#d529e8d0d2d0fa8ddb87698d5a7301fee5150e51"
|
||||
dependencies = [
|
||||
"arrow",
|
||||
"async-trait",
|
||||
@@ -5842,8 +5842,8 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "lance-namespace-impls"
|
||||
version = "15.0.0-beta.29"
|
||||
source = "git+https://github.com/lance-format/lance.git?tag=v15.0.0-beta.29#ded121cd9a99dc83040cf41049dc2bd3963241b9"
|
||||
version = "15.0.0-beta.31"
|
||||
source = "git+https://github.com/lance-format/lance.git?tag=v15.0.0-beta.31#d529e8d0d2d0fa8ddb87698d5a7301fee5150e51"
|
||||
dependencies = [
|
||||
"arc-swap",
|
||||
"arrow",
|
||||
@@ -5897,8 +5897,8 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "lance-select"
|
||||
version = "15.0.0-beta.29"
|
||||
source = "git+https://github.com/lance-format/lance.git?tag=v15.0.0-beta.29#ded121cd9a99dc83040cf41049dc2bd3963241b9"
|
||||
version = "15.0.0-beta.31"
|
||||
source = "git+https://github.com/lance-format/lance.git?tag=v15.0.0-beta.31#d529e8d0d2d0fa8ddb87698d5a7301fee5150e51"
|
||||
dependencies = [
|
||||
"arrow-array",
|
||||
"arrow-buffer",
|
||||
@@ -5912,8 +5912,8 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "lance-table"
|
||||
version = "15.0.0-beta.29"
|
||||
source = "git+https://github.com/lance-format/lance.git?tag=v15.0.0-beta.29#ded121cd9a99dc83040cf41049dc2bd3963241b9"
|
||||
version = "15.0.0-beta.31"
|
||||
source = "git+https://github.com/lance-format/lance.git?tag=v15.0.0-beta.31#d529e8d0d2d0fa8ddb87698d5a7301fee5150e51"
|
||||
dependencies = [
|
||||
"arrow",
|
||||
"arrow-array",
|
||||
@@ -5954,8 +5954,8 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "lance-testing"
|
||||
version = "15.0.0-beta.29"
|
||||
source = "git+https://github.com/lance-format/lance.git?tag=v15.0.0-beta.29#ded121cd9a99dc83040cf41049dc2bd3963241b9"
|
||||
version = "15.0.0-beta.31"
|
||||
source = "git+https://github.com/lance-format/lance.git?tag=v15.0.0-beta.31#d529e8d0d2d0fa8ddb87698d5a7301fee5150e51"
|
||||
dependencies = [
|
||||
"arrow-array",
|
||||
"arrow-schema",
|
||||
@@ -5968,8 +5968,8 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "lance-tokenizer"
|
||||
version = "15.0.0-beta.29"
|
||||
source = "git+https://github.com/lance-format/lance.git?tag=v15.0.0-beta.29#ded121cd9a99dc83040cf41049dc2bd3963241b9"
|
||||
version = "15.0.0-beta.31"
|
||||
source = "git+https://github.com/lance-format/lance.git?tag=v15.0.0-beta.31#d529e8d0d2d0fa8ddb87698d5a7301fee5150e51"
|
||||
dependencies = [
|
||||
"frostem",
|
||||
"icu_segmenter",
|
||||
|
||||
+15
-15
@@ -19,21 +19,21 @@ categories = ["database-implementations"]
|
||||
rust-version = "1.95.0"
|
||||
|
||||
[workspace.dependencies]
|
||||
lance = { "version" = "=15.0.0-beta.29", default-features = false, "tag" = "v15.0.0-beta.29", "git" = "https://github.com/lance-format/lance.git" }
|
||||
lance-core = { "version" = "=15.0.0-beta.29", "tag" = "v15.0.0-beta.29", "git" = "https://github.com/lance-format/lance.git" }
|
||||
lance-datagen = { "version" = "=15.0.0-beta.29", "tag" = "v15.0.0-beta.29", "git" = "https://github.com/lance-format/lance.git" }
|
||||
lance-file = { "version" = "=15.0.0-beta.29", "tag" = "v15.0.0-beta.29", "git" = "https://github.com/lance-format/lance.git" }
|
||||
lance-io = { "version" = "=15.0.0-beta.29", default-features = false, "tag" = "v15.0.0-beta.29", "git" = "https://github.com/lance-format/lance.git" }
|
||||
lance-index = { "version" = "=15.0.0-beta.29", "tag" = "v15.0.0-beta.29", "git" = "https://github.com/lance-format/lance.git" }
|
||||
lance-jsonb = { "version" = "=15.0.0-beta.29", "tag" = "v15.0.0-beta.29", "git" = "https://github.com/lance-format/lance.git" }
|
||||
lance-linalg = { "version" = "=15.0.0-beta.29", "tag" = "v15.0.0-beta.29", "git" = "https://github.com/lance-format/lance.git" }
|
||||
lance-namespace = { "version" = "=15.0.0-beta.29", "tag" = "v15.0.0-beta.29", "git" = "https://github.com/lance-format/lance.git" }
|
||||
lance-namespace-impls = { "version" = "=15.0.0-beta.29", default-features = false, "tag" = "v15.0.0-beta.29", "git" = "https://github.com/lance-format/lance.git" }
|
||||
lance-table = { "version" = "=15.0.0-beta.29", "tag" = "v15.0.0-beta.29", "git" = "https://github.com/lance-format/lance.git" }
|
||||
lance-testing = { "version" = "=15.0.0-beta.29", "tag" = "v15.0.0-beta.29", "git" = "https://github.com/lance-format/lance.git" }
|
||||
lance-datafusion = { "version" = "=15.0.0-beta.29", "tag" = "v15.0.0-beta.29", "git" = "https://github.com/lance-format/lance.git" }
|
||||
lance-encoding = { "version" = "=15.0.0-beta.29", "tag" = "v15.0.0-beta.29", "git" = "https://github.com/lance-format/lance.git" }
|
||||
lance-arrow = { "version" = "=15.0.0-beta.29", "tag" = "v15.0.0-beta.29", "git" = "https://github.com/lance-format/lance.git" }
|
||||
lance = { "version" = "=15.0.0-beta.31", default-features = false, "tag" = "v15.0.0-beta.31", "git" = "https://github.com/lance-format/lance.git" }
|
||||
lance-core = { "version" = "=15.0.0-beta.31", "tag" = "v15.0.0-beta.31", "git" = "https://github.com/lance-format/lance.git" }
|
||||
lance-datagen = { "version" = "=15.0.0-beta.31", "tag" = "v15.0.0-beta.31", "git" = "https://github.com/lance-format/lance.git" }
|
||||
lance-file = { "version" = "=15.0.0-beta.31", "tag" = "v15.0.0-beta.31", "git" = "https://github.com/lance-format/lance.git" }
|
||||
lance-io = { "version" = "=15.0.0-beta.31", default-features = false, "tag" = "v15.0.0-beta.31", "git" = "https://github.com/lance-format/lance.git" }
|
||||
lance-index = { "version" = "=15.0.0-beta.31", "tag" = "v15.0.0-beta.31", "git" = "https://github.com/lance-format/lance.git" }
|
||||
lance-jsonb = { "version" = "=15.0.0-beta.31", "tag" = "v15.0.0-beta.31", "git" = "https://github.com/lance-format/lance.git" }
|
||||
lance-linalg = { "version" = "=15.0.0-beta.31", "tag" = "v15.0.0-beta.31", "git" = "https://github.com/lance-format/lance.git" }
|
||||
lance-namespace = { "version" = "=15.0.0-beta.31", "tag" = "v15.0.0-beta.31", "git" = "https://github.com/lance-format/lance.git" }
|
||||
lance-namespace-impls = { "version" = "=15.0.0-beta.31", default-features = false, "tag" = "v15.0.0-beta.31", "git" = "https://github.com/lance-format/lance.git" }
|
||||
lance-table = { "version" = "=15.0.0-beta.31", "tag" = "v15.0.0-beta.31", "git" = "https://github.com/lance-format/lance.git" }
|
||||
lance-testing = { "version" = "=15.0.0-beta.31", "tag" = "v15.0.0-beta.31", "git" = "https://github.com/lance-format/lance.git" }
|
||||
lance-datafusion = { "version" = "=15.0.0-beta.31", "tag" = "v15.0.0-beta.31", "git" = "https://github.com/lance-format/lance.git" }
|
||||
lance-encoding = { "version" = "=15.0.0-beta.31", "tag" = "v15.0.0-beta.31", "git" = "https://github.com/lance-format/lance.git" }
|
||||
lance-arrow = { "version" = "=15.0.0-beta.31", "tag" = "v15.0.0-beta.31", "git" = "https://github.com/lance-format/lance.git" }
|
||||
lancedb = { path = "rust/lancedb", default-features = false }
|
||||
ahash = "0.8"
|
||||
anyhow = "1"
|
||||
|
||||
+1
-1
@@ -28,7 +28,7 @@
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<arrow.version>15.0.0</arrow.version>
|
||||
<lance-core.version>15.0.0-beta.29</lance-core.version>
|
||||
<lance-core.version>15.0.0-beta.31</lance-core.version>
|
||||
<jackson.version>2.18.12</jackson.version>
|
||||
<spotless.skip>false</spotless.skip>
|
||||
<spotless.version>2.30.0</spotless.version>
|
||||
|
||||
@@ -63,7 +63,7 @@ tests = [
|
||||
"polars>=0.19, <=1.32.3",
|
||||
"pyarrow>=16",
|
||||
"pyarrow-stubs>=16.0",
|
||||
"pylance==15.0.0b29",
|
||||
"pylance==15.0.0b31",
|
||||
"requests>=2.31.0",
|
||||
"datafusion>=54,<55",
|
||||
"opentelemetry-sdk>=1.30.0",
|
||||
|
||||
Generated
+9
-9
@@ -1910,7 +1910,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 = ">=15.0.0b3" },
|
||||
{ name = "pylance", marker = "extra == 'tests'", specifier = "==15.0.0b29" },
|
||||
{ name = "pylance", marker = "extra == 'tests'", specifier = "==15.0.0b31" },
|
||||
{ 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" },
|
||||
@@ -3642,20 +3642,20 @@ crypto = [
|
||||
|
||||
[[package]]
|
||||
name = "pylance"
|
||||
version = "15.0.0b29"
|
||||
version = "15.0.0b31"
|
||||
source = { registry = "https://pypi.fury.io/lance-format/" }
|
||||
dependencies = [
|
||||
{ name = "lance-namespace" },
|
||||
{ name = "pyarrow" },
|
||||
]
|
||||
wheels = [
|
||||
{ url = "https://pypi.fury.io/lance-format/-/ver_1CJyoP/pylance-15.0.0b29-cp310-abi3-macosx_11_0_arm64.whl", hash = "sha256:326acfac339c9715de8057c0f2220ff83f8454c9c78215a4de72c0e6bf868df7" },
|
||||
{ url = "https://pypi.fury.io/lance-format/-/ver_17XkBE/pylance-15.0.0b29-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:bf29bb80781a2a40e57842ff8c3fa3e44fa6f3ff264d1a89c6892c9eb3935412" },
|
||||
{ url = "https://pypi.fury.io/lance-format/-/ver_yozDA/pylance-15.0.0b29-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:65b6963bd28aff9029dd96957b0a3507771a61cd5fb2343121dd19acca46515e" },
|
||||
{ url = "https://pypi.fury.io/lance-format/-/ver_Ir3sf/pylance-15.0.0b29-cp310-abi3-manylinux_2_28_aarch64.whl", hash = "sha256:7f500b56414eaaf2f2fdfb0c53ec9470fd81d13619d3f57059c6225b7080f3f2" },
|
||||
{ url = "https://pypi.fury.io/lance-format/-/ver_1G4ois/pylance-15.0.0b29-cp310-abi3-manylinux_2_28_x86_64.whl", hash = "sha256:33c499a2645b5165ff2fe8124ff1af985b8433eac480692cd9bcbfb550039475" },
|
||||
{ url = "https://pypi.fury.io/lance-format/-/ver_1oUx2F/pylance-15.0.0b29-cp310-abi3-win_amd64.whl", hash = "sha256:f88a735790ab2fdbea8f52e4a1a18401b5f3e9a233d4334fda45e3e36dd77504" },
|
||||
{ url = "https://pypi.fury.io/lance-format/-/ver_1Xgvqi/pylance-15.0.0b29-cp310-abi3-win_arm64.whl", hash = "sha256:6e0906650152a82d5fed99e1e526fc8349452446d91acf527b4c98307d87d74d" },
|
||||
{ url = "https://pypi.fury.io/lance-format/-/ver_1lCn6w/pylance-15.0.0b31-cp310-abi3-macosx_11_0_arm64.whl", hash = "sha256:578209e81d42e02067d994241002f8eabb2bef9d9864aa4e572cc2862f2f82d3" },
|
||||
{ url = "https://pypi.fury.io/lance-format/-/ver_2ijZWL/pylance-15.0.0b31-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:617d821455617fda85452c2e198fe5d5f5ab117e4792c44a9383c370708c3bd0" },
|
||||
{ url = "https://pypi.fury.io/lance-format/-/ver_10fXzC/pylance-15.0.0b31-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:707d57e6f1ab40f9285773b5d238d18ba9f09ae3a0e3eb5a35314294ae61a07a" },
|
||||
{ url = "https://pypi.fury.io/lance-format/-/ver_s8TSO/pylance-15.0.0b31-cp310-abi3-manylinux_2_28_aarch64.whl", hash = "sha256:61c97cf9b3fd28f1a99fa72b0fc2a382efa08c1c94e13cb0509fb4bdf27e51de" },
|
||||
{ url = "https://pypi.fury.io/lance-format/-/ver_2j1xRs/pylance-15.0.0b31-cp310-abi3-manylinux_2_28_x86_64.whl", hash = "sha256:a53b26af0e320a115d30222ca54b174f794225a8fe5c8e9546cacc9890c64495" },
|
||||
{ url = "https://pypi.fury.io/lance-format/-/ver_AZZGE/pylance-15.0.0b31-cp310-abi3-win_amd64.whl", hash = "sha256:e6c258cb9d90f05a31fab1ae0f602402aaf0b69b79fc08ad2acf47f3a4d120a2" },
|
||||
{ url = "https://pypi.fury.io/lance-format/-/ver_1kjace/pylance-15.0.0b31-cp310-abi3-win_arm64.whl", hash = "sha256:fd175bcb41f3bd0d6e07a04f4014fe7dc5427bbc5647d3beee85053d12f503c6" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
||||
@@ -32,11 +32,9 @@ use datafusion_physical_plan::{ExecutionPlan, replace_children_if_necessary};
|
||||
use lance::dataset::mem_wal::DatasetMemWalExt;
|
||||
use lance::dataset::scanner::DatasetRecordBatchStream;
|
||||
use lance::dataset::scanner::Scanner;
|
||||
use lance::index::DatasetIndexInternalExt;
|
||||
use lance::io::exec::{ANNIvfBatchExec, ANNIvfSubIndexExec};
|
||||
use lance_datafusion::exec::{analyze_plan as lance_analyze_plan, execute_plan};
|
||||
use lance_index::IndexType;
|
||||
use lance_index::metrics::NoOpMetricsCollector;
|
||||
use lance_index::scalar::FullTextSearchQuery;
|
||||
use lance_index::vector::DIST_COL;
|
||||
use lance_linalg::distance::DistanceType as LanceDistanceType;
|
||||
@@ -668,7 +666,7 @@ impl<'a> AnnExecRef<'a> {
|
||||
/// Cosine PQ/SQ/RQ indices normalize their vectors and use squared L2 internally. This
|
||||
/// preserves ranking, but squared L2 over unit vectors is twice the cosine distance. Flat
|
||||
/// cosine indices calculate cosine directly, so they are not included.
|
||||
async fn normalized_l2_ann_indices(plan: &dyn ExecutionPlan) -> Result<HashSet<String>> {
|
||||
async fn normalized_l2_ann_indices(plan: &dyn ExecutionPlan) -> Result<HashSet<uuid::Uuid>> {
|
||||
let mut ann_plans = Vec::new();
|
||||
find_ann_plans(plan, &mut ann_plans);
|
||||
|
||||
@@ -678,17 +676,22 @@ async fn normalized_l2_ann_indices(plan: &dyn ExecutionPlan) -> Result<HashSet<S
|
||||
if ann.query().metric_type != Some(LanceDistanceType::Cosine) {
|
||||
continue;
|
||||
}
|
||||
for index in ann.indices() {
|
||||
let uuid = index.uuid.to_string();
|
||||
if !checked.insert(uuid.clone()) {
|
||||
continue;
|
||||
}
|
||||
let vector_index = ann
|
||||
.dataset()
|
||||
.open_vector_index(&ann.query().column, &index.uuid, &NoOpMetricsCollector)
|
||||
.await?;
|
||||
let uuids: Vec<_> = ann
|
||||
.indices()
|
||||
.iter()
|
||||
.map(|index| index.uuid)
|
||||
.filter(|uuid| checked.insert(*uuid))
|
||||
.collect();
|
||||
if uuids.is_empty() {
|
||||
continue;
|
||||
}
|
||||
let types = ann
|
||||
.dataset()
|
||||
.vector_index_types(&ann.query().column, &uuids)
|
||||
.await?;
|
||||
for (uuid, index_type) in uuids.into_iter().zip(types) {
|
||||
if matches!(
|
||||
vector_index.index_type(),
|
||||
index_type,
|
||||
IndexType::IvfPq
|
||||
| IndexType::IvfSq
|
||||
| IndexType::IvfRq
|
||||
@@ -745,7 +748,7 @@ fn collect_ann_plans(
|
||||
fn normalize_ann_branches(
|
||||
public_plan: Arc<dyn ExecutionPlan>,
|
||||
internal_plan: Arc<dyn ExecutionPlan>,
|
||||
normalized_l2_indices: &HashSet<String>,
|
||||
normalized_l2_indices: &HashSet<uuid::Uuid>,
|
||||
) -> Result<Arc<dyn ExecutionPlan>> {
|
||||
let mut internal_ann_plans = VecDeque::new();
|
||||
collect_ann_plans(&internal_plan, &mut internal_ann_plans);
|
||||
@@ -763,7 +766,7 @@ fn normalize_ann_branches(
|
||||
fn replace_ann_branches(
|
||||
public_plan: Arc<dyn ExecutionPlan>,
|
||||
internal_ann_plans: &mut VecDeque<Arc<dyn ExecutionPlan>>,
|
||||
normalized_l2_indices: &HashSet<String>,
|
||||
normalized_l2_indices: &HashSet<uuid::Uuid>,
|
||||
) -> Result<Arc<dyn ExecutionPlan>> {
|
||||
if let Some(public_ann) = AnnExecRef::from_plan(public_plan.as_ref()) {
|
||||
let internal_plan = internal_ann_plans
|
||||
@@ -795,7 +798,7 @@ fn replace_ann_branches(
|
||||
let normalized_count = public_ann
|
||||
.indices()
|
||||
.iter()
|
||||
.filter(|index| normalized_l2_indices.contains(&index.uuid.to_string()))
|
||||
.filter(|index| normalized_l2_indices.contains(&index.uuid))
|
||||
.count();
|
||||
if normalized_count == 0 {
|
||||
return Ok(public_plan);
|
||||
@@ -2142,6 +2145,62 @@ mod tests {
|
||||
);
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn test_cold_cosine_rq_plan_only_needs_index_header() {
|
||||
use crate::index::{Index, vector::IvfRqIndexBuilder};
|
||||
use lance::index::DatasetIndexExt;
|
||||
|
||||
let dir = tempfile::tempdir().unwrap();
|
||||
let uri = dir.path().to_str().unwrap();
|
||||
let conn = crate::connect(uri).execute().await.unwrap();
|
||||
let vectors = Arc::new(fixed_size_list_array(
|
||||
(0..512 * 8).map(|n| (1 + n % 31) as f32).collect(),
|
||||
8,
|
||||
));
|
||||
let schema = Arc::new(Schema::new(vec![arrow_schema::Field::new(
|
||||
"vector",
|
||||
vectors.data_type().clone(),
|
||||
false,
|
||||
)]));
|
||||
let batch = RecordBatch::try_new(schema, vec![vectors]).unwrap();
|
||||
let table = conn.create_table("vectors", batch).execute().await.unwrap();
|
||||
table
|
||||
.create_index(
|
||||
&["vector"],
|
||||
Index::IvfRq(
|
||||
IvfRqIndexBuilder::default()
|
||||
.distance_type(crate::DistanceType::Cosine)
|
||||
.num_partitions(1),
|
||||
),
|
||||
)
|
||||
.execute()
|
||||
.await
|
||||
.unwrap();
|
||||
let dataset = table.dataset().unwrap().get().await.unwrap();
|
||||
let indices = dataset.load_indices().await.unwrap();
|
||||
assert_eq!(indices.len(), 1);
|
||||
// The quantizer is needed to execute the search. Planning should only read
|
||||
// the segment's type from index.idx, even with an empty session cache.
|
||||
let auxiliary = dir
|
||||
.path()
|
||||
.join("vectors.lance/_indices")
|
||||
.join(indices[0].uuid.to_string())
|
||||
.join(lance_index::INDEX_AUXILIARY_FILE_NAME);
|
||||
std::fs::remove_file(auxiliary).unwrap();
|
||||
let conn = crate::connect(uri).execute().await.unwrap();
|
||||
let table = conn.open_table("vectors").execute().await.unwrap();
|
||||
let plan = table
|
||||
.vector_search([1.0_f32; 8].as_slice())
|
||||
.unwrap()
|
||||
.create_plan(QueryExecutionOptions::default())
|
||||
.await
|
||||
.unwrap();
|
||||
let mut ann = Vec::new();
|
||||
find_ann_plans(plan.as_ref(), &mut ann);
|
||||
assert_eq!(ann.len(), 1);
|
||||
assert_eq!(ann[0].query().metric_type, Some(LanceDistanceType::Cosine));
|
||||
}
|
||||
|
||||
#[rstest::rstest]
|
||||
#[case::modern(false)]
|
||||
#[case::legacy(true)]
|
||||
@@ -2156,9 +2215,10 @@ mod tests {
|
||||
use crate::connect;
|
||||
use crate::index::{Index, vector::IvfPqIndexBuilder};
|
||||
use lance::index::{
|
||||
DatasetIndexExt,
|
||||
DatasetIndexExt, DatasetIndexInternalExt,
|
||||
vector::{IndexFileVersion, VectorIndexParams},
|
||||
};
|
||||
use lance_index::metrics::NoOpMetricsCollector;
|
||||
|
||||
fn normalized_vector(state: &mut u64, dimension: usize) -> Vec<f32> {
|
||||
let mut vector = (0..dimension)
|
||||
|
||||
Reference in New Issue
Block a user