Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions sqlite-vec.c
Original file line number Diff line number Diff line change
Expand Up @@ -3151,6 +3151,9 @@ int vec0_parse_vector_column(const char *source, int source_length,
else if (sqlite3_strnicmp(token.start, "ivf", indexNameLen) == 0) {
#if SQLITE_VEC_EXPERIMENTAL_IVF_ENABLE
indexType = VEC0_INDEX_TYPE_IVF;
if (elementType != SQLITE_VEC_ELEMENT_TYPE_FLOAT32) {
return SQLITE_ERROR;
}
memset(&ivfConfig, 0, sizeof(ivfConfig));
rc = vec0_parse_ivf_options(&scanner, &ivfConfig);
if (rc != SQLITE_OK) {
Expand Down
10 changes: 10 additions & 0 deletions tests/test-ivf.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,16 @@ def test_ivf_create_error_nprobe_gt_nlist(db):
assert "error" in result


@pytest.mark.parametrize("column", ["v int8[8]", "v bit[8]"])
def test_ivf_create_error_non_float32_column(db, column):
"""IVF cells, centroids and quantizers hold float32 vectors."""
result = exec(
db,
f"CREATE VIRTUAL TABLE t USING vec0({column} indexed by ivf(nlist=2))",
)
assert "error" in result


# ============================================================================
# Shadow table tests
# ============================================================================
Expand Down