Skip to content

Commit

Permalink
tests: bump mysql-tester version and update result (#47358)
Browse files Browse the repository at this point in the history
ref #45961
  • Loading branch information
tiancaiamao authored Oct 8, 2023
1 parent 5a3eb04 commit 2d1d3fd
Show file tree
Hide file tree
Showing 27 changed files with 403 additions and 327 deletions.
40 changes: 40 additions & 0 deletions planner/core/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2556,3 +2556,43 @@ func TestIssue46298(t *testing.T) {
tk.MustExec(`set @@tidb_enable_pipelined_window_function=0`)
tk.MustQuery("select *, first_value(v) over (partition by p order by o range between 3.1 preceding and 2.9 following) as a from test.first_range;")
}

// https://github.com/pingcap/tidb/issues/41458
func TestIssue41458(t *testing.T) {
store := testkit.CreateMockStore(t)
tk := testkit.NewTestKit(t, store)
require.NoError(t, tk.Session().Auth(&auth.UserIdentity{Username: "root", Hostname: "%"}, nil, nil, nil))
tk.MustExec("use test")
tk.MustExec(`create table t (a int, b int, c int, index ia(a));`)
tk.MustExec("select * from t t1 join t t2 on t1.b = t2.b join t t3 on t2.b=t3.b join t t4 on t3.b=t4.b where t3.a=1 and t2.a=2;")
rawRows := tk.MustQuery("select plan from information_schema.statements_summary where SCHEMA_NAME = 'test' and STMT_TYPE = 'Select';").Sort().Rows()
plan := rawRows[0][0].(string)
rows := strings.Split(plan, "\n")
rows = rows[1:]
expectedRes := []string{
"Projection",
"└─HashJoin",
" ├─HashJoin",
" │ ├─HashJoin",
" │ │ ├─IndexLookUp",
" │ │ │ ├─IndexRangeScan",
" │ │ │ └─Selection",
" │ │ │ └─TableRowIDScan",
" │ │ └─IndexLookUp",
" │ │ ├─IndexRangeScan",
" │ │ └─Selection",
" │ │ └─TableRowIDScan",
" │ └─TableReader",
" │ └─Selection",
" │ └─TableFullScan",
" └─TableReader",
" └─Selection",
" └─TableFullScan",
}
for i, row := range rows {
fields := strings.Split(row, "\t")
fields = strings.Split(fields[1], "_")
op := fields[0]
require.Equalf(t, expectedRes[i], op, fmt.Sprintf("Mismatch at index %d.", i))
}
}
2 changes: 1 addition & 1 deletion tests/integrationtest/r/executor/write.result
Original file line number Diff line number Diff line change
Expand Up @@ -918,7 +918,7 @@ id name
10 a
20 a
update t set id=id+17 where id in (3,10);
Error 1526 (HY000): Table has no partition for value 27
Error 1062 (23000): Duplicate entry '20' for key 't.idx'
select * from t order by id;
id name
3 a
Expand Down
14 changes: 6 additions & 8 deletions tests/integrationtest/r/explain-non-select-stmt.result
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,15 @@ Insert N/A root N/A
explain format = 'brief' delete from t where a > 100;
id estRows task access object operator info
Delete N/A root N/A
└─SelectLock 3333.33 root for update 0
└─TableReader 3333.33 root data:Selection
└─Selection 3333.33 cop[tikv] gt(explain-non-select-stmt.t.a, 100)
└─TableFullScan 10000.00 cop[tikv] table:t keep order:false, stats:pseudo
└─TableReader 3333.33 root data:Selection
└─Selection 3333.33 cop[tikv] gt(explain-non-select-stmt.t.a, 100)
└─TableFullScan 10000.00 cop[tikv] table:t keep order:false, stats:pseudo
explain format = 'brief' update t set b = 100 where a = 200;
id estRows task access object operator info
Update N/A root N/A
└─SelectLock 10.00 root for update 0
└─TableReader 10.00 root data:Selection
└─Selection 10.00 cop[tikv] eq(explain-non-select-stmt.t.a, 200)
└─TableFullScan 10000.00 cop[tikv] table:t keep order:false, stats:pseudo
└─TableReader 10.00 root data:Selection
└─Selection 10.00 cop[tikv] eq(explain-non-select-stmt.t.a, 200)
└─TableFullScan 10000.00 cop[tikv] table:t keep order:false, stats:pseudo
explain format = 'brief' replace into t select a, 100 from t;
id estRows task access object operator info
Insert N/A root N/A
Expand Down
18 changes: 8 additions & 10 deletions tests/integrationtest/r/explain_easy.result
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,13 @@ HashJoin 4166.67 root left outer join, equal:[eq(explain_easy.t1.c2, explain_ea
explain format = 'brief' update t1 set t1.c2 = 2 where t1.c1 = 1;
id estRows task access object operator info
Update N/A root N/A
└─Point_Get 1.00 root table:t1 handle:1, lock
└─Point_Get 1.00 root table:t1 handle:1
explain format = 'brief' delete from t1 where t1.c2 = 1;
id estRows task access object operator info
Delete N/A root N/A
└─SelectLock 10.00 root for update 0
└─IndexLookUp 10.00 root
├─IndexRangeScan(Build) 10.00 cop[tikv] table:t1, index:c2(c2) range:[1,1], keep order:false, stats:pseudo
└─TableRowIDScan(Probe) 10.00 cop[tikv] table:t1 keep order:false, stats:pseudo
└─IndexLookUp 10.00 root
├─IndexRangeScan(Build) 10.00 cop[tikv] table:t1, index:c2(c2) range:[1,1], keep order:false, stats:pseudo
└─TableRowIDScan(Probe) 10.00 cop[tikv] table:t1 keep order:false, stats:pseudo
explain format = 'brief' select count(b.c2) from t1 a, t2 b where a.c1 = b.c2 group by a.c1;
id estRows task access object operator info
Projection 9990.00 root Column#7
Expand Down Expand Up @@ -466,7 +465,7 @@ Projection 10000.00 root or(<nil>, gt(explain_easy.t.a, 1))->Column#2
└─TableFullScan 10000.00 cop[tikv] table:t keep order:false, stats:pseudo
explain format = 'brief' select * from t where a = 1 for update;
id estRows task access object operator info
Point_Get 1.00 root table:t handle:1, lock
Point_Get 1.00 root table:t handle:1
drop table if exists ta, tb;
create table ta (a varchar(20));
create table tb (a varchar(20));
Expand Down Expand Up @@ -795,10 +794,9 @@ IndexLookUp 0.10 root
explain format = 'brief' update t set c = 'ssss' where a=x'FA34E1093CB428485734E3917F000000' and b='xb';
id estRows task access object operator info
Update N/A root N/A
└─SelectLock 0.10 root for update 0
└─IndexLookUp 0.10 root
├─IndexRangeScan(Build) 0.10 cop[tikv] table:t, index:a(a, b) range:[0xFA34E1093CB428485734E3917F000000 "xb",0xFA34E1093CB428485734E3917F000000 "xb"], keep order:false, stats:pseudo
└─TableRowIDScan(Probe) 0.10 cop[tikv] table:t keep order:false, stats:pseudo
└─IndexLookUp 0.10 root
├─IndexRangeScan(Build) 0.10 cop[tikv] table:t, index:a(a, b) range:[0xFA34E1093CB428485734E3917F000000 "xb",0xFA34E1093CB428485734E3917F000000 "xb"], keep order:false, stats:pseudo
└─TableRowIDScan(Probe) 0.10 cop[tikv] table:t keep order:false, stats:pseudo
drop table if exists t;
create table t(a int, b int);
explain format = 'brief' select (select count(n.a) from t) from t n;
Expand Down
9 changes: 4 additions & 5 deletions tests/integrationtest/r/explain_easy_stats.result
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,13 @@ HashJoin 2481.25 root left outer join, equal:[eq(explain_easy_stats.t1.c2, expl
explain format = 'brief' update t1 set t1.c2 = 2 where t1.c1 = 1;
id estRows task access object operator info
Update N/A root N/A
└─Point_Get 1.00 root table:t1 handle:1, lock
└─Point_Get 1.00 root table:t1 handle:1
explain format = 'brief' delete from t1 where t1.c2 = 1;
id estRows task access object operator info
Delete N/A root N/A
└─SelectLock 0.00 root for update 0
└─IndexLookUp 0.00 root
├─IndexRangeScan(Build) 0.00 cop[tikv] table:t1, index:c2(c2) range:[1,1], keep order:false
└─TableRowIDScan(Probe) 0.00 cop[tikv] table:t1 keep order:false
└─IndexLookUp 0.00 root
├─IndexRangeScan(Build) 0.00 cop[tikv] table:t1, index:c2(c2) range:[1,1], keep order:false
└─TableRowIDScan(Probe) 0.00 cop[tikv] table:t1 keep order:false
explain format = 'brief' select count(b.c2) from t1 a, t2 b where a.c1 = b.c2 group by a.c1;
id estRows task access object operator info
Projection 1985.00 root Column#7
Expand Down
37 changes: 16 additions & 21 deletions tests/integrationtest/r/explain_foreign_key.result
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,18 @@ Insert N/A root N/A
explain format = 'brief' update t2 set id=id+1 where id = 1;
id estRows task access object operator info
Update N/A root N/A
├─Point_Get 1.00 root table:t2 handle:1, lock
├─Point_Get 1.00 root table:t2 handle:1
└─Foreign_Key_Check 0.00 root table:t1 foreign_key:fk, check_exist
explain format = 'brief' delete from t1 where id > 1;
id estRows task access object operator info
Delete N/A root N/A
├─SelectLock 3333.33 root for update 0
│ └─TableReader 3333.33 root data:TableRangeScan
│ └─TableRangeScan 3333.33 cop[tikv] table:t1 range:(1,+inf], keep order:false, stats:pseudo
├─TableReader 3333.33 root data:TableRangeScan
│ └─TableRangeScan 3333.33 cop[tikv] table:t1 range:(1,+inf], keep order:false, stats:pseudo
└─Foreign_Key_Cascade 0.00 root table:t2 foreign_key:fk, on_delete:CASCADE
explain format = 'brief' update t1 set id=id+1 where id = 1;
id estRows task access object operator info
Update N/A root N/A
├─Point_Get 1.00 root table:t1 handle:1, lock
├─Point_Get 1.00 root table:t1 handle:1
└─Foreign_Key_Cascade 0.00 root table:t2 foreign_key:fk, on_update:CASCADE
explain format = 'brief' insert into t1 values (1);
id estRows task access object operator info
Expand All @@ -41,21 +40,19 @@ Insert N/A root N/A
explain format = 'brief' update t4 set id=id+1 where id = 1;
id estRows task access object operator info
Update N/A root N/A
├─SelectLock 10.00 root for update 0
│ └─IndexReader 10.00 root index:IndexRangeScan
│ └─IndexRangeScan 10.00 cop[tikv] table:t4, index:idx_id(id) range:[1,1], keep order:false, stats:pseudo
├─IndexReader 10.00 root index:IndexRangeScan
│ └─IndexRangeScan 10.00 cop[tikv] table:t4, index:idx_id(id) range:[1,1], keep order:false, stats:pseudo
└─Foreign_Key_Check 0.00 root table:t3, index:idx foreign_key:fk, check_exist
explain format = 'brief' delete from t3 where id > 1;
id estRows task access object operator info
Delete N/A root N/A
├─SelectLock 3333.33 root for update 0
│ └─IndexReader 3333.33 root index:IndexRangeScan
│ └─IndexRangeScan 3333.33 cop[tikv] table:t3, index:idx(id) range:(1,+inf], keep order:false, stats:pseudo
├─IndexReader 3333.33 root index:IndexRangeScan
│ └─IndexRangeScan 3333.33 cop[tikv] table:t3, index:idx(id) range:(1,+inf], keep order:false, stats:pseudo
└─Foreign_Key_Check 0.00 root table:t4, index:idx_id foreign_key:fk, check_not_exist
explain format = 'brief' update t3 set id=id+1 where id = 1;
id estRows task access object operator info
Update N/A root N/A
├─Point_Get 1.00 root table:t3, index:idx(id) lock
├─Point_Get 1.00 root table:t3, index:idx(id)
└─Foreign_Key_Check 0.00 root table:t4, index:idx_id foreign_key:fk, check_not_exist
explain format = 'brief' insert into t3 values (1);
id estRows task access object operator info
Expand All @@ -73,31 +70,29 @@ Insert N/A root N/A
explain format = 'brief' update t6 set id=id+1, id3=id2+1 where id = 1;
id estRows task access object operator info
Update N/A root N/A
├─SelectLock 10.00 root for update 0
│ └─IndexLookUp 10.00 root
│ ├─IndexRangeScan(Build) 10.00 cop[tikv] table:t6, index:idx_id(id) range:[1,1], keep order:false, stats:pseudo
│ └─TableRowIDScan(Probe) 10.00 cop[tikv] table:t6 keep order:false, stats:pseudo
├─IndexLookUp 10.00 root
│ ├─IndexRangeScan(Build) 10.00 cop[tikv] table:t6, index:idx_id(id) range:[1,1], keep order:false, stats:pseudo
│ └─TableRowIDScan(Probe) 10.00 cop[tikv] table:t6 keep order:false, stats:pseudo
├─Foreign_Key_Check 0.00 root table:t5 foreign_key:fk_1, check_exist
└─Foreign_Key_Check 0.00 root table:t5, index:idx3 foreign_key:fk_3, check_exist
explain format = 'brief' delete from t5 where id > 1;
id estRows task access object operator info
Delete N/A root N/A
├─SelectLock 3333.33 root for update 0
│ └─TableReader 3333.33 root data:TableRangeScan
│ └─TableRangeScan 3333.33 cop[tikv] table:t5 range:(1,+inf], keep order:false, stats:pseudo
├─TableReader 3333.33 root data:TableRangeScan
│ └─TableRangeScan 3333.33 cop[tikv] table:t5 range:(1,+inf], keep order:false, stats:pseudo
├─Foreign_Key_Check 0.00 root table:t6, index:idx_id2 foreign_key:fk_2, check_not_exist
├─Foreign_Key_Cascade 0.00 root table:t6, index:idx_id foreign_key:fk_1, on_delete:CASCADE
└─Foreign_Key_Cascade 0.00 root table:t6, index:fk_3 foreign_key:fk_3, on_delete:CASCADE
explain format = 'brief' update t5 set id=id+1, id2=id2+1 where id = 1;
id estRows task access object operator info
Update N/A root N/A
├─Point_Get 1.00 root table:t5 handle:1, lock
├─Point_Get 1.00 root table:t5 handle:1
├─Foreign_Key_Cascade 0.00 root table:t6, index:idx_id foreign_key:fk_1, on_update:CASCADE
└─Foreign_Key_Cascade 0.00 root table:t6, index:idx_id2 foreign_key:fk_2, on_update:CASCADE
explain format = 'brief' update t5 set id=id+1, id2=id2+1, id3=id3+1 where id = 1;
id estRows task access object operator info
Update N/A root N/A
├─Point_Get 1.00 root table:t5 handle:1, lock
├─Point_Get 1.00 root table:t5 handle:1
├─Foreign_Key_Check 0.00 root table:t6, index:fk_3 foreign_key:fk_3, check_not_exist
├─Foreign_Key_Cascade 0.00 root table:t6, index:idx_id foreign_key:fk_1, on_update:CASCADE
└─Foreign_Key_Cascade 0.00 root table:t6, index:idx_id2 foreign_key:fk_2, on_update:CASCADE
Expand Down
72 changes: 32 additions & 40 deletions tests/integrationtest/r/explain_generate_column_substitute.result
Original file line number Diff line number Diff line change
Expand Up @@ -136,32 +136,28 @@ b+a
8
desc update t set a=1 where a+1 = 3;
id estRows task access object operator info
Update_5 N/A root N/A
└─SelectLock_7 10.00 root for update 0
└─IndexLookUp_13 10.00 root
├─IndexRangeScan_11(Build) 10.00 cop[tikv] table:t, index:idx_c(c) range:[3,3], keep order:false, stats:pseudo
└─TableRowIDScan_12(Probe) 10.00 cop[tikv] table:t keep order:false, stats:pseudo
Update_4 N/A root N/A
└─IndexLookUp_11 10.00 root
├─IndexRangeScan_9(Build) 10.00 cop[tikv] table:t, index:idx_c(c) range:[3,3], keep order:false, stats:pseudo
└─TableRowIDScan_10(Probe) 10.00 cop[tikv] table:t keep order:false, stats:pseudo
desc update t set a=2, b = 3 where b+a = 3;
id estRows task access object operator info
Update_5 N/A root N/A
└─SelectLock_7 10.00 root for update 0
└─IndexLookUp_13 10.00 root
├─IndexRangeScan_11(Build) 10.00 cop[tikv] table:t, index:idx_e(e) range:[3,3], keep order:false, stats:pseudo
└─TableRowIDScan_12(Probe) 10.00 cop[tikv] table:t keep order:false, stats:pseudo
Update_4 N/A root N/A
└─IndexLookUp_11 10.00 root
├─IndexRangeScan_9(Build) 10.00 cop[tikv] table:t, index:idx_e(e) range:[3,3], keep order:false, stats:pseudo
└─TableRowIDScan_10(Probe) 10.00 cop[tikv] table:t keep order:false, stats:pseudo
desc delete from t where a+1 = 3;
id estRows task access object operator info
Delete_5 N/A root N/A
└─SelectLock_7 10.00 root for update 0
└─IndexLookUp_13 10.00 root
├─IndexRangeScan_11(Build) 10.00 cop[tikv] table:t, index:idx_c(c) range:[3,3], keep order:false, stats:pseudo
└─TableRowIDScan_12(Probe) 10.00 cop[tikv] table:t keep order:false, stats:pseudo
Delete_4 N/A root N/A
└─IndexLookUp_11 10.00 root
├─IndexRangeScan_9(Build) 10.00 cop[tikv] table:t, index:idx_c(c) range:[3,3], keep order:false, stats:pseudo
└─TableRowIDScan_10(Probe) 10.00 cop[tikv] table:t keep order:false, stats:pseudo
desc delete from t where b+a = 0;
id estRows task access object operator info
Delete_5 N/A root N/A
└─SelectLock_7 10.00 root for update 0
└─IndexLookUp_13 10.00 root
├─IndexRangeScan_11(Build) 10.00 cop[tikv] table:t, index:idx_e(e) range:[0,0], keep order:false, stats:pseudo
└─TableRowIDScan_12(Probe) 10.00 cop[tikv] table:t keep order:false, stats:pseudo
Delete_4 N/A root N/A
└─IndexLookUp_11 10.00 root
├─IndexRangeScan_9(Build) 10.00 cop[tikv] table:t, index:idx_e(e) range:[0,0], keep order:false, stats:pseudo
└─TableRowIDScan_10(Probe) 10.00 cop[tikv] table:t keep order:false, stats:pseudo
alter table t drop index idx_c;
alter table t drop index idx_e;
alter table t add index expr_idx_c((a+1));
Expand Down Expand Up @@ -311,32 +307,28 @@ b+a
8
desc update t set a=1 where a+1 = 3;
id estRows task access object operator info
Update_5 N/A root N/A
└─SelectLock_7 10.00 root for update 0
└─IndexLookUp_13 10.00 root
├─IndexRangeScan_11(Build) 10.00 cop[tikv] table:t, index:expr_idx_c(`a` + 1) range:[3,3], keep order:false, stats:pseudo
└─TableRowIDScan_12(Probe) 10.00 cop[tikv] table:t keep order:false, stats:pseudo
Update_4 N/A root N/A
└─IndexLookUp_11 10.00 root
├─IndexRangeScan_9(Build) 10.00 cop[tikv] table:t, index:expr_idx_c(`a` + 1) range:[3,3], keep order:false, stats:pseudo
└─TableRowIDScan_10(Probe) 10.00 cop[tikv] table:t keep order:false, stats:pseudo
desc update t set a=2, b = 3 where b+a = 3;
id estRows task access object operator info
Update_5 N/A root N/A
└─SelectLock_7 10.00 root for update 0
└─IndexLookUp_13 10.00 root
├─IndexRangeScan_11(Build) 10.00 cop[tikv] table:t, index:expr_idx_e(`b` + `a`) range:[3,3], keep order:false, stats:pseudo
└─TableRowIDScan_12(Probe) 10.00 cop[tikv] table:t keep order:false, stats:pseudo
Update_4 N/A root N/A
└─IndexLookUp_11 10.00 root
├─IndexRangeScan_9(Build) 10.00 cop[tikv] table:t, index:expr_idx_e(`b` + `a`) range:[3,3], keep order:false, stats:pseudo
└─TableRowIDScan_10(Probe) 10.00 cop[tikv] table:t keep order:false, stats:pseudo
desc delete from t where a+1 = 3;
id estRows task access object operator info
Delete_5 N/A root N/A
└─SelectLock_7 10.00 root for update 0
└─IndexLookUp_13 10.00 root
├─IndexRangeScan_11(Build) 10.00 cop[tikv] table:t, index:expr_idx_c(`a` + 1) range:[3,3], keep order:false, stats:pseudo
└─TableRowIDScan_12(Probe) 10.00 cop[tikv] table:t keep order:false, stats:pseudo
Delete_4 N/A root N/A
└─IndexLookUp_11 10.00 root
├─IndexRangeScan_9(Build) 10.00 cop[tikv] table:t, index:expr_idx_c(`a` + 1) range:[3,3], keep order:false, stats:pseudo
└─TableRowIDScan_10(Probe) 10.00 cop[tikv] table:t keep order:false, stats:pseudo
desc delete from t where b+a = 0;
id estRows task access object operator info
Delete_5 N/A root N/A
└─SelectLock_7 10.00 root for update 0
└─IndexLookUp_13 10.00 root
├─IndexRangeScan_11(Build) 10.00 cop[tikv] table:t, index:expr_idx_e(`b` + `a`) range:[0,0], keep order:false, stats:pseudo
└─TableRowIDScan_12(Probe) 10.00 cop[tikv] table:t keep order:false, stats:pseudo
Delete_4 N/A root N/A
└─IndexLookUp_11 10.00 root
├─IndexRangeScan_9(Build) 10.00 cop[tikv] table:t, index:expr_idx_e(`b` + `a`) range:[0,0], keep order:false, stats:pseudo
└─TableRowIDScan_10(Probe) 10.00 cop[tikv] table:t keep order:false, stats:pseudo
alter table t drop index expr_idx_c;
alter table t drop index expr_idx_e;
truncate table t;
Expand Down
2 changes: 1 addition & 1 deletion tests/integrationtest/r/expression/issues.result
Original file line number Diff line number Diff line change
Expand Up @@ -2075,7 +2075,7 @@ EXECUTE mystmt USING @a;
id a
select @@last_plan_from_cache;
@@last_plan_from_cache
0
1
prepare stmt from 'select unix_timestamp(?)';
set @a = '2020-05-30 20:30:00';
execute stmt using @a;
Expand Down
Loading

0 comments on commit 2d1d3fd

Please sign in to comment.