Skip to content

Commit

Permalink
move test to explaintest
Browse files Browse the repository at this point in the history
  • Loading branch information
time-and-fate committed Mar 22, 2022
1 parent 8b62cc0 commit 7a17b3b
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 11 deletions.
17 changes: 17 additions & 0 deletions cmd/explaintest/r/explain.result
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,20 @@ create view v as select cast(replace(substring_index(substring_index("",',',1),'
desc v;
Field Type Null Key Default Extra
event_id varchar(32) NO NULL
drop table if exists t1, t2;
create table t1 (c_int int, c_decimal decimal(12, 6), primary key (c_int) nonclustered,key((c_int + 1))) ;
create table t2 like t1;
explain format = 'brief' select /*+ agg_to_cop() */ * from t1 where c_decimal in (select c_decimal from t2 where t2.c_int + 1 = 8 + 1);
id estRows task access object operator info
HashJoin 9.99 root inner join, equal:[eq(test.t2.c_decimal, test.t1.c_decimal)]
├─HashAgg(Build) 7.99 root group by:test.t2.c_decimal, funcs:firstrow(test.t2.c_decimal)->test.t2.c_decimal
│ └─IndexLookUp 7.99 root
│ ├─IndexRangeScan(Build) 10.00 cop[tikv] table:t2, index:expression_index(`c_int` + 1) range:[9,9], keep order:false, stats:pseudo
│ └─HashAgg(Probe) 7.99 cop[tikv] group by:test.t2.c_decimal,
│ └─Selection 9.99 cop[tikv] not(isnull(test.t2.c_decimal))
│ └─TableRowIDScan 10.00 cop[tikv] table:t2 keep order:false, stats:pseudo
└─TableReader(Probe) 9990.00 root data:Selection
└─Selection 9990.00 cop[tikv] not(isnull(test.t1.c_decimal))
└─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo
drop table t1;
drop table t2;
8 changes: 8 additions & 0 deletions cmd/explaintest/t/explain.test
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,11 @@ drop table t;
drop view if exists v;
create view v as select cast(replace(substring_index(substring_index("",',',1),':',-1),'"','') as CHAR(32)) as event_id;
desc v;

-- for issue 33237
drop table if exists t1, t2;
create table t1 (c_int int, c_decimal decimal(12, 6), primary key (c_int) nonclustered,key((c_int + 1))) ;
create table t2 like t1;
explain format = 'brief' select /*+ agg_to_cop() */ * from t1 where c_decimal in (select c_decimal from t2 where t2.c_int + 1 = 8 + 1);
drop table t1;
drop table t2;
11 changes: 0 additions & 11 deletions planner/core/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6243,14 +6243,3 @@ func TestTiFlashPartitionTableScan(t *testing.T) {
tk.MustExec("drop table rp_t;")
tk.MustExec("drop table hp_t;")
}

func TestIssue33237(t *testing.T) {
store, clean := testkit.CreateMockStore(t)
defer clean()
tk := testkit.NewTestKit(t, store)
tk.MustExec("use test")
tk.MustExec("drop table if exists t1, t2;")
tk.MustExec("create table t1 (c_int int, c_decimal decimal(12, 6), primary key (c_int) nonclustered,key((c_int + 1))) ;")
tk.MustExec("create table t2 like t1;")
tk.MustExec("select * from t1 where c_decimal in (select c_decimal from t2 where t2.c_int + 1 = 8 + 1);")
}

0 comments on commit 7a17b3b

Please sign in to comment.