mirror of
https://github.com/asg017/sqlite-vec.git
synced 2026-04-25 16:56:27 +02:00
add failing test causes for non eq text knn
This commit is contained in:
parent
07793b3ecc
commit
31622209eb
3 changed files with 211 additions and 29 deletions
|
|
@ -617,30 +617,201 @@
|
|||
]),
|
||||
})
|
||||
# ---
|
||||
# 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]
|
||||
# name: test_long_text_knn[eq-bbbb]
|
||||
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': 'bbbb',
|
||||
}),
|
||||
]),
|
||||
})
|
||||
# ---
|
||||
# name: test_long_text_knn[eq-bbbbbbbbbbbb_aaa]
|
||||
OrderedDict({
|
||||
'sql': "select * from v where vector match X'11111111' and k = 5 and name = ?",
|
||||
'rows': list([
|
||||
]),
|
||||
})
|
||||
# ---
|
||||
# name: test_long_text_knn[eq-bbbbbbbbbbbb_bbb]
|
||||
OrderedDict({
|
||||
'sql': "select * from v where vector match X'11111111' and k = 5 and name = ?",
|
||||
'rows': list([
|
||||
OrderedDict({
|
||||
'rowid': 4,
|
||||
'vector': b'\x11\x11\x11\x11',
|
||||
'name': 'bbbbbbbbbbbb_bbb',
|
||||
}),
|
||||
]),
|
||||
})
|
||||
# ---
|
||||
# name: test_long_text_knn[eq-bbbbbbbbbbbb_ccc]
|
||||
OrderedDict({
|
||||
'sql': "select * from v where vector match X'11111111' and k = 5 and name = ?",
|
||||
'rows': list([
|
||||
]),
|
||||
})
|
||||
# ---
|
||||
# name: test_long_text_knn[eq-longlonglonglonglonglonglong]
|
||||
OrderedDict({
|
||||
'sql': "select * from v where vector match X'11111111' and k = 5 and name = ?",
|
||||
'rows': list([
|
||||
]),
|
||||
})
|
||||
# ---
|
||||
# name: test_long_text_knn[ge-bbbb]
|
||||
dict({
|
||||
'error': 'OperationalError',
|
||||
'message': 'Could not filter metadata fields',
|
||||
})
|
||||
# ---
|
||||
# name: test_long_text_knn[ge-bbbbbbbbbbbb_aaa]
|
||||
dict({
|
||||
'error': 'OperationalError',
|
||||
'message': 'Could not filter metadata fields',
|
||||
})
|
||||
# ---
|
||||
# name: test_long_text_knn[ge-bbbbbbbbbbbb_bbb]
|
||||
dict({
|
||||
'error': 'OperationalError',
|
||||
'message': 'Could not filter metadata fields',
|
||||
})
|
||||
# ---
|
||||
# name: test_long_text_knn[ge-bbbbbbbbbbbb_ccc]
|
||||
dict({
|
||||
'error': 'OperationalError',
|
||||
'message': 'Could not filter metadata fields',
|
||||
})
|
||||
# ---
|
||||
# name: test_long_text_knn[ge-longlonglonglonglonglonglong]
|
||||
dict({
|
||||
'error': 'OperationalError',
|
||||
'message': 'Could not filter metadata fields',
|
||||
})
|
||||
# ---
|
||||
# name: test_long_text_knn[gt-bbbb]
|
||||
dict({
|
||||
'error': 'OperationalError',
|
||||
'message': 'Could not filter metadata fields',
|
||||
})
|
||||
# ---
|
||||
# name: test_long_text_knn[gt-bbbbbbbbbbbb_aaa]
|
||||
dict({
|
||||
'error': 'OperationalError',
|
||||
'message': 'Could not filter metadata fields',
|
||||
})
|
||||
# ---
|
||||
# name: test_long_text_knn[gt-bbbbbbbbbbbb_bbb]
|
||||
dict({
|
||||
'error': 'OperationalError',
|
||||
'message': 'Could not filter metadata fields',
|
||||
})
|
||||
# ---
|
||||
# name: test_long_text_knn[gt-bbbbbbbbbbbb_ccc]
|
||||
dict({
|
||||
'error': 'OperationalError',
|
||||
'message': 'Could not filter metadata fields',
|
||||
})
|
||||
# ---
|
||||
# name: test_long_text_knn[gt-longlonglonglonglonglonglong]
|
||||
dict({
|
||||
'error': 'OperationalError',
|
||||
'message': 'Could not filter metadata fields',
|
||||
})
|
||||
# ---
|
||||
# name: test_long_text_knn[le-bbbb]
|
||||
dict({
|
||||
'error': 'OperationalError',
|
||||
'message': 'Could not filter metadata fields',
|
||||
})
|
||||
# ---
|
||||
# name: test_long_text_knn[le-bbbbbbbbbbbb_aaa]
|
||||
dict({
|
||||
'error': 'OperationalError',
|
||||
'message': 'Could not filter metadata fields',
|
||||
})
|
||||
# ---
|
||||
# name: test_long_text_knn[le-bbbbbbbbbbbb_bbb]
|
||||
dict({
|
||||
'error': 'OperationalError',
|
||||
'message': 'Could not filter metadata fields',
|
||||
})
|
||||
# ---
|
||||
# name: test_long_text_knn[le-bbbbbbbbbbbb_ccc]
|
||||
dict({
|
||||
'error': 'OperationalError',
|
||||
'message': 'Could not filter metadata fields',
|
||||
})
|
||||
# ---
|
||||
# name: test_long_text_knn[le-longlonglonglonglonglonglong]
|
||||
dict({
|
||||
'error': 'OperationalError',
|
||||
'message': 'Could not filter metadata fields',
|
||||
})
|
||||
# ---
|
||||
# name: test_long_text_knn[lt-bbbb]
|
||||
dict({
|
||||
'error': 'OperationalError',
|
||||
'message': 'Could not filter metadata fields',
|
||||
})
|
||||
# ---
|
||||
# name: test_long_text_knn[lt-bbbbbbbbbbbb_aaa]
|
||||
dict({
|
||||
'error': 'OperationalError',
|
||||
'message': 'Could not filter metadata fields',
|
||||
})
|
||||
# ---
|
||||
# name: test_long_text_knn[lt-bbbbbbbbbbbb_bbb]
|
||||
dict({
|
||||
'error': 'OperationalError',
|
||||
'message': 'Could not filter metadata fields',
|
||||
})
|
||||
# ---
|
||||
# name: test_long_text_knn[lt-bbbbbbbbbbbb_ccc]
|
||||
dict({
|
||||
'error': 'OperationalError',
|
||||
'message': 'Could not filter metadata fields',
|
||||
})
|
||||
# ---
|
||||
# name: test_long_text_knn[lt-longlonglonglonglonglonglong]
|
||||
dict({
|
||||
'error': 'OperationalError',
|
||||
'message': 'Could not filter metadata fields',
|
||||
})
|
||||
# ---
|
||||
# name: test_long_text_knn[ne-bbbb]
|
||||
dict({
|
||||
'error': 'OperationalError',
|
||||
'message': 'unrecognized token: "!"',
|
||||
})
|
||||
# ---
|
||||
# name: test_long_text_knn[ne-bbbbbbbbbbbb_aaa]
|
||||
dict({
|
||||
'error': 'OperationalError',
|
||||
'message': 'unrecognized token: "!"',
|
||||
})
|
||||
# ---
|
||||
# name: test_long_text_knn[ne-bbbbbbbbbbbb_bbb]
|
||||
dict({
|
||||
'error': 'OperationalError',
|
||||
'message': 'unrecognized token: "!"',
|
||||
})
|
||||
# ---
|
||||
# name: test_long_text_knn[ne-bbbbbbbbbbbb_ccc]
|
||||
dict({
|
||||
'error': 'OperationalError',
|
||||
'message': 'unrecognized token: "!"',
|
||||
})
|
||||
# ---
|
||||
# name: test_long_text_knn[ne-longlonglonglonglonglonglong]
|
||||
dict({
|
||||
'error': 'OperationalError',
|
||||
'message': 'unrecognized token: "!"',
|
||||
})
|
||||
# ---
|
||||
# name: test_long_text_updates
|
||||
dict({
|
||||
'v_chunks': OrderedDict({
|
||||
|
|
|
|||
|
|
@ -138,22 +138,30 @@ 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", "aaaa"])
|
||||
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"])
|
||||
exec(db, INSERT, [b"\x11\x11\x11\x11", "bbbb"])
|
||||
exec(db, INSERT, [b"\x11\x11\x11\x11", "bbbbbbbbbbbb_bbb"])
|
||||
exec(db, INSERT, [b"\x11\x11\x11\x11", "cccc"])
|
||||
exec(db, INSERT, [b"\x11\x11\x11\x11", "cccccccccccc_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 = ?",
|
||||
["aaaaaaaaaaaa_aaa"],
|
||||
) == snapshot(name="knn-eq-true")
|
||||
tests = [
|
||||
"bbbb",
|
||||
"bbbbbbbbbbbb_bbb",
|
||||
"bbbbbbbbbbbb_aaa",
|
||||
"bbbbbbbbbbbb_ccc",
|
||||
"longlonglonglonglonglonglong",
|
||||
]
|
||||
ops = ["=", "!-", "<", "<=", ">", ">="]
|
||||
op_names = ["eq", "ne", "lt", "le", "gt", "ge"]
|
||||
|
||||
for test in tests:
|
||||
for op, op_name in zip(ops, op_names):
|
||||
assert exec(
|
||||
db,
|
||||
f"select * from v where vector match X'11111111' and k = 5 and name {op} ?",
|
||||
[test],
|
||||
) == snapshot(name=f"{op_name}-{test}")
|
||||
|
||||
|
||||
def test_types(db, snapshot):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue