Skip to content

Commit 9b4552a

Browse files
committed
*
Signed-off-by: Weizhen Wang <[email protected]>
1 parent 86b2245 commit 9b4552a

36 files changed

+443
-440
lines changed

pkg/executor/prepared_test.go

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -802,7 +802,8 @@ func TestIssue29101(t *testing.T) {
802802
` ├─Point_Get_27(Build) 1.00 root table:customer, index:PRIMARY(c_w_id, c_d_id, c_id) `,
803803
` └─TableReader_30(Probe) 0.00 root data:Selection_29`,
804804
` └─Selection_29 0.00 cop[tikv] eq(test.warehouse.w_id, 936)`,
805-
` └─TableRangeScan_28 1.00 cop[tikv] table:warehouse range: decided by [test.customer.c_w_id], keep order:false, stats:pseudo`))
805+
` └─TableRangeScan_28 1.00 cop[tikv] table:warehouse range: decided by [test.customer.c_w_id], keep order:false, stats:pseudo`,
806+
))
806807
tk.MustQuery(`execute s1 using @a,@b,@c`).Check(testkit.Rows())
807808
tk.MustQuery(`select @@last_plan_from_cache`).Check(testkit.Rows("1")) // can use the plan-cache
808809

@@ -825,15 +826,15 @@ func TestIssue29101(t *testing.T) {
825826
ps = []*sessmgr.ProcessInfo{tkProcess}
826827
tk.Session().SetSessionManager(&testkit.MockSessionManager{PS: ps})
827828
tk.MustQuery(fmt.Sprintf("explain for connection %d", tkProcess.ID)).Check(testkit.Rows( // can use index-join
828-
`StreamAgg_14 1.00 root funcs:count(distinct test.stock.s_i_id)->Column#11`,
829-
`└─IndexJoin_43 1.25 root inner join, inner:IndexLookUp_36, outer key:test.order_line.ol_i_id, inner key:test.stock.s_i_id, equal cond:eq(test.order_line.ol_i_id, test.stock.s_i_id)`,
830-
` ├─IndexLookUp_32(Build) 1.25 root `,
831-
` │ ├─IndexRangeScan_30(Build) 1.25 cop[tikv] table:order_line, index:PRIMARY(ol_w_id, ol_d_id, ol_o_id, ol_number) range:[391 1 3038,391 1 3058), keep order:false, stats:pseudo`,
832-
` │ └─TableRowIDScan_31(Probe) 1.25 cop[tikv] table:order_line keep order:false, stats:pseudo`,
833-
` └─IndexLookUp_36(Probe) 1.25 root `,
834-
` ├─IndexRangeScan_33(Build) 1.25 cop[tikv] table:stock, index:PRIMARY(s_w_id, s_i_id) range: decided by [eq(test.stock.s_i_id, test.order_line.ol_i_id) eq(test.stock.s_w_id, 391)], keep order:false, stats:pseudo`,
835-
` └─Selection_35(Probe) 1.25 cop[tikv] lt(test.stock.s_quantity, 18)`,
836-
` └─TableRowIDScan_34 1.25 cop[tikv] table:stock keep order:false, stats:pseudo`))
829+
`StreamAgg_13 1.00 root funcs:count(distinct test.stock.s_i_id)->Column#11`,
830+
`└─IndexJoin_42 1.25 root inner join, inner:IndexLookUp_35, outer key:test.order_line.ol_i_id, inner key:test.stock.s_i_id, equal cond:eq(test.order_line.ol_i_id, test.stock.s_i_id)`,
831+
` ├─IndexLookUp_31(Build) 1.25 root `,
832+
` │ ├─IndexRangeScan_29(Build) 1.25 cop[tikv] table:order_line, index:PRIMARY(ol_w_id, ol_d_id, ol_o_id, ol_number) range:[391 1 3038,391 1 3058), keep order:false, stats:pseudo`,
833+
` │ └─TableRowIDScan_30(Probe) 1.25 cop[tikv] table:order_line keep order:false, stats:pseudo`,
834+
` └─IndexLookUp_35(Probe) 1.25 root `,
835+
` ├─IndexRangeScan_32(Build) 1.25 cop[tikv] table:stock, index:PRIMARY(s_w_id, s_i_id) range: decided by [eq(test.stock.s_i_id, test.order_line.ol_i_id) eq(test.stock.s_w_id, 391)], keep order:false, stats:pseudo`,
836+
` └─Selection_34(Probe) 1.25 cop[tikv] lt(test.stock.s_quantity, 18)`,
837+
` └─TableRowIDScan_33 1.25 cop[tikv] table:stock keep order:false, stats:pseudo`))
837838
tk.MustExec(`execute s1 using @a,@b,@c,@c,@a,@d`)
838839
tk.MustQuery(`select @@last_plan_from_cache`).Check(testkit.Rows("1")) // can use the plan-cache
839840
}

