Skip to content

Commit 02f3d5e

Browse files
committed
Add test for vector index with projection.
1 parent 16f6909 commit 02f3d5e

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

enginetest/queries/vector_index_queries.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,17 @@ var VectorIndexQueries = []ScriptTest{
4444
},
4545
ExpectedIndexes: []string{"v_idx"},
4646
},
47+
{
48+
// Use the index even when there's a projection involved.
49+
Query: "select `id`+1 from vectors order by VEC_DISTANCE('[0.0,0.0]', v) limit 4",
50+
Expected: []sql.Row{
51+
{3},
52+
{4},
53+
{5},
54+
{2},
55+
},
56+
ExpectedIndexes: []string{"v_idx"},
57+
},
4758
{
4859
// Only queries with a limit can use a vector index.
4960
Query: "select * from vectors order by VEC_DISTANCE('[0.0,0.0]', v)",

0 commit comments

Comments
 (0)