Skip to content

Commit 44c6c1b

Browse files
craig[bot]DrewKimball
andcommitted
Merge #145530
145530: vecindex: add vector search cases to canWrap r=yuzefovich a=DrewKimball This commit fixes an oversight from when the vector search operators were added - I forgot to add a case to `canWrap`, so that they could be wrapped into a vectorized (columnar) execution plan. The vector search operators aren't themselves implemented in the vectorized engine, and I don't expect them to be producing many rows that would make the vectorized engine really useful, but this fix will avoid the overhead of constructing an error in `canWrap`. Epic: CRDB-42943 Release note: None Co-authored-by: Drew Kimball <[email protected]>
2 parents c8e1f71 + f20d38e commit 44c6c1b

File tree

3 files changed

+16
-14
lines changed

3 files changed

+16
-14
lines changed

pkg/sql/colexec/colbuilder/execplan.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,8 @@ func canWrap(mode sessiondatapb.VectorizeExecMode, core *execinfrapb.ProcessorCo
310310
case core.StreamIngestionFrontier != nil:
311311
return errStreamIngestionWrap
312312
case core.HashGroupJoiner != nil:
313+
case core.VectorSearch != nil:
314+
case core.VectorMutationSearch != nil:
313315
default:
314316
return errors.AssertionFailedf("unexpected processor core %q", core)
315317
}

pkg/sql/opt/exec/execbuilder/testdata/not_visible_index

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -568,7 +568,7 @@ query T
568568
EXPLAIN SELECT * FROM t1 ORDER BY v <-> '[3,1,2]' LIMIT 5;
569569
----
570570
distribution: local
571-
vectorized: false
571+
vectorized: true
572572
·
573573
• top-k
574574
│ order: +column9

pkg/sql/opt/exec/execbuilder/testdata/vector_search

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ query T
2424
EXPLAIN SELECT * FROM t ORDER BY v <-> '[1, 2, 3]' LIMIT 1;
2525
----
2626
distribution: local
27-
vectorized: false
27+
vectorized: true
2828
·
2929
• top-k
3030
│ order: +column7
@@ -45,7 +45,7 @@ query T
4545
EXPLAIN (VERBOSE) SELECT * FROM t ORDER BY v <-> '[1, 2, 3]' LIMIT 1;
4646
----
4747
distribution: local
48-
vectorized: false
48+
vectorized: true
4949
·
5050
• project
5151
│ columns: (k, v)
@@ -80,7 +80,7 @@ query T
8080
EXPLAIN (VERBOSE) SELECT * FROM t ORDER BY v <-> '[1, 2, 3]' LIMIT 5;
8181
----
8282
distribution: local
83-
vectorized: false
83+
vectorized: true
8484
·
8585
• project
8686
│ columns: (k, v)
@@ -115,7 +115,7 @@ query T
115115
EXPLAIN (VERBOSE) SELECT * FROM t_multi WHERE a = 1 AND b = 2 ORDER BY v <-> '[1, 2, 3]' LIMIT 1;
116116
----
117117
distribution: local
118-
vectorized: false
118+
vectorized: true
119119
·
120120
• project
121121
│ columns: (x, y, a, b, c, v)
@@ -155,7 +155,7 @@ query T
155155
EXPLAIN (VERBOSE) SELECT * FROM t_multi WHERE (a, b) IN ((1, 2), (3, 4), (5, 6)) ORDER BY v <-> '[1, 2, 3]' LIMIT 1;
156156
----
157157
distribution: local
158-
vectorized: false
158+
vectorized: true
159159
·
160160
• project
161161
│ columns: (x, y, a, b, c, v)
@@ -199,7 +199,7 @@ query T
199199
EXPLAIN INSERT INTO t VALUES (1, '[1, 2, 3]');
200200
----
201201
distribution: local
202-
vectorized: false
202+
vectorized: true
203203
·
204204
• insert
205205
│ into: t(k, v)
@@ -217,7 +217,7 @@ query T
217217
EXPLAIN (VERBOSE) INSERT INTO t VALUES (2, '[1, 2, 3]');
218218
----
219219
distribution: local
220-
vectorized: false
220+
vectorized: true
221221
·
222222
• insert
223223
│ columns: ()
@@ -242,7 +242,7 @@ query T
242242
EXPLAIN (VERBOSE) UPDATE t SET v = '[1, 2, 3]' WHERE k = 1;
243243
----
244244
distribution: local
245-
vectorized: false
245+
vectorized: true
246246
·
247247
• update
248248
│ columns: ()
@@ -289,7 +289,7 @@ query T
289289
EXPLAIN (VERBOSE) DELETE FROM t WHERE k = 1;
290290
----
291291
distribution: local
292-
vectorized: false
292+
vectorized: true
293293
·
294294
• delete
295295
│ columns: ()
@@ -318,7 +318,7 @@ query T
318318
EXPLAIN (VERBOSE) INSERT INTO t_multi VALUES (1, 2, 1, 2, 3, '[1, 2, 3]');
319319
----
320320
distribution: local
321-
vectorized: false
321+
vectorized: true
322322
·
323323
• insert
324324
│ columns: ()
@@ -348,7 +348,7 @@ query T
348348
EXPLAIN (VERBOSE) UPDATE t_multi SET v = '[1, 2, 3]' WHERE a = 1 AND b = 2;
349349
----
350350
distribution: local
351-
vectorized: false
351+
vectorized: true
352352
·
353353
• update
354354
│ columns: ()
@@ -406,7 +406,7 @@ query T
406406
EXPLAIN (VERBOSE) UPDATE t_multi SET a = 2 WHERE a = 1;
407407
----
408408
distribution: local
409-
vectorized: false
409+
vectorized: true
410410
·
411411
• update
412412
│ columns: ()
@@ -464,7 +464,7 @@ query T
464464
EXPLAIN (VERBOSE) DELETE FROM t_multi WHERE a = 1 AND b = 2;
465465
----
466466
distribution: local
467-
vectorized: false
467+
vectorized: true
468468
·
469469
• delete
470470
│ columns: ()

0 commit comments

Comments
 (0)