Skip to content

Commit 9562030

Browse files
committed
fix: Handle empty label_enumeration metadata and correct query dtypes in filtered Vamana tests
Fixes 6 test failures where empty filter metadata strings caused JSON decode errors, and query vectors were sliced from float64 arrays instead of the float32 vectors array.
1 parent 161316f commit 9562030

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

apis/python/src/tiledb/vector_search/vamana_index.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ def query_internal(
254254
if where is not None:
255255
# Get label enumeration from metadata
256256
label_enum_str = self.group.meta.get("label_enumeration", None)
257-
if label_enum_str is None:
257+
if not label_enum_str:
258258
raise ValueError(
259259
"Cannot use 'where' parameter: index does not have filter metadata. "
260260
"This index was not created with filter support."

apis/python/test/test_filtered_vamana.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ def test_filtered_query_equality(tmp_path):
141141
index = VamanaIndex(uri=uri)
142142

143143
# Query near cluster A with filter for dataset_A
144-
query = vectors_cluster_a[0:1] # Use first vector from cluster A
144+
query = vectors[0:1] # Use first vector from cluster A (dataset_A)
145145
distances, ids = index.query(query, k=k, where="label == 'dataset_A'")
146146

147147
# Verify all results are from dataset_A (IDs 0-249)
@@ -227,7 +227,7 @@ def test_filtered_query_in_clause(tmp_path):
227227
index = VamanaIndex(uri=uri)
228228

229229
# Query with IN clause for datasets 1 and 3
230-
query = vectors_a[0:1]
230+
query = vectors[0:1] # Use first vector from cluster A (soma_dataset_1)
231231
distances, ids = index.query(
232232
query, k=k, where="label IN ('soma_dataset_1', 'soma_dataset_3')"
233233
)

0 commit comments

Comments
 (0)