pkg/executor/select.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -969,6 +969,7 @@ func ResetContextOfStmt(ctx sessionctx.Context, s ast.StmtNode) (err error) {
969969
} else {
970970
clear(sc.TblInfo2UnionScan)
971971
}
972+
sc.HasTiflash = false
972973
sc.IsStaleness = false
973974
sc.IsSyncStatsFailed = false
974975
sc.IsExplainAnalyzeDML = false

pkg/executor/testdata/prepare_suite_out.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1246,10 +1246,10 @@
12461246
],
12471247
"Plan": [
12481248
"Projection_4 8000.00 root test.t.b, Column#5",
1249-
"└─HashAgg_13 8000.00 root group by:test.t.b, funcs:sum(Column#6)->Column#5, funcs:firstrow(test.t.b)->test.t.b",
1250-
" └─TableReader_14 8000.00 root data:HashAgg_6",
1249+
"└─HashAgg_10 8000.00 root group by:test.t.b, funcs:sum(Column#6)->Column#5, funcs:firstrow(test.t.b)->test.t.b",
1250+
" └─TableReader_11 8000.00 root data:HashAgg_6",
12511251
" └─HashAgg_6 8000.00 cop[tikv] group by:test.t.b, funcs:sum(plus(test.t.c, 1))->Column#6",
1252-
" └─TableFullScan_12 10000.00 cop[tikv] table:t keep order:false, stats:pseudo"
1252+
" └─TableFullScan_9 10000.00 cop[tikv] table:t keep order:false, stats:pseudo"
12531253
],
12541254
"FromCache": "0"
12551255
},
@@ -1264,10 +1264,10 @@
12641264
],
12651265
"Plan": [
12661266
"Projection_4 8000.00 root test.t.b, Column#5",
1267-
"└─HashAgg_13 8000.00 root group by:test.t.b, funcs:sum(Column#6)->Column#5, funcs:firstrow(test.t.b)->test.t.b",
1268-
" └─TableReader_14 8000.00 root data:HashAgg_6",
1267+
"└─HashAgg_10 8000.00 root group by:test.t.b, funcs:sum(Column#6)->Column#5, funcs:firstrow(test.t.b)->test.t.b",
1268+
" └─TableReader_11 8000.00 root data:HashAgg_6",
12691269
" └─HashAgg_6 8000.00 cop[tikv] group by:test.t.b, funcs:sum(plus(test.t.c, 5))->Column#6",
1270-
" └─TableFullScan_12 10000.00 cop[tikv] table:t keep order:false, stats:pseudo"
1270+
" └─TableFullScan_9 10000.00 cop[tikv] table:t keep order:false, stats:pseudo"
12711271
],
12721272
"FromCache": "1"
12731273
}

