Skip to content

Commit 4728a02

Browse files
committed
*
Signed-off-by: Weizhen Wang <[email protected]>
1 parent 0749012 commit 4728a02

File tree

3 files changed

+114
-126
lines changed

3 files changed

+114
-126
lines changed

pkg/planner/core/casetest/enforcempp/enforce_mpp_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,11 +86,11 @@ func TestEnforceMPP(t *testing.T) {
8686
output[i].Plan = testdata.ConvertRowsToStrings(testKit.MustQuery(tt).Rows())
8787
output[i].Warn = testdata.ConvertSQLWarnToStrings(filterWarnings(testKit.Session().GetSessionVars().StmtCtx.GetWarnings()))
8888
})
89-
require.Eventually(t,
89+
require.Eventuallyf(t,
9090
func() bool {
9191
res := testKit.MustQuery(tt)
9292
return res.Equal(testkit.Rows(output[i].Plan...))
93-
}, 1*time.Second, 100*time.Millisecond)
93+
}, 1*time.Second, 100*time.Millisecond, tt)
9494
require.Equal(t, output[i].Warn, testdata.ConvertSQLWarnToStrings(filterWarnings(testKit.Session().GetSessionVars().StmtCtx.GetWarnings())))
9595
}
9696
})

pkg/planner/core/casetest/enforcempp/testdata/enforce_mpp_suite_out.json

