block WHERE constraints on auxiliary columns in KNN queries

This commit is contained in:
Alex Garcia 2024-11-13 15:27:23 -08:00
parent 7d4c023928
commit 743511af55
3 changed files with 81 additions and 1 deletions

View file

@ -81,7 +81,21 @@ def test_deletes(db, snapshot):
def test_knn(db, snapshot):
pass
db.execute("create virtual table v using vec0(vector float[1], +name text)")
db.executemany(
"insert into v(vector, name) values (?, ?)",
[("[1]", "alex"), ("[2]", "brian"), ("[3]", "craig")],
)
assert exec(db, "select * from v") == snapshot()
assert exec(
db, "select *, distance from v where vector match '[5]' and k = 10"
) == snapshot(name="legal KNN w/ aux")
# EVIDENCE-OF: V25623_09693 No aux constraint allowed on KNN queries
assert exec(
db,
"select *, distance from v where vector match '[5]' and k = 10 and name = 'alex'",
) == snapshot(name="illegal KNN w/ aux")
def exec(db, sql, parameters=[]):