Skip to content

Commit

Permalink
fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
qw4990 committed Nov 9, 2022
1 parent 73d6cb1 commit b6b8e00
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 22 deletions.
1 change: 1 addition & 0 deletions planner/core/physical_plan_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1613,6 +1613,7 @@ func TestQueryBlockHint(t *testing.T) {

tk := testkit.NewTestKit(t, store)
tk.MustExec("use test")
tk.MustExec("set tidb_cost_model_version=2")

var input []string
var output []struct {
Expand Down
1 change: 1 addition & 0 deletions planner/core/rule_result_reorder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ func TestOrderedResultModeOnOtherOperators(t *testing.T) {

tk := testkit.NewTestKit(t, store)
tk.MustExec("use test")
tk.MustExec("set tidb_cost_model_version=2")
tk.MustExec("set tidb_enable_ordered_result_mode=1")
tk.MustExec("drop table if exists t1")
tk.MustExec("drop table if exists t2")
Expand Down
1 change: 1 addition & 0 deletions planner/core/stats_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ func TestNDVGroupCols(t *testing.T) {
store := testkit.CreateMockStore(t)
tk := testkit.NewTestKit(t, store)
tk.MustExec("use test")
tk.MustExec("set tidb_cost_model_version=2")
tk.MustExec("drop table if exists t1, t2")
tk.MustExec("create table t1(a int not null, b int not null, key(a,b))")
tk.MustExec("insert into t1 values(1,1),(1,2),(2,1),(2,2)")
Expand Down
44 changes: 22 additions & 22 deletions planner/core/testdata/stats_suite_out.json
Original file line number Diff line number Diff line change
Expand Up @@ -218,45 +218,45 @@
{
"SQL": "select count(1) from t1 left join t2 on t1.a = t2.a group by t1.a, t1.b",
"Plan": [
"HashAgg 4.00 root group by:test.t1.a, test.t1.b, funcs:count(1)->Column#7",
"└─HashJoin 12.00 root left outer join, equal:[eq(test.t1.a, test.t2.a)]",
" ├─TableReader(Build) 4.00 root data:TableFullScan",
" │ └─TableFullScan 4.00 cop[tikv] table:t1 keep order:false",
" └─TableReader(Probe) 9.00 root data:TableFullScan",
" └─TableFullScan 9.00 cop[tikv] table:t2 keep order:false"
"StreamAgg 4.00 root group by:test.t1.a, test.t1.b, funcs:count(1)->Column#7",
"└─IndexJoin 12.00 root left outer join, inner:IndexReader, outer key:test.t1.a, inner key:test.t2.a, equal cond:eq(test.t1.a, test.t2.a)",
" ├─IndexReader(Build) 4.00 root index:IndexFullScan",
" │ └─IndexFullScan 4.00 cop[tikv] table:t1, index:a(a, b) keep order:true",
" └─IndexReader(Probe) 12.00 root index:IndexRangeScan",
" └─IndexRangeScan 12.00 cop[tikv] table:t2, index:a(a, b) range: decided by [eq(test.t2.a, test.t1.a)], keep order:false"
]
},
{
"SQL": "select count(1) from t1 right join t2 on t1.a = t2.a group by t2.a, t2.b",
"Plan": [
"HashAgg 9.00 root group by:test.t2.a, test.t2.b, funcs:count(1)->Column#7",
"└─HashJoin 12.00 root right outer join, equal:[eq(test.t1.a, test.t2.a)]",
" ├─TableReader(Build) 4.00 root data:TableFullScan",
" │ └─TableFullScan 4.00 cop[tikv] table:t1 keep order:false",
" └─TableReader(Probe) 9.00 root data:TableFullScan",
" └─TableFullScan 9.00 cop[tikv] table:t2 keep order:false"
"StreamAgg 9.00 root group by:test.t2.a, test.t2.b, funcs:count(1)->Column#7",
"└─IndexJoin 12.00 root right outer join, inner:IndexReader, outer key:test.t2.a, inner key:test.t1.a, equal cond:eq(test.t2.a, test.t1.a)",
" ├─IndexReader(Build) 9.00 root index:IndexFullScan",
" │ └─IndexFullScan 9.00 cop[tikv] table:t2, index:a(a, b) keep order:true",
" └─IndexReader(Probe) 12.00 root index:IndexRangeScan",
" └─IndexRangeScan 12.00 cop[tikv] table:t1, index:a(a, b) range: decided by [eq(test.t1.a, test.t2.a)], keep order:false"
]
},
{
"SQL": "select count(tmp.cmp) from (select t1.a as a, t1.b as b, (t1.b in (select t2.b from t2 where t2.a > t1.a)) as cmp from t1) tmp group by tmp.a, tmp.b",
"Plan": [
"HashAgg 4.00 root group by:test.t1.a, test.t1.b, funcs:count(Column#10)->Column#11",
"└─HashJoin 4.00 root left outer semi join, equal:[eq(test.t1.b, test.t2.b)], other cond:gt(test.t2.a, test.t1.a)",
" ├─TableReader(Build) 9.00 root data:TableFullScan",
" │ └─TableFullScan 9.00 cop[tikv] table:t2 keep order:false",
" └─TableReader(Probe) 4.00 root data:TableFullScan",
" └─TableFullScan 4.00 cop[tikv] table:t1 keep order:false"
" ├─IndexReader(Build) 9.00 root index:IndexFullScan",
" │ └─IndexFullScan 9.00 cop[tikv] table:t2, index:a(a, b) keep order:false",
" └─IndexReader(Probe) 4.00 root index:IndexFullScan",
" └─IndexFullScan 4.00 cop[tikv] table:t1, index:a(a, b) keep order:false"
]
},
{
"SQL": "select count(tmp.cmp) from (select t1.a as a, t1.b as b, (t1.b not in (select t2.b from t2 where t2.a > t1.a)) as cmp from t1) tmp group by tmp.a, tmp.b",
"Plan": [
"HashAgg 4.00 root group by:test.t1.a, test.t1.b, funcs:count(Column#10)->Column#11",
"└─HashJoin 4.00 root anti left outer semi join, equal:[eq(test.t1.b, test.t2.b)], other cond:gt(test.t2.a, test.t1.a)",
" ├─TableReader(Build) 9.00 root data:TableFullScan",
" │ └─TableFullScan 9.00 cop[tikv] table:t2 keep order:false",
" └─TableReader(Probe) 4.00 root data:TableFullScan",
" └─TableFullScan 4.00 cop[tikv] table:t1 keep order:false"
" ├─IndexReader(Build) 9.00 root index:IndexFullScan",
" │ └─IndexFullScan 9.00 cop[tikv] table:t2, index:a(a, b) keep order:false",
" └─IndexReader(Probe) 4.00 root index:IndexFullScan",
" └─IndexFullScan 4.00 cop[tikv] table:t1, index:a(a, b) keep order:false"
]
},
{
Expand All @@ -276,8 +276,8 @@
"Plan": [
"HashAgg 4.00 root group by:test.t1.a, test.t1.b, funcs:count(Column#5)->Column#6",
"└─Window 4.00 root sum(cast(test.t1.a, decimal(10,0) BINARY))->Column#5 over()",
" └─TableReader 4.00 root data:TableFullScan",
" └─TableFullScan 4.00 cop[tikv] table:t1 keep order:false"
" └─IndexReader 4.00 root index:IndexFullScan",
" └─IndexFullScan 4.00 cop[tikv] table:t1, index:a(a, b) keep order:false"
]
}
]
Expand Down

0 comments on commit b6b8e00

Please sign in to comment.