pkg/planner/core/casetest/binaryplan/testdata/binary_plan_suite_out.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -71,16 +71,16 @@
7171
"name": "HashAgg_11",
7272
"children": [
7373
{
74-
"name": "Projection_53",
74+
"name": "Projection_50",
7575
"children": [
7676
{
77-
"name": "HashJoin_28",
77+
"name": "HashJoin_27",
7878
"children": [
7979
{
80-
"name": "IndexReader_33",
80+
"name": "IndexReader_32",
8181
"children": [
8282
{
83-
"name": "IndexFullScan_32",
83+
"name": "IndexFullScan_31",
8484
"cost": 1628000.000001,
8585
"est_rows": 10000,
8686
"act_rows": 2,
@@ -97,13 +97,13 @@
9797
"act_rows": 2,
9898
"task_type": 1,
9999
"store_type": 1,
100-
"operator_info": "index:IndexFullScan_32"
100+
"operator_info": "index:IndexFullScan_31"
101101
},
102102
{
103-
"name": "TableReader_35",
103+
"name": "TableReader_34",
104104
"children": [
105105
{
106-
"name": "TableFullScan_34",
106+
"name": "TableFullScan_33",
107107
"cost": 4546159.475587022,
108108
"est_rows": 10000,
109109
"act_rows": 4,
@@ -120,7 +120,7 @@
120120
"act_rows": 4,
121121
"task_type": 1,
122122
"store_type": 1,
123-
"operator_info": "data:TableFullScan_34"
123+
"operator_info": "data:TableFullScan_33"
124124
}
125125
],
126126
"cost": 1128387.631705868,

pkg/planner/core/casetest/binaryplan/testdata/binary_plan_suite_xut.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -71,16 +71,16 @@
7171
"name": "HashAgg_11",
7272
"children": [
7373
{
74-
"name": "Projection_53",
74+
"name": "Projection_50",
7575
"children": [
7676
{
77-
"name": "HashJoin_28",
77+
"name": "HashJoin_27",
7878
"children": [
7979
{
80-
"name": "IndexReader_33",
80+
"name": "IndexReader_32",
8181
"children": [
8282
{
83-
"name": "IndexFullScan_32",
83+
"name": "IndexFullScan_31",
8484
"cost": 1628000.000001,
8585
"est_rows": 10000,
8686
"act_rows": 2,
@@ -97,13 +97,13 @@
9797
"act_rows": 2,
9898
"task_type": 1,
9999
"store_type": 1,
100-
"operator_info": "index:IndexFullScan_32"
100+
"operator_info": "index:IndexFullScan_31"
101101
},
102102
{
103-
"name": "TableReader_35",
103+
"name": "TableReader_34",
104104
"children": [
105105
{
106-
"name": "TableFullScan_34",
106+
"name": "TableFullScan_33",
107107
"cost": 4546159.475587022,
108108
"est_rows": 10000,
109109
"act_rows": 4,
@@ -120,7 +120,7 @@
120120
"act_rows": 4,
121121
"task_type": 1,
122122
"store_type": 1,
123-
"operator_info": "data:TableFullScan_34"
123+
"operator_info": "data:TableFullScan_33"
124124
}
125125
],
126126
"cost": 1128387.631705868,

pkg/planner/core/casetest/cbotest/testdata/analyze_suite_out.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -559,8 +559,6 @@
559559
"Warn": [
560560
"Warning 1105 Expression about 'test.t19f3e4f1.colc864' can not be pushed to TiFlash because it contains unsupported calculation of type 'enum'.",
561561
"Warning 1105 Expression about 'test.t19f3e4f1.colc864' can not be pushed to TiFlash because it contains unsupported calculation of type 'enum'.",
562-
"Warning 1105 Expression about 'test.t19f3e4f1.colc864' can not be pushed to TiFlash because it contains unsupported calculation of type 'enum'.",
563-
"Warning 1105 Aggregation can not be pushed to tiflash because arguments of AggFunc `firstrow` contains unsupported exprs",
564562
"Warning 1105 Expression about 'test.t19f3e4f1.colc864' can not be pushed to TiFlash because it contains unsupported calculation of type 'enum'."
565563
]
566564
},

pkg/planner/core/casetest/cbotest/testdata/analyze_suite_xut.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -559,8 +559,6 @@
559559
"Warn": [
560560
"Warning 1105 Expression about 'test.t19f3e4f1.colc864' can not be pushed to TiFlash because it contains unsupported calculation of type 'enum'.",
561561
"Warning 1105 Expression about 'test.t19f3e4f1.colc864' can not be pushed to TiFlash because it contains unsupported calculation of type 'enum'.",
562-
"Warning 1105 Expression about 'test.t19f3e4f1.colc864' can not be pushed to TiFlash because it contains unsupported calculation of type 'enum'.",
563-
"Warning 1105 Aggregation can not be pushed to tiflash because arguments of AggFunc `firstrow` contains unsupported exprs",
564562
"Warning 1105 Expression about 'test.t19f3e4f1.colc864' can not be pushed to TiFlash because it contains unsupported calculation of type 'enum'."
565563
]
566564
},

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+
}, 5*time.Second, 100*time.Millisecond, tt, output[i].Plan)
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: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -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."

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -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."

0 commit comments

Comments
 (0)