Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inserting binary vectors fails in some scenarios #167

Open
brankoradovanovic-mcom opened this issue Jan 11, 2025 · 0 comments
Open

Inserting binary vectors fails in some scenarios #167

brankoradovanovic-mcom opened this issue Jan 11, 2025 · 0 comments

Comments

@brankoradovanovic-mcom
Copy link

In sqlite-vec 0.1.6, inserting binary vectors fails in some scenarios.

Steps to reproduce

create virtual table test using vec0(
  id text primary key,
  vec float[8]
);

create virtual table test_bq using vec0(
  id text primary key,
  vec bit[8]
);

insert into test(id, vec)
values ('a', '[1, 0, -1, -1, 0, 0, 1, -1]');

insert into test(id, vec)
values ('b', '[0, 0, 1, -1, 1, 0, -1, -1]');

insert into test_bq(id, vec)
select id, vec_quantize_binary(vec)
from test;

insert into test(id, vec)
values ('c', '[1, 0, 1, -1, 0, 0, 1, -1]');

select id, vec_quantize_binary(vec)
from test
where id not in (select id from test_bq); -- Returns the c row, as expected

insert into test_bq(id, vec)
select id, vec_quantize_binary(vec)
from test
where id not in (select id from test_bq); -- Fails

The last insert throws an error:
Error while executing SQL query on database 'test_db': Inserted vector for the "vec" column is invalid: invalid float32 vector BLOB length. Must be divisible by 4, found 1
...so something is amiss here because this should work. (The workaround for the time being is to delete all rows in the target table and insert them again.)

BTW, these minor details aside, sqlite-vec works just beautifully, I'm actually enjoying myself tinkering with it. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant