-
Notifications
You must be signed in to change notification settings - Fork 235
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
Vector search support #1402
Vector search support #1402
Conversation
33eb181
to
2bc5121
Compare
90b9191
to
56bfe98
Compare
Any status for this PR? We're hardly waiting for vector support 🙏🏻 Thanks for the work btw! |
@pax-k I am actively working with folks to iron out some bugs and then get this merged. |
980582f
to
1eff387
Compare
8c8a696
to
3201dc5
Compare
libsql-sqlite3/src/vector.c
Outdated
|
||
assert( pUsing!= 0); | ||
|
||
for( i=0; i<pUsing->nId; i++ ){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it ever allowed for vector index to have pUsing->nId != 1?
libsql-sqlite3/src/vector.c
Outdated
return -1; | ||
} | ||
zSql = sqlite3MPrintf(db, "CREATE TABLE IF NOT EXISTS %s_shadow (index_key INT, data BLOB)", pIdx->zName); | ||
rc = sqlite3_exec(db, zSql, 0, 0, 0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm probably still not understanding something but it seems that return -1
in line 393 and 399 will leave shadow table present despite index creation failing. Is this a problem? Probably nothing bad happens despite some junk being kept around. Creation of the index with the same name will just work because of IF NOT EXISTIS
part in the SQL.
libsql-sqlite3/src/vector.c
Outdated
if( !sqlite3Isdigit(*z) ){ | ||
return -1; | ||
} | ||
dims = dims*10 + (*z - '0'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it possible to define FLOAT32(X) with X being bigger than MAX_INT? Would it make sense to check for overflow here and report user readable error explaining that they try to use too big number of dimensions in case of X > MAX_INT or even X > MAX_VECTOR_DIMS?
This pull request adds initial support for vector search in libSQL.
Highlights
Usage
Creating a table with a vector column:
Inserting vector data:
Creating an index on vector column:
Finding top-k similar rows (exact):
Finding top-k similar rows (approximate):
Limitations
rowid
, primary keys not supported.CREATE INDEX
does not index rows that already exist in the base table.