mirror of
https://github.com/asg017/sqlite-vec.git
synced 2026-04-25 00:36:56 +02:00
PARTITION KEY support (#122)
* initial pass at PARTITION KEY support. * unit tests * gha this PR branch * fixup tests * doc internal * fix tests, KNN/rowids in * define SQLITE_INDEX_CONSTRAINT_OFFSET * whoops * update tests, syrupy, use uv * un ignore pyproject.toml * dot * tests/ * type error? * win: .exe, update error name * try fix macos python, paren around expr? * win bash? * dbg :( * explicit error * op * dbg win * win ./tests/.venv/Scripts/python.exe * block UPDATEs on partition key values for now
This commit is contained in:
parent
ee3654701f
commit
6658624172
16 changed files with 1522 additions and 245 deletions
49
test.sql
Normal file
49
test.sql
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
.load dist/vec0
|
||||
.echo on
|
||||
.bail on
|
||||
|
||||
.mode qbox
|
||||
|
||||
create virtual table v using vec0(a float[1]);
|
||||
select count(*) from v_chunks;
|
||||
insert into v(a) values ('[1.11]');
|
||||
select * from v;
|
||||
drop table v;
|
||||
|
||||
create virtual table v using vec0(
|
||||
|
||||
v_aaa float[1],
|
||||
partk_xxx int partition key,
|
||||
v_bbb float[2],
|
||||
partk_yyy text partition key,
|
||||
chunk_size=32
|
||||
);
|
||||
|
||||
|
||||
insert into v(rowid, v_aaa, partk_xxx, v_bbb, partk_yyy) values
|
||||
(1, '[.1]', 999, '[.11, .11]', 'alex'),
|
||||
(2, '[.2]', 999, '[.22, .22]', 'alex'),
|
||||
(3, '[.3]', 999, '[.33, .33]', 'brian');
|
||||
|
||||
|
||||
select rowid, vec_to_json(v_aaa), partk_xxx, vec_to_json(v_bbb), partk_yyy from v;
|
||||
|
||||
select * from v;
|
||||
select * from v where rowid = 2;
|
||||
update v
|
||||
set v_aaa = '[.222]',
|
||||
v_bbb = '[.222, .222]'
|
||||
where rowid = 2;
|
||||
|
||||
select rowid, vec_to_json(v_aaa), partk_xxx, vec_to_json(v_bbb), partk_yyy from v;
|
||||
|
||||
select chunk_id, size, sequence_id, partition00, partition01, (validity), length(rowids) from v_chunks;
|
||||
|
||||
--explain query plan
|
||||
select *, distance
|
||||
from v
|
||||
where v_aaa match '[.5]'
|
||||
and partk_xxx = 999
|
||||
and partk_yyy = 'alex'
|
||||
--and partk_xxx != 20
|
||||
and k = 5;
|
||||
Loading…
Add table
Add a link
Reference in a new issue