This commit is contained in:
Alex Garcia 2024-11-17 14:56:31 -08:00
parent 7f47409e60
commit da29ace630
5 changed files with 158 additions and 18 deletions

View file

@ -617,10 +617,28 @@
]),
})
# ---
# name: test_long_text_knn[knn-eq-short]
OrderedDict({
'sql': "select * from v where vector match X'11111111' and k = 5 and name = ?",
'rows': list([
OrderedDict({
'rowid': 1,
'vector': b'\x11\x11\x11\x11',
'name': 'aaaaaaaaaaaa',
}),
]),
})
# ---
# name: test_long_text_knn[knn-eq-true]
dict({
'error': 'OperationalError',
'message': 'Could not filter metadata fields',
OrderedDict({
'sql': "select * from v where vector match X'11111111' and k = 5 and name = ?",
'rows': list([
OrderedDict({
'rowid': 3,
'vector': b'\x11\x11\x11\x11',
'name': 'aaaaaaaaaaaa_aaa',
}),
]),
})
# ---
# name: test_long_text_updates
@ -1416,7 +1434,6 @@
# name: test_stress.1
OrderedDict({
'sql': '''
select
movie_id,
title,
@ -1431,7 +1448,6 @@
and num_reviews between 100 and 500
and mean_rating > 3.5
and k = 5;
''',
'rows': list([
OrderedDict({

View file

@ -119,7 +119,7 @@ def tests_command(file_path):
tests = [
json.loads(row["data"])
for row in db.execute("select data from tests limit 2000").fetchall()
for row in db.execute("select data from tests").fetchall()
]
num_or_skips = 0
@ -179,8 +179,8 @@ def tests_command(file_path):
== diff["values_changed"][bkey]["new_value"]
)
elif len(keys_changed) == 1:
v = int(akey.lstrip("root[").rstrip("]"))
assert v == len(expected_closest_ids)
v = int(keys_changed[0].lstrip("root[").rstrip("]"))
assert (v + 1) == len(expected_closest_ids)
else:
raise Exception("fuck")
num_1off_errors += 1

View file

@ -148,10 +148,17 @@ def test_long_text_knn(db, snapshot):
"create virtual table v using vec0(vector float[1], name text, chunk_size=8)"
)
INSERT = "insert into v(vector, name) values (?, ?)"
exec(db, INSERT, [b"\x11\x11\x11\x11", "aaaaaaaaaaaa"])
exec(db, INSERT, [b"\x11\x11\x11\x11", "bbbbbbbbbbbb"])
exec(db, INSERT, [b"\x11\x11\x11\x11", "aaaaaaaaaaaa_aaa"])
exec(db, INSERT, [b"\x11\x11\x11\x11", "aaaaaaaaaaaa_bbb"])
exec(db, INSERT, [b"\x11\x11\x11\x11", "aaaaaaaaaaaa_ccc"])
assert exec(
db,
"select * from v where vector match X'11111111' and k = 5 and name = ?",
["aaaaaaaaaaaa"],
) == snapshot(name="knn-eq-short")
assert exec(
db,
"select * from v where vector match X'11111111' and k = 5 and name = ?",