mirror of
https://github.com/asg017/sqlite-vec.git
synced 2026-04-25 00:36:56 +02:00
initial pass at PARTITION KEY support.
This commit is contained in:
parent
9cc0deae34
commit
776d86cc0c
3 changed files with 755 additions and 154 deletions
7
TODO
Normal file
7
TODO
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
# partition
|
||||
|
||||
- UPDATE on partition key values
|
||||
- remove previous row from chunk, insert into new one?
|
||||
- enforce column types on insert?
|
||||
- allow null values?
|
||||
- properly sqlite3_vtab_nochange / sqlite3_value_nochange handling
|
||||
853
sqlite-vec.c
853
sqlite-vec.c
File diff suppressed because it is too large
Load diff
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