Skip to content

Commit 0dcadef

Browse files
authored
planner: stabilize the vector index test (#58254)
ref #57871
1 parent bd07e09 commit 0dcadef

File tree

2 files changed

+59
-59
lines changed

2 files changed

+59
-59
lines changed

pkg/planner/core/casetest/vectorsearch/testdata/ann_index_suite_out.json

Lines changed: 58 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -5,60 +5,62 @@
55
{
66
"SQL": "explain format = 'brief' select * from t1;",
77
"Plan": [
8-
"TableReader 49152.00 root MppVersion: 2, data:ExchangeSender",
9-
"└─ExchangeSender 49152.00 mpp[tiflash] ExchangeType: PassThrough",
10-
" └─TableFullScan 49152.00 mpp[tiflash] table:t1 keep order:false, stats:pseudo"
8+
"TableReader 48.00 root MppVersion: 2, data:ExchangeSender",
9+
"└─ExchangeSender 48.00 mpp[tiflash] ExchangeType: PassThrough",
10+
" └─TableFullScan 48.00 mpp[tiflash] table:t1 keep order:false, stats:pseudo"
1111
],
1212
"Warn": null
1313
},
1414
{
1515
"SQL": "explain format = 'brief' select * from t1 where a<1;",
1616
"Plan": [
17-
"TableReader 16334.85 root MppVersion: 2, data:ExchangeSender",
18-
"└─ExchangeSender 16334.85 mpp[tiflash] ExchangeType: PassThrough",
19-
" └─TableFullScan 16334.85 mpp[tiflash] table:t1 pushed down filter:lt(test.t1.a, 1), keep order:false, stats:pseudo"
17+
"TableReader 15.95 root MppVersion: 2, data:ExchangeSender",
18+
"└─ExchangeSender 15.95 mpp[tiflash] ExchangeType: PassThrough",
19+
" └─Selection 15.95 mpp[tiflash] lt(test.t1.a, 1)",
20+
" └─TableFullScan 48.00 mpp[tiflash] table:t1 pushed down filter:empty, keep order:false, stats:pseudo"
2021
],
2122
"Warn": null
2223
},
2324
{
2425
"SQL": "explain format = 'brief' select * from t1 where vec = '[1,1,1]'",
2526
"Plan": [
26-
"TableReader 49.15 root MppVersion: 2, data:ExchangeSender",
27-
"└─ExchangeSender 49.15 mpp[tiflash] ExchangeType: PassThrough",
28-
" └─TableFullScan 49.15 mpp[tiflash] table:t1 pushed down filter:eq(test.t1.vec, [1,1,1]), keep order:false, stats:pseudo"
27+
"TableReader 0.05 root MppVersion: 2, data:ExchangeSender",
28+
"└─ExchangeSender 0.05 mpp[tiflash] ExchangeType: PassThrough",
29+
" └─Selection 0.05 mpp[tiflash] eq(test.t1.vec, [1,1,1])",
30+
" └─TableFullScan 48.00 mpp[tiflash] table:t1 pushed down filter:empty, keep order:false, stats:pseudo"
2931
],
3032
"Warn": null
3133
},
3234
{
3335
"SQL": "explain format = 'brief' select * from t1 where vec_cosine_distance(vec, '[1,1,1]') < 0.1",
3436
"Plan": [
35-
"TableReader 39321.60 root MppVersion: 2, data:ExchangeSender",
36-
"└─ExchangeSender 39321.60 mpp[tiflash] ExchangeType: PassThrough",
37-
" └─Selection 39321.60 mpp[tiflash] lt(vec_cosine_distance(test.t1.vec, [1,1,1]), 0.1)",
38-
" └─TableFullScan 49152.00 mpp[tiflash] table:t1 pushed down filter:empty, keep order:false, stats:pseudo"
37+
"TableReader 38.40 root MppVersion: 2, data:ExchangeSender",
38+
"└─ExchangeSender 38.40 mpp[tiflash] ExchangeType: PassThrough",
39+
" └─Selection 38.40 mpp[tiflash] lt(vec_cosine_distance(test.t1.vec, [1,1,1]), 0.1)",
40+
" └─TableFullScan 48.00 mpp[tiflash] table:t1 pushed down filter:empty, keep order:false, stats:pseudo"
3941
],
4042
"Warn": null
4143
},
4244
{
4345
"SQL": "explain format = 'brief' select vec_cosine_distance(vec, '[1,1,1]') as dis from t1 having dis < 0.1",
4446
"Plan": [
45-
"TableReader 39321.60 root MppVersion: 2, data:ExchangeSender",
46-
"└─ExchangeSender 39321.60 mpp[tiflash] ExchangeType: PassThrough",
47-
" └─Projection 39321.60 mpp[tiflash] vec_cosine_distance(test.t1.vec, [1,1,1])->Column#7",
48-
" └─Selection 39321.60 mpp[tiflash] lt(vec_cosine_distance(test.t1.vec, [1,1,1]), 0.1)",
49-
" └─TableFullScan 49152.00 mpp[tiflash] table:t1 pushed down filter:empty, keep order:false, stats:pseudo"
47+
"TableReader 38.40 root MppVersion: 2, data:ExchangeSender",
48+
"└─ExchangeSender 38.40 mpp[tiflash] ExchangeType: PassThrough",
49+
" └─Projection 38.40 mpp[tiflash] vec_cosine_distance(test.t1.vec, [1,1,1])->Column#7",
50+
" └─Selection 38.40 mpp[tiflash] lt(vec_cosine_distance(test.t1.vec, [1,1,1]), 0.1)",
51+
" └─TableFullScan 48.00 mpp[tiflash] table:t1 pushed down filter:empty, keep order:false, stats:pseudo"
5052
],
5153
"Warn": null
5254
},
5355
{
5456
"SQL": "explain format = 'brief' select * from t1 order by vec_cosine_distance(vec, '[1,1,1]')",
5557
"Plan": [
56-
"Projection 49152.00 root test.t1.vec, test.t1.a, test.t1.b, test.t1.c, test.t1.d",
57-
"└─Sort 49152.00 root Column#7",
58-
" └─Projection 49152.00 root test.t1.vec, test.t1.a, test.t1.b, test.t1.c, test.t1.d, vec_cosine_distance(test.t1.vec, [1,1,1])->Column#7",
59-
" └─TableReader 49152.00 root MppVersion: 2, data:ExchangeSender",
60-
" └─ExchangeSender 49152.00 mpp[tiflash] ExchangeType: PassThrough",
61-
" └─TableFullScan 49152.00 mpp[tiflash] table:t1 keep order:false, stats:pseudo"
58+
"Projection 48.00 root test.t1.vec, test.t1.a, test.t1.b, test.t1.c, test.t1.d",
59+
"└─Sort 48.00 root Column#7",
60+
" └─Projection 48.00 root test.t1.vec, test.t1.a, test.t1.b, test.t1.c, test.t1.d, vec_cosine_distance(test.t1.vec, [1,1,1])->Column#7",
61+
" └─TableReader 48.00 root MppVersion: 2, data:ExchangeSender",
62+
" └─ExchangeSender 48.00 mpp[tiflash] ExchangeType: PassThrough",
63+
" └─TableFullScan 48.00 mpp[tiflash] table:t1 keep order:false, stats:pseudo"
6264
],
6365
"Warn": null
6466
},
@@ -102,8 +104,8 @@
102104
" └─ExchangeSender 1.00 mpp[tiflash] ExchangeType: PassThrough",
103105
" └─Projection 1.00 mpp[tiflash] test.t1.vec, test.t1.a, test.t1.b, test.t1.c, test.t1.d",
104106
" └─TopN 1.00 mpp[tiflash] Column#7:desc, offset:0, count:1",
105-
" └─Projection 49152.00 mpp[tiflash] test.t1.vec, test.t1.a, test.t1.b, test.t1.c, test.t1.d, vec_cosine_distance(test.t1.vec, [1,1,1])->Column#7",
106-
" └─TableFullScan 49152.00 mpp[tiflash] table:t1 keep order:false, stats:pseudo"
107+
" └─Projection 48.00 mpp[tiflash] test.t1.vec, test.t1.a, test.t1.b, test.t1.c, test.t1.d, vec_cosine_distance(test.t1.vec, [1,1,1])->Column#7",
108+
" └─TableFullScan 48.00 mpp[tiflash] table:t1 keep order:false, stats:pseudo"
107109
],
108110
"Warn": null
109111
},
@@ -117,8 +119,8 @@
117119
" └─ExchangeSender 1.00 mpp[tiflash] ExchangeType: PassThrough",
118120
" └─Projection 1.00 mpp[tiflash] test.t1.vec, test.t1.a, test.t1.b, test.t1.c, test.t1.d",
119121
" └─TopN 1.00 mpp[tiflash] Column#7:desc, offset:0, count:1",
120-
" └─Projection 49152.00 mpp[tiflash] test.t1.vec, test.t1.a, test.t1.b, test.t1.c, test.t1.d, vec_cosine_distance(test.t1.vec, [1,1,1])->Column#7",
121-
" └─TableFullScan 49152.00 mpp[tiflash] table:t1 keep order:false, stats:pseudo"
122+
" └─Projection 48.00 mpp[tiflash] test.t1.vec, test.t1.a, test.t1.b, test.t1.c, test.t1.d, vec_cosine_distance(test.t1.vec, [1,1,1])->Column#7",
123+
" └─TableFullScan 48.00 mpp[tiflash] table:t1 keep order:false, stats:pseudo"
122124
],
123125
"Warn": null
124126
},
@@ -132,8 +134,8 @@
132134
" └─ExchangeSender 1.00 mpp[tiflash] ExchangeType: PassThrough",
133135
" └─Projection 1.00 mpp[tiflash] test.t1.vec, test.t1.a, test.t1.b, test.t1.c, test.t1.d",
134136
" └─TopN 1.00 mpp[tiflash] Column#7, offset:0, count:1",
135-
" └─Projection 49152.00 mpp[tiflash] test.t1.vec, test.t1.a, test.t1.b, test.t1.c, test.t1.d, plus(vec_cosine_distance(test.t1.vec, [1,1,1]), 1)->Column#7",
136-
" └─TableFullScan 49152.00 mpp[tiflash] table:t1 keep order:false, stats:pseudo"
137+
" └─Projection 48.00 mpp[tiflash] test.t1.vec, test.t1.a, test.t1.b, test.t1.c, test.t1.d, plus(vec_cosine_distance(test.t1.vec, [1,1,1]), 1)->Column#7",
138+
" └─TableFullScan 48.00 mpp[tiflash] table:t1 keep order:false, stats:pseudo"
137139
],
138140
"Warn": null
139141
},
@@ -147,8 +149,8 @@
147149
" └─ExchangeSender 1.00 mpp[tiflash] ExchangeType: PassThrough",
148150
" └─Projection 1.00 mpp[tiflash] test.t1.vec, test.t1.a, test.t1.b, test.t1.c, test.t1.d",
149151
" └─TopN 1.00 mpp[tiflash] Column#7, test.t1.vec, offset:0, count:1",
150-
" └─Projection 49152.00 mpp[tiflash] test.t1.vec, test.t1.a, test.t1.b, test.t1.c, test.t1.d, vec_cosine_distance(test.t1.vec, [1,1,1])->Column#7",
151-
" └─TableFullScan 49152.00 mpp[tiflash] table:t1 keep order:false, stats:pseudo"
152+
" └─Projection 48.00 mpp[tiflash] test.t1.vec, test.t1.a, test.t1.b, test.t1.c, test.t1.d, vec_cosine_distance(test.t1.vec, [1,1,1])->Column#7",
153+
" └─TableFullScan 48.00 mpp[tiflash] table:t1 keep order:false, stats:pseudo"
152154
],
153155
"Warn": null
154156
},
@@ -162,8 +164,8 @@
162164
" └─ExchangeSender 1.00 mpp[tiflash] ExchangeType: PassThrough",
163165
" └─Projection 1.00 mpp[tiflash] test.t1.vec, test.t1.a, test.t1.b, test.t1.c, test.t1.d",
164166
" └─TopN 1.00 mpp[tiflash] Column#7, offset:0, count:1",
165-
" └─Projection 49152.00 mpp[tiflash] test.t1.vec, test.t1.a, test.t1.b, test.t1.c, test.t1.d, vec_l2_distance(test.t1.vec, [1,1,1])->Column#7",
166-
" └─TableFullScan 49152.00 mpp[tiflash] table:t1 keep order:false, stats:pseudo"
167+
" └─Projection 48.00 mpp[tiflash] test.t1.vec, test.t1.a, test.t1.b, test.t1.c, test.t1.d, vec_l2_distance(test.t1.vec, [1,1,1])->Column#7",
168+
" └─TableFullScan 48.00 mpp[tiflash] table:t1 keep order:false, stats:pseudo"
167169
],
168170
"Warn": null
169171
},
@@ -177,8 +179,8 @@
177179
" └─ExchangeSender 1.00 mpp[tiflash] ExchangeType: PassThrough",
178180
" └─Projection 1.00 mpp[tiflash] test.t1.vec, test.t1.a, test.t1.b, test.t1.c, test.t1.d",
179181
" └─TopN 1.00 mpp[tiflash] Column#7, offset:0, count:1",
180-
" └─Projection 49152.00 mpp[tiflash] test.t1.vec, test.t1.a, test.t1.b, test.t1.c, test.t1.d, vec_l1_distance(test.t1.vec, [1,1,1])->Column#7",
181-
" └─TableFullScan 49152.00 mpp[tiflash] table:t1 keep order:false, stats:pseudo"
182+
" └─Projection 48.00 mpp[tiflash] test.t1.vec, test.t1.a, test.t1.b, test.t1.c, test.t1.d, vec_l1_distance(test.t1.vec, [1,1,1])->Column#7",
183+
" └─TableFullScan 48.00 mpp[tiflash] table:t1 keep order:false, stats:pseudo"
182184
],
183185
"Warn": null
184186
},
@@ -192,8 +194,8 @@
192194
" └─ExchangeSender 1.00 mpp[tiflash] ExchangeType: PassThrough",
193195
" └─Projection 1.00 mpp[tiflash] test.t1.vec, test.t1.a, test.t1.b, test.t1.c, test.t1.d",
194196
" └─TopN 1.00 mpp[tiflash] Column#7, offset:0, count:1",
195-
" └─Projection 49152.00 mpp[tiflash] test.t1.vec, test.t1.a, test.t1.b, test.t1.c, test.t1.d, vec_l2_distance(test.t1.c, [1,1,1])->Column#7",
196-
" └─TableFullScan 49152.00 mpp[tiflash] table:t1 keep order:false, stats:pseudo"
197+
" └─Projection 48.00 mpp[tiflash] test.t1.vec, test.t1.a, test.t1.b, test.t1.c, test.t1.d, vec_l2_distance(test.t1.c, [1,1,1])->Column#7",
198+
" └─TableFullScan 48.00 mpp[tiflash] table:t1 keep order:false, stats:pseudo"
197199
],
198200
"Warn": null
199201
},
@@ -207,8 +209,8 @@
207209
" └─ExchangeSender 1.00 mpp[tiflash] ExchangeType: PassThrough",
208210
" └─Projection 1.00 mpp[tiflash] test.t1.vec, test.t1.a, test.t1.b, test.t1.c, test.t1.d",
209211
" └─TopN 1.00 mpp[tiflash] Column#7, offset:0, count:1",
210-
" └─Projection 49152.00 mpp[tiflash] test.t1.vec, test.t1.a, test.t1.b, test.t1.c, test.t1.d, vec_l2_distance(test.t1.d, [1,1,1])->Column#7",
211-
" └─TableFullScan 49152.00 mpp[tiflash] table:t1 keep order:false, stats:pseudo"
212+
" └─Projection 48.00 mpp[tiflash] test.t1.vec, test.t1.a, test.t1.b, test.t1.c, test.t1.d, vec_l2_distance(test.t1.d, [1,1,1])->Column#7",
213+
" └─TableFullScan 48.00 mpp[tiflash] table:t1 keep order:false, stats:pseudo"
212214
],
213215
"Warn": null
214216
},
@@ -222,8 +224,8 @@
222224
" └─ExchangeSender 1.00 mpp[tiflash] ExchangeType: PassThrough",
223225
" └─Projection 1.00 mpp[tiflash] test.t1.vec, test.t1.a, test.t1.b, test.t1.c, test.t1.d",
224226
" └─TopN 1.00 mpp[tiflash] Column#7, offset:0, count:1",
225-
" └─Projection 49152.00 mpp[tiflash] test.t1.vec, test.t1.a, test.t1.b, test.t1.c, test.t1.d, vec_cosine_distance(test.t1.d, [1,1,1])->Column#7",
226-
" └─TableFullScan 49152.00 mpp[tiflash] table:t1 keep order:false, stats:pseudo"
227+
" └─Projection 48.00 mpp[tiflash] test.t1.vec, test.t1.a, test.t1.b, test.t1.c, test.t1.d, vec_cosine_distance(test.t1.d, [1,1,1])->Column#7",
228+
" └─TableFullScan 48.00 mpp[tiflash] table:t1 keep order:false, stats:pseudo"
227229
],
228230
"Warn": null
229231
},
@@ -237,19 +239,19 @@
237239
" └─ExchangeSender 1.00 mpp[tiflash] ExchangeType: PassThrough",
238240
" └─Projection 1.00 mpp[tiflash] test.t1.vec, test.t1.a, test.t1.b, test.t1.c, test.t1.d",
239241
" └─TopN 1.00 mpp[tiflash] Column#7, offset:0, count:1",
240-
" └─Projection 49152.00 mpp[tiflash] test.t1.vec, test.t1.a, test.t1.b, test.t1.c, test.t1.d, vec_l1_distance(test.t1.d, [1,1,1])->Column#7",
241-
" └─TableFullScan 49152.00 mpp[tiflash] table:t1 keep order:false, stats:pseudo"
242+
" └─Projection 48.00 mpp[tiflash] test.t1.vec, test.t1.a, test.t1.b, test.t1.c, test.t1.d, vec_l1_distance(test.t1.d, [1,1,1])->Column#7",
243+
" └─TableFullScan 48.00 mpp[tiflash] table:t1 keep order:false, stats:pseudo"
242244
],
243245
"Warn": null
244246
},
245247
{
246248
"SQL": "explain format = 'brief' select vec_cosine_distance(vec, '[1,1,1]') as d from t1 order by d",
247249
"Plan": [
248-
"Sort 49152.00 root Column#7",
249-
"└─TableReader 49152.00 root MppVersion: 2, data:ExchangeSender",
250-
" └─ExchangeSender 49152.00 mpp[tiflash] ExchangeType: PassThrough",
251-
" └─Projection 49152.00 mpp[tiflash] vec_cosine_distance(test.t1.vec, [1,1,1])->Column#7",
252-
" └─TableFullScan 49152.00 mpp[tiflash] table:t1 keep order:false, stats:pseudo"
250+
"Sort 48.00 root Column#7",
251+
"└─TableReader 48.00 root MppVersion: 2, data:ExchangeSender",
252+
" └─ExchangeSender 48.00 mpp[tiflash] ExchangeType: PassThrough",
253+
" └─Projection 48.00 mpp[tiflash] vec_cosine_distance(test.t1.vec, [1,1,1])->Column#7",
254+
" └─TableFullScan 48.00 mpp[tiflash] table:t1 keep order:false, stats:pseudo"
253255
],
254256
"Warn": null
255257
},
@@ -288,15 +290,13 @@
288290
{
289291
"SQL": "explain format = 'brief' select * from t1 where a=0 order by vec_cosine_distance(vec, '[1,1,1]') limit 1",
290292
"Plan": [
291-
"Projection 1.00 root test.t1.vec, test.t1.a, test.t1.b, test.t1.c, test.t1.d",
292-
"└─TopN 1.00 root Column#8, offset:0, count:1",
293-
" └─Projection 1.00 root test.t1.vec, test.t1.a, test.t1.b, test.t1.c, test.t1.d, vec_cosine_distance(test.t1.vec, [1,1,1])->Column#8",
294-
" └─TableReader 1.00 root MppVersion: 2, data:ExchangeSender",
295-
" └─ExchangeSender 1.00 mpp[tiflash] ExchangeType: PassThrough",
296-
" └─Projection 1.00 mpp[tiflash] test.t1.vec, test.t1.a, test.t1.b, test.t1.c, test.t1.d",
297-
" └─TopN 1.00 mpp[tiflash] Column#7, offset:0, count:1",
298-
" └─Projection 49.15 mpp[tiflash] test.t1.vec, test.t1.a, test.t1.b, test.t1.c, test.t1.d, vec_cosine_distance(test.t1.vec, [1,1,1])->Column#7",
299-
" └─TableFullScan 49.15 mpp[tiflash] table:t1 pushed down filter:eq(test.t1.a, 0), keep order:false, stats:pseudo"
293+
"Projection 0.05 root test.t1.vec, test.t1.a, test.t1.b, test.t1.c, test.t1.d",
294+
"└─TopN 0.05 root Column#7, offset:0, count:1",
295+
" └─Projection 0.05 root test.t1.vec, test.t1.a, test.t1.b, test.t1.c, test.t1.d, vec_cosine_distance(test.t1.vec, [1,1,1])->Column#7",
296+
" └─TableReader 0.05 root MppVersion: 2, data:ExchangeSender",
297+
" └─ExchangeSender 0.05 mpp[tiflash] ExchangeType: PassThrough",
298+
" └─Selection 0.05 mpp[tiflash] eq(test.t1.a, 0)",
299+
" └─TableFullScan 48.00 mpp[tiflash] table:t1 pushed down filter:empty, keep order:false, stats:pseudo"
300300
],
301301
"Warn": null
302302
}

pkg/planner/core/casetest/vectorsearch/vector_index_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ func TestTiFlashANNIndex(t *testing.T) {
8383
('[2,2,2]', 2, 2, '[2,2,2]', '[2,2,2]'),
8484
('[3,3,3]', 3, 3, '[3,3,3]', '[3,3,3]')
8585
`)
86-
for i := 0; i < 14; i++ {
86+
for i := 0; i < 4; i++ {
8787
tk.MustExec("insert into t1(vec, a, b, c, d) select vec, a, b, c, d from t1")
8888
}
8989
dom := domain.GetDomain(tk.Session())

0 commit comments

Comments
 (0)