Lines changed: 56 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -72,31 +72,31 @@
7272
{
7373
"SQL": "explain format='verbose' select count(*) from t where a=1",
7474
"Plan": [
75-
"StreamAgg_31 1.00 193.81 root funcs:count(Column#7)->Column#4",
76-
"└─IndexReader_32 1.00 143.91 root index:StreamAgg_11",
77-
" └─StreamAgg_11 1.00 2127.00 cop[tikv] funcs:count(1)->Column#7",
78-
" └─IndexRangeScan_30 10.00 1628.00 cop[tikv] table:t, index:idx(a) range:[1,1], keep order:false, stats:pseudo"
75+
"StreamAgg_25 1.00 193.81 root funcs:count(Column#6)->Column#4",
76+
"└─IndexReader_26 1.00 143.91 root index:StreamAgg_10",
77+
" └─StreamAgg_10 1.00 2127.00 cop[tikv] funcs:count(1)->Column#6",
78+
" └─IndexRangeScan_24 10.00 1628.00 cop[tikv] table:t, index:idx(a) range:[1,1], keep order:false, stats:pseudo"
7979
],
8080
"Warn": null
8181
},
8282
{
8383
"SQL": "explain format='verbose' select /*+ read_from_storage(tikv[t]) */ count(*) from t where a=1",
8484
"Plan": [
85-
"StreamAgg_19 1.00 193.81 root funcs:count(Column#6)->Column#4",
86-
"└─IndexReader_20 1.00 143.91 root index:StreamAgg_11",
87-
" └─StreamAgg_11 1.00 2127.00 cop[tikv] funcs:count(1)->Column#6",
88-
" └─IndexRangeScan_18 10.00 1628.00 cop[tikv] table:t, index:idx(a) range:[1,1], keep order:false, stats:pseudo"
85+
"StreamAgg_18 1.00 193.81 root funcs:count(Column#6)->Column#4",
86+
"└─IndexReader_19 1.00 143.91 root index:StreamAgg_10",
87+
" └─StreamAgg_10 1.00 2127.00 cop[tikv] funcs:count(1)->Column#6",
88+
" └─IndexRangeScan_17 10.00 1628.00 cop[tikv] table:t, index:idx(a) range:[1,1], keep order:false, stats:pseudo"
8989
],
9090
"Warn": null
9191
},
9292
{
9393
"SQL": "explain format='verbose' select /*+ read_from_storage(tiflash[t]) */ count(*) from t where a=1",
9494
"Plan": [
95-
"StreamAgg_27 1.00 63520.28 root funcs:count(Column#7)->Column#4",
96-
"└─TableReader_28 1.00 63470.38 root data:StreamAgg_11",
97-
" └─StreamAgg_11 1.00 952024.00 batchCop[tiflash] funcs:count(1)->Column#7",
98-
" └─Selection_26 10.00 952000.00 batchCop[tiflash] eq(test.t.a, 1)",
99-
" └─TableFullScan_25 10000.00 928000.00 batchCop[tiflash] table:t keep order:false, stats:pseudo"
95+
"StreamAgg_21 1.00 63520.28 root funcs:count(Column#6)->Column#4",
96+
"└─TableReader_22 1.00 63470.38 root data:StreamAgg_10",
97+
" └─StreamAgg_10 1.00 952024.00 batchCop[tiflash] funcs:count(1)->Column#6",
98+
" └─Selection_20 10.00 952000.00 batchCop[tiflash] eq(test.t.a, 1)",
99+
" └─TableFullScan_19 10000.00 928000.00 batchCop[tiflash] table:t keep order:false, stats:pseudo"
100100
],
101101
"Warn": null
102102
},
@@ -108,31 +108,31 @@
108108
{
109109
"SQL": "explain format='verbose' select count(*) from t where a=1",
110110
"Plan": [
111-
"StreamAgg_31 1.00 193.81 root funcs:count(Column#7)->Column#4",
112-
"└─IndexReader_32 1.00 143.91 root index:StreamAgg_11",
113-
" └─StreamAgg_11 1.00 2127.00 cop[tikv] funcs:count(1)->Column#7",
114-
" └─IndexRangeScan_30 10.00 1628.00 cop[tikv] table:t, index:idx(a) range:[1,1], keep order:false, stats:pseudo"
111+
"StreamAgg_25 1.00 193.81 root funcs:count(Column#6)->Column#4",
112+
"└─IndexReader_26 1.00 143.91 root index:StreamAgg_10",
113+
" └─StreamAgg_10 1.00 2127.00 cop[tikv] funcs:count(1)->Column#6",
114+
" └─IndexRangeScan_24 10.00 1628.00 cop[tikv] table:t, index:idx(a) range:[1,1], keep order:false, stats:pseudo"
115115
],
116116
"Warn": null
117117
},
118118
{
119119
"SQL": "explain format='verbose' select /*+ read_from_storage(tikv[t]) */ count(*) from t where a=1",
120120
"Plan": [
121-
"StreamAgg_19 1.00 193.81 root funcs:count(Column#6)->Column#4",
122-
"└─IndexReader_20 1.00 143.91 root index:StreamAgg_11",
123-
" └─StreamAgg_11 1.00 2127.00 cop[tikv] funcs:count(1)->Column#6",
124-
" └─IndexRangeScan_18 10.00 1628.00 cop[tikv] table:t, index:idx(a) range:[1,1], keep order:false, stats:pseudo"
121+
"StreamAgg_18 1.00 193.81 root funcs:count(Column#6)->Column#4",
122+
"└─IndexReader_19 1.00 143.91 root index:StreamAgg_10",
123+
" └─StreamAgg_10 1.00 2127.00 cop[tikv] funcs:count(1)->Column#6",
124+
" └─IndexRangeScan_17 10.00 1628.00 cop[tikv] table:t, index:idx(a) range:[1,1], keep order:false, stats:pseudo"
125125
],
126126
"Warn": null
127127
},
128128
{
129129
"SQL": "explain format='verbose' select /*+ read_from_storage(tiflash[t]) */ count(*) from t where a=1",
130130
"Plan": [
131-
"StreamAgg_27 1.00 63520.28 root funcs:count(Column#7)->Column#4",
132-
"└─TableReader_28 1.00 63470.38 root data:StreamAgg_11",
133-
" └─StreamAgg_11 1.00 952024.00 batchCop[tiflash] funcs:count(1)->Column#7",
134-
" └─Selection_26 10.00 952000.00 batchCop[tiflash] eq(test.t.a, 1)",
135-
" └─TableFullScan_25 10000.00 928000.00 batchCop[tiflash] table:t keep order:false, stats:pseudo"
131+
"StreamAgg_21 1.00 63520.28 root funcs:count(Column#6)->Column#4",
132+
"└─TableReader_22 1.00 63470.38 root data:StreamAgg_10",
133+
" └─StreamAgg_10 1.00 952024.00 batchCop[tiflash] funcs:count(1)->Column#6",
134+
" └─Selection_20 10.00 952000.00 batchCop[tiflash] eq(test.t.a, 1)",
135+
" └─TableFullScan_19 10000.00 928000.00 batchCop[tiflash] table:t keep order:false, stats:pseudo"
136136
],
137137
"Warn": null
138138
},
@@ -144,20 +144,20 @@
144144
{
145145
"SQL": "explain format='verbose' select count(*) from t where a=1",
146146
"Plan": [
147-
"StreamAgg_31 1.00 193.81 root funcs:count(Column#7)->Column#4",
148-
"└─IndexReader_32 1.00 143.91 root index:StreamAgg_11",
149-
" └─StreamAgg_11 1.00 2127.00 cop[tikv] funcs:count(1)->Column#7",
150-
" └─IndexRangeScan_30 10.00 1628.00 cop[tikv] table:t, index:idx(a) range:[1,1], keep order:false, stats:pseudo"
147+
"StreamAgg_25 1.00 193.81 root funcs:count(Column#6)->Column#4",
148+
"└─IndexReader_26 1.00 143.91 root index:StreamAgg_10",
149+
" └─StreamAgg_10 1.00 2127.00 cop[tikv] funcs:count(1)->Column#6",
150+
" └─IndexRangeScan_24 10.00 1628.00 cop[tikv] table:t, index:idx(a) range:[1,1], keep order:false, stats:pseudo"
151151
],
152152
"Warn": null
153153
},
154154
{
155155
"SQL": "explain format='verbose' select /*+ read_from_storage(tikv[t]) */ count(*) from t where a=1",
156156
"Plan": [
157-
"StreamAgg_19 1.00 193.81 root funcs:count(Column#6)->Column#4",
158-
"└─IndexReader_20 1.00 143.91 root index:StreamAgg_11",
159-
" └─StreamAgg_11 1.00 2127.00 cop[tikv] funcs:count(1)->Column#6",
160-
" └─IndexRangeScan_18 10.00 1628.00 cop[tikv] table:t, index:idx(a) range:[1,1], keep order:false, stats:pseudo"
157+
"StreamAgg_18 1.00 193.81 root funcs:count(Column#6)->Column#4",
158+
"└─IndexReader_19 1.00 143.91 root index:StreamAgg_10",
159+
" └─StreamAgg_10 1.00 2127.00 cop[tikv] funcs:count(1)->Column#6",
160+
" └─IndexRangeScan_17 10.00 1628.00 cop[tikv] table:t, index:idx(a) range:[1,1], keep order:false, stats:pseudo"
161161
],
162162
"Warn": [
163163
"MPP mode may be blocked because you have set a hint to read table `t` from TiKV."
@@ -166,11 +166,11 @@
166166
{
167167
"SQL": "explain format='verbose' select /*+ read_from_storage(tiflash[t]) */ count(*) from t where a=1",
168168
"Plan": [
169-
"StreamAgg_27 1.00 49.90 root funcs:count(Column#7)->Column#4",
170-
"└─TableReader_28 1.00 0.00 root data:StreamAgg_11",
171-
" └─StreamAgg_11 1.00 952024.00 batchCop[tiflash] funcs:count(1)->Column#7",
172-
" └─Selection_26 10.00 952000.00 batchCop[tiflash] eq(test.t.a, 1)",
173-
" └─TableFullScan_25 10000.00 928000.00 batchCop[tiflash] table:t keep order:false, stats:pseudo"
169+
"StreamAgg_21 1.00 49.90 root funcs:count(Column#6)->Column#4",
170+
"└─TableReader_22 1.00 0.00 root data:StreamAgg_10",
171+
" └─StreamAgg_10 1.00 952024.00 batchCop[tiflash] funcs:count(1)->Column#6",
172+
" └─Selection_20 10.00 952000.00 batchCop[tiflash] eq(test.t.a, 1)",
173+
" └─TableFullScan_19 10000.00 928000.00 batchCop[tiflash] table:t keep order:false, stats:pseudo"
174174
],
175175
"Warn": null
176176
},
@@ -229,10 +229,10 @@
229229
{
230230
"SQL": "explain select count(*) from t where a=1 -- 2. replica not ready",
231231
"Plan": [
232-
"StreamAgg_19 1.00 root funcs:count(Column#8)->Column#6",
233-
"└─IndexReader_20 1.00 root index:StreamAgg_11",
234-
" └─StreamAgg_11 1.00 cop[tikv] funcs:count(1)->Column#8",
235-
" └─IndexRangeScan_18 10.00 cop[tikv] table:t, index:idx(a) range:[1,1], keep order:false, stats:pseudo"
232+
"StreamAgg_18 1.00 root funcs:count(Column#8)->Column#6",
233+
"└─IndexReader_19 1.00 root index:StreamAgg_10",
234+
" └─StreamAgg_10 1.00 cop[tikv] funcs:count(1)->Column#8",
235+
" └─IndexRangeScan_17 10.00 cop[tikv] table:t, index:idx(a) range:[1,1], keep order:false, stats:pseudo"
236236
],
237237
"Warn": [
238238
"MPP mode may be blocked because tiflash replicas of table `t` not ready."
@@ -251,10 +251,10 @@
251251
{
252252
"SQL": "explain select count(*) from t where a=1 -- 3. isolation_engine not match",
253253
"Plan": [
254-
"StreamAgg_19 1.00 root funcs:count(Column#8)->Column#6",
255-
"└─IndexReader_20 1.00 root index:StreamAgg_11",
256-
" └─StreamAgg_11 1.00 cop[tikv] funcs:count(1)->Column#8",
257-
" └─IndexRangeScan_18 10.00 cop[tikv] table:t, index:idx(a) range:[1,1], keep order:false, stats:pseudo"
254+
"StreamAgg_18 1.00 root funcs:count(Column#8)->Column#6",
255+
"└─IndexReader_19 1.00 root index:StreamAgg_10",
256+
" └─StreamAgg_10 1.00 cop[tikv] funcs:count(1)->Column#8",
257+
" └─IndexRangeScan_17 10.00 cop[tikv] table:t, index:idx(a) range:[1,1], keep order:false, stats:pseudo"
258258
],
259259
"Warn": [
260260
"MPP mode may be blocked because 'tidb_isolation_read_engines'(value: 'tikv') not match, need 'tiflash'."
@@ -318,7 +318,6 @@
318318
" └─TableFullScan 10.00 mpp[tiflash] table:t pushed down filter:eq(test.t.a, 1), keep order:false, stats:pseudo"
319319
],
320320
"Warn": [
321-
"Aggregation can not be pushed to tiflash because expressions of AggFunc `count` contain virtual column or correlated column, which is not supported now",
322321
"MPP mode may be blocked because column `test.t.b` is a virtual column which is not supported now.",
323322
"MPP mode may be blocked because column `test.t.b` is a virtual column which is not supported now.",
324323
"MPP mode may be blocked because column `test.t.b` is a virtual column which is not supported now.",
@@ -335,7 +334,6 @@
335334
" └─TableFullScan 10000.00 mpp[tiflash] table:t keep order:false, stats:pseudo"
336335
],
337336
"Warn": [
338-
"Aggregation can not be pushed to tiflash because groupByItems contain virtual columns, which is not supported now",
339337
"Aggregation can not be pushed to tikv because groupByItems contain virtual columns, which is not supported now",
340338
"MPP mode may be blocked because column `test.t.b` is a virtual column which is not supported now.",
341339
"Aggregation can not be pushed to tiflash because groupByItems contain virtual columns, which is not supported now"
@@ -351,8 +349,6 @@
351349
" └─TableFullScan 10000.00 mpp[tiflash] table:t keep order:false, stats:pseudo"
352350
],
353351
"Warn": [
354-
"Scalar function 'md5'(signature: MD5, return type: var_string(32)) is not supported to push down to tiflash now.",
355-
"Aggregation can not be pushed to tiflash because groupByItems contain unsupported exprs",
356352
"Scalar function 'md5'(signature: MD5, return type: var_string(32)) is not supported to push down to tiflash now.",
357353
"Aggregation can not be pushed to tiflash because groupByItems contain unsupported exprs"
358354
]
@@ -407,11 +403,11 @@
407403
{
408404
"SQL": "EXPLAIN SELECT count(*) from t where a=1; -- 1. static partition prune",
409405
"Plan": [
410-
"StreamAgg_14 1.00 root funcs:count(1)->Column#4",
411-
"└─TableReader_43 10.00 root MppVersion: 3, data:ExchangeSender_42",
412-
" └─ExchangeSender_42 10.00 mpp[tiflash] ExchangeType: PassThrough",
413-
" └─Selection_41 10.00 mpp[tiflash] eq(test.t.a, 1)",
414-
" └─TableFullScan_40 10000.00 mpp[tiflash] table:t, partition:p0 keep order:false, stats:pseudo"
406+
"StreamAgg_13 1.00 root funcs:count(1)->Column#4",
407+
"└─TableReader_37 10.00 root MppVersion: 3, data:ExchangeSender_36",
408+
" └─ExchangeSender_36 10.00 mpp[tiflash] ExchangeType: PassThrough",
409+
" └─Selection_35 10.00 mpp[tiflash] eq(test.t.a, 1)",
410+
" └─TableFullScan_34 10000.00 mpp[tiflash] table:t, partition:p0 keep order:false, stats:pseudo"
415411
],
416412
"Warn": null
417413
},
@@ -438,14 +434,12 @@
438434
{
439435
"SQL": "EXPLAIN format='brief' SELECT count(*) from t group by b; -- 1. new collation FIXME",
440436
"Plan": [
441-
"HashAgg 8000.00 root group by:test.t.b, funcs:count(Column#7)->Column#4",
442-
"└─TableReader 8000.00 root MppVersion: 3, data:ExchangeSender",
443-
" └─ExchangeSender 8000.00 mpp[tiflash] ExchangeType: PassThrough",
444-
" └─HashAgg 8000.00 mpp[tiflash] group by:test.t.b, funcs:count(1)->Column#7",
445-
" └─TableFullScan 10000.00 mpp[tiflash] table:t keep order:false, stats:pseudo"
437+
"HashAgg 8000.00 root group by:test.t.b, funcs:count(1)->Column#4",
438+
"└─TableReader 10000.00 root MppVersion: 3, data:ExchangeSender",
439+
" └─ExchangeSender 10000.00 mpp[tiflash] ExchangeType: PassThrough",
440+
" └─TableFullScan 10000.00 mpp[tiflash] table:t keep order:false, stats:pseudo"
446441
],
447442
"Warn": [
448-
"MPP mode may be blocked because when `new_collation_enabled` is true, HashJoin or HashAgg with string key is not supported now.",
449443
"MPP mode may be blocked because when `new_collation_enabled` is true, HashJoin or HashAgg with string key is not supported now.",
450444
"MPP mode may be blocked because when `new_collation_enabled` is true, HashJoin or HashAgg with string key is not supported now."
451445
]

0 commit comments

Comments
 (0)