mirror of
https://github.com/asg017/sqlite-vec.git
synced 2026-04-25 16:56:27 +02:00
block WHERE constraints on auxiliary columns in KNN queries
This commit is contained in:
parent
7d4c023928
commit
743511af55
3 changed files with 81 additions and 1 deletions
|
|
@ -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=[]):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue