diff --git a/planner/core/integration_test.go b/planner/core/integration_test.go index 767e2b719821f..2334bf1594aa4 100644 --- a/planner/core/integration_test.go +++ b/planner/core/integration_test.go @@ -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)) + } +} diff --git a/tests/integrationtest/r/executor/write.result b/tests/integrationtest/r/executor/write.result index d0f34e585f8c2..9916eff8e9f64 100644 --- a/tests/integrationtest/r/executor/write.result +++ b/tests/integrationtest/r/executor/write.result @@ -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 diff --git a/tests/integrationtest/r/explain-non-select-stmt.result b/tests/integrationtest/r/explain-non-select-stmt.result index ad1907cf1f661..4289886b34b5e 100644 --- a/tests/integrationtest/r/explain-non-select-stmt.result +++ b/tests/integrationtest/r/explain-non-select-stmt.result @@ -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 diff --git a/tests/integrationtest/r/explain_easy.result b/tests/integrationtest/r/explain_easy.result index deaec189ee831..4b826fbce1d6f 100644 --- a/tests/integrationtest/r/explain_easy.result +++ b/tests/integrationtest/r/explain_easy.result @@ -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 @@ -466,7 +465,7 @@ Projection 10000.00 root or(, 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)); @@ -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; diff --git a/tests/integrationtest/r/explain_easy_stats.result b/tests/integrationtest/r/explain_easy_stats.result index c1fb98450dbe7..1e508ac0300b9 100644 --- a/tests/integrationtest/r/explain_easy_stats.result +++ b/tests/integrationtest/r/explain_easy_stats.result @@ -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 diff --git a/tests/integrationtest/r/explain_foreign_key.result b/tests/integrationtest/r/explain_foreign_key.result index 8503b708df7f0..e2c637196185d 100644 --- a/tests/integrationtest/r/explain_foreign_key.result +++ b/tests/integrationtest/r/explain_foreign_key.result @@ -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 @@ -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 @@ -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 diff --git a/tests/integrationtest/r/explain_generate_column_substitute.result b/tests/integrationtest/r/explain_generate_column_substitute.result index 168a6a7909613..18697ae37d263 100644 --- a/tests/integrationtest/r/explain_generate_column_substitute.result +++ b/tests/integrationtest/r/explain_generate_column_substitute.result @@ -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)); @@ -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; diff --git a/tests/integrationtest/r/expression/issues.result b/tests/integrationtest/r/expression/issues.result index d6f99175b7adb..97bdfa45c5732 100644 --- a/tests/integrationtest/r/expression/issues.result +++ b/tests/integrationtest/r/expression/issues.result @@ -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; diff --git a/tests/integrationtest/r/index_merge.result b/tests/integrationtest/r/index_merge.result index 1f7402d14bbb2..0b2e1b89bec8a 100644 --- a/tests/integrationtest/r/index_merge.result +++ b/tests/integrationtest/r/index_merge.result @@ -386,37 +386,35 @@ create table t1(c1 int, c2 int, c3 int, key(c1), key(c2)); insert into t1 values(1, 1, 1), (2, 2, 2), (3, 3, 3), (4, 4, 4), (5, 5, 5); explain delete from t1 where c1 in (select /*+ use_index_merge(t1) */ c1 from t1 where c1 < 10 or c2 < 10 and c3 < 10) order by 1; id estRows task access object operator info -Delete_11 N/A root N/A -└─Sort_15 4056.68 root index_merge.t1.c1 - └─SelectLock_17 4056.68 root for update 0 - └─HashJoin_33 4056.68 root inner join, equal:[eq(index_merge.t1.c1, index_merge.t1.c1)] - ├─HashAgg_35(Build) 3245.34 root group by:index_merge.t1.c1, funcs:firstrow(index_merge.t1.c1)->index_merge.t1.c1 - │ └─IndexMerge_41 2248.30 root type: union - │ ├─IndexRangeScan_37(Build) 3323.33 cop[tikv] table:t1, index:c1(c1) range:[-inf,10), keep order:false, stats:pseudo - │ ├─IndexRangeScan_38(Build) 3323.33 cop[tikv] table:t1, index:c2(c2) range:[-inf,10), keep order:false, stats:pseudo - │ └─Selection_40(Probe) 2248.30 cop[tikv] not(isnull(index_merge.t1.c1)), or(lt(index_merge.t1.c1, 10), and(lt(index_merge.t1.c2, 10), lt(index_merge.t1.c3, 10))) - │ └─TableRowIDScan_39 5542.21 cop[tikv] table:t1 keep order:false, stats:pseudo - └─TableReader_49(Probe) 9990.00 root data:Selection_48 - └─Selection_48 9990.00 cop[tikv] not(isnull(index_merge.t1.c1)) - └─TableFullScan_47 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo +Delete_10 N/A root N/A +└─Sort_14 4056.68 root index_merge.t1.c1 + └─HashJoin_31 4056.68 root inner join, equal:[eq(index_merge.t1.c1, index_merge.t1.c1)] + ├─HashAgg_33(Build) 3245.34 root group by:index_merge.t1.c1, funcs:firstrow(index_merge.t1.c1)->index_merge.t1.c1 + │ └─IndexMerge_39 2248.30 root type: union + │ ├─IndexRangeScan_35(Build) 3323.33 cop[tikv] table:t1, index:c1(c1) range:[-inf,10), keep order:false, stats:pseudo + │ ├─IndexRangeScan_36(Build) 3323.33 cop[tikv] table:t1, index:c2(c2) range:[-inf,10), keep order:false, stats:pseudo + │ └─Selection_38(Probe) 2248.30 cop[tikv] not(isnull(index_merge.t1.c1)), or(lt(index_merge.t1.c1, 10), and(lt(index_merge.t1.c2, 10), lt(index_merge.t1.c3, 10))) + │ └─TableRowIDScan_37 5542.21 cop[tikv] table:t1 keep order:false, stats:pseudo + └─TableReader_47(Probe) 9990.00 root data:Selection_46 + └─Selection_46 9990.00 cop[tikv] not(isnull(index_merge.t1.c1)) + └─TableFullScan_45 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo delete from t1 where c1 in (select /*+ use_index_merge(t1) */ c1 from t1 where c1 < 10 or c2 < 10 and c3 < 10) order by 1; select * from t1; c1 c2 c3 ///// UPDATE explain update t1 set c1 = 100, c2 = 100, c3 = 100 where c1 in (select /*+ use_index_merge(t1) */ c1 from t1 where c1 < 10 or c2 < 10 and c3 < 10); id estRows task access object operator info -Update_10 N/A root N/A -└─SelectLock_14 4056.68 root for update 0 - └─HashJoin_30 4056.68 root inner join, equal:[eq(index_merge.t1.c1, index_merge.t1.c1)] - ├─HashAgg_32(Build) 3245.34 root group by:index_merge.t1.c1, funcs:firstrow(index_merge.t1.c1)->index_merge.t1.c1 - │ └─IndexMerge_38 2248.30 root type: union - │ ├─IndexRangeScan_34(Build) 3323.33 cop[tikv] table:t1, index:c1(c1) range:[-inf,10), keep order:false, stats:pseudo - │ ├─IndexRangeScan_35(Build) 3323.33 cop[tikv] table:t1, index:c2(c2) range:[-inf,10), keep order:false, stats:pseudo - │ └─Selection_37(Probe) 2248.30 cop[tikv] not(isnull(index_merge.t1.c1)), or(lt(index_merge.t1.c1, 10), and(lt(index_merge.t1.c2, 10), lt(index_merge.t1.c3, 10))) - │ └─TableRowIDScan_36 5542.21 cop[tikv] table:t1 keep order:false, stats:pseudo - └─TableReader_46(Probe) 9990.00 root data:Selection_45 - └─Selection_45 9990.00 cop[tikv] not(isnull(index_merge.t1.c1)) - └─TableFullScan_44 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo +Update_9 N/A root N/A +└─HashJoin_28 4056.68 root inner join, equal:[eq(index_merge.t1.c1, index_merge.t1.c1)] + ├─HashAgg_30(Build) 3245.34 root group by:index_merge.t1.c1, funcs:firstrow(index_merge.t1.c1)->index_merge.t1.c1 + │ └─IndexMerge_36 2248.30 root type: union + │ ├─IndexRangeScan_32(Build) 3323.33 cop[tikv] table:t1, index:c1(c1) range:[-inf,10), keep order:false, stats:pseudo + │ ├─IndexRangeScan_33(Build) 3323.33 cop[tikv] table:t1, index:c2(c2) range:[-inf,10), keep order:false, stats:pseudo + │ └─Selection_35(Probe) 2248.30 cop[tikv] not(isnull(index_merge.t1.c1)), or(lt(index_merge.t1.c1, 10), and(lt(index_merge.t1.c2, 10), lt(index_merge.t1.c3, 10))) + │ └─TableRowIDScan_34 5542.21 cop[tikv] table:t1 keep order:false, stats:pseudo + └─TableReader_44(Probe) 9990.00 root data:Selection_43 + └─Selection_43 9990.00 cop[tikv] not(isnull(index_merge.t1.c1)) + └─TableFullScan_42 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo update t1 set c1 = 100, c2 = 100, c3 = 100 where c1 in (select /*+ use_index_merge(t1) */ c1 from t1 where c1 < 10 or c2 < 10 and c3 < 10); select * from t1; c1 c2 c3 @@ -460,6 +458,7 @@ StreamAgg_9 1.00 root funcs:count(Column#96)->Column#97 └─MemTableScan_15 10000.00 root table:STATEMENTS_SUMMARY show warnings; Level Code Message +Warning 1815 use_index_merge(index_merge.t_alias) is inapplicable, check whether the table(index_merge.t_alias) exists select count(c1) from (select /*+ use_index_merge(t_alias), stream_agg() */ count(1) c1 from information_schema.statements_summary where sum_latency >= 0 or max_latency >= 0 order by 1) dt; count(c1) 1 @@ -618,6 +617,7 @@ Sort_5 2978.47 root index_merge.t1.c1 └─TableFullScan_8 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo show warnings; Level Code Message +Warning 1105 IndexMerge is inapplicable select /*+ use_index_merge(t1) */ * from t1 where (((c1 < 10 or c3 < 10) and (c1 < 10 or c4 < 10)) or c2 < 10) and (c3 < 10 or c5 < 10) order by 1; c1 c2 c3 c4 c5 1 1 1 1 1 @@ -850,6 +850,9 @@ CTE_0 1.80 root Recursive CTE └─CTETable_16 1.00 root Scan on CTE_0 show warnings; Level Code Message +Warning 1815 use_index_merge(index_merge.t_alias) is inapplicable, check whether the table(index_merge.t_alias) exists +Warning 1815 use_index_merge(index_merge.t_alias) is inapplicable, check whether the table(index_merge.t_alias) exists +Warning 1815 use_index_merge(index_merge.t_alias) is inapplicable, check whether the table(index_merge.t_alias) exists with recursive cte1 as (select 1 c1, 1 c2, 1 c3 UNION ALL select /*+ use_index_merge(t_alias) */ c1 + 1, c2 + 1, c3 + 1 from cte1 t_alias where c1 < 10 or c2 < 10 and c3 < 10) select * from cte1 order by 1; c1 c2 c3 1 1 1 diff --git a/tests/integrationtest/r/planner/cascades/integration.result b/tests/integrationtest/r/planner/cascades/integration.result index 128432db5df74..d133602987722 100644 --- a/tests/integrationtest/r/planner/cascades/integration.result +++ b/tests/integrationtest/r/planner/cascades/integration.result @@ -896,7 +896,7 @@ Projection_3 10000.00 root Column#2, Column#4, Column#5, Column#6, Column#7, Co └─MemTableScan_4 10000.00 root table:PROCESSLIST select USER, DB, COMMAND, TIME, STATE, INFO, `DIGEST` from information_schema.processlist; USER DB COMMAND TIME STATE INFO DIGEST -root planner__cascades__integration Query 0 in transaction; autocommit select USER, DB, COMMAND, TIME, STATE, INFO, `DIGEST` from information_schema.processlist 78f1c0b2fcd082b6504b8ba48706391f13aad730a9efb7ec295688010bfec477 +root planner__cascades__integration Query 0 autocommit select USER, DB, COMMAND, TIME, STATE, INFO, `DIGEST` from information_schema.processlist 78f1c0b2fcd082b6504b8ba48706391f13aad730a9efb7ec295688010bfec477 drop table if exists t; create table t(a int primary key, b int); insert into t values (1, 11), (4, 44), (2, 22), (3, 33); diff --git a/tests/integrationtest/r/planner/core/casetest/rule/rule_result_reorder.result b/tests/integrationtest/r/planner/core/casetest/rule/rule_result_reorder.result index b74210e325f1a..7c7fbbef37d3a 100644 --- a/tests/integrationtest/r/planner/core/casetest/rule/rule_result_reorder.result +++ b/tests/integrationtest/r/planner/core/casetest/rule/rule_result_reorder.result @@ -113,27 +113,23 @@ Insert N/A root N/A explain FORMAT='brief' delete from t; id estRows task access object operator info Delete N/A root N/A -└─SelectLock 10000.00 root for update 0 - └─TableReader 10000.00 root data:TableFullScan - └─TableFullScan 10000.00 cop[tikv] table:t keep order:false, stats:pseudo +└─TableReader 10000.00 root data:TableFullScan + └─TableFullScan 10000.00 cop[tikv] table:t keep order:false, stats:pseudo explain FORMAT='brief' delete from t where a>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:t range:(1,+inf], keep order:false, stats:pseudo +└─TableReader 3333.33 root data:TableRangeScan + └─TableRangeScan 3333.33 cop[tikv] table:t range:(1,+inf], keep order:false, stats:pseudo explain FORMAT='brief' update t set a=a+1; id estRows task access object operator info Update N/A root N/A -└─SelectLock 10000.00 root for update 0 - └─TableReader 10000.00 root data:TableFullScan - └─TableFullScan 10000.00 cop[tikv] table:t keep order:false, stats:pseudo +└─TableReader 10000.00 root data:TableFullScan + └─TableFullScan 10000.00 cop[tikv] table:t keep order:false, stats:pseudo explain FORMAT='brief' update t set a=a+1 where a>1; id estRows task access object operator info Update N/A root N/A -└─SelectLock 3333.33 root for update 0 - └─TableReader 3333.33 root data:TableRangeScan - └─TableRangeScan 3333.33 cop[tikv] table:t range:(1,+inf], keep order:false, stats:pseudo +└─TableReader 3333.33 root data:TableRangeScan + └─TableRangeScan 3333.33 cop[tikv] table:t range:(1,+inf], keep order:false, stats:pseudo set tidb_cost_model_version=2; set tidb_enable_ordered_result_mode=1; drop table if exists t1; diff --git a/tests/integrationtest/r/planner/core/enforce_mpp.result b/tests/integrationtest/r/planner/core/enforce_mpp.result index 1006962109c41..b34fed23fbf51 100644 --- a/tests/integrationtest/r/planner/core/enforce_mpp.result +++ b/tests/integrationtest/r/planner/core/enforce_mpp.result @@ -2,6 +2,7 @@ set tidb_cost_model_version=2; set @@tidb_opt_tiflash_concurrency_factor = 0; SHOW WARNINGS; Level Code Message +Warning 1292 Truncated incorrect tidb_opt_tiflash_concurrency_factor value: '0' select @@tidb_opt_tiflash_concurrency_factor; @@tidb_opt_tiflash_concurrency_factor 1 diff --git a/tests/integrationtest/r/planner/core/integration.result b/tests/integrationtest/r/planner/core/integration.result index cd1de85748744..51a0c21824055 100644 --- a/tests/integrationtest/r/planner/core/integration.result +++ b/tests/integrationtest/r/planner/core/integration.result @@ -255,12 +255,12 @@ select * from t where a > 1 and a < 10 order by b; a b select @@last_plan_from_binding; @@last_plan_from_binding -0 +1 select /*+ use_index(t, idx_b) */ * from t where a > 1 and a < 10 order by b; a b select @@last_plan_from_binding; @@last_plan_from_binding -0 +1 select /*+ use_index(t, idx_b) */ * from t where a > 1 and a < 10 order by b; a b Level Code Message @@ -3874,12 +3874,6 @@ drop table if exists t; CREATE TABLE t(col1 enum('p5', '9a33x') NOT NULL DEFAULT 'p5',col2 tinyblob DEFAULT NULL) ENGINE = InnoDB DEFAULT CHARSET = latin1 COLLATE = latin1_bin; (select last_value(col1) over () as r0 from t) union all (select col2 as r0 from t); r0 -drop table if exists t; -create table t (a int, b int, c int, index ia(a)); -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; -a b c a b c a b c a b c -select plan from information_schema.statements_summary where SCHEMA_NAME = 'test' and STMT_TYPE = 'Select'; -plan CREATE TABLE `sbtest1` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, `k` int(11) NOT NULL DEFAULT '0', `c` char(120) NOT NULL DEFAULT '', `pad` char(60) NOT NULL DEFAULT '', PRIMARY KEY (`id`) /*T![clustered_index] CLUSTERED */ , KEY `k_1` (`k`) ); set @@tidb_opt_range_max_size = 111; explain format='brief' select * from planner__core__integration.sbtest1 a where pad in ('1','1','1','1','1') and id in (1,1,1,1,1); diff --git a/tests/integrationtest/r/planner/core/integration_partition.result b/tests/integrationtest/r/planner/core/integration_partition.result index ef2583b6490b8..e7cd7cfa89b52 100644 --- a/tests/integrationtest/r/planner/core/integration_partition.result +++ b/tests/integrationtest/r/planner/core/integration_partition.result @@ -739,29 +739,39 @@ a b c 10 2022-01-01 00:00:00 Wowe explain format = 'brief' select * from t where a = 10 and b = "2022-01-01" and c = "Wow"; id estRows task access object operator info - └─TableFullScan 12.00 cop[tikv] table:t keep order:false -TableReader 0.52 root partition:p3 data:Selection -└─Selection 0.52 cop[tikv] eq(rangecolumnsmulti.t.a, 10), eq(rangecolumnsmulti.t.b, 2022-01-01 00:00:00.000000), eq(rangecolumnsmulti.t.c, "Wow") +Projection 0.00 root rangecolumnsmulti.t.a, rangecolumnsmulti.t.b, rangecolumnsmulti.t.c +└─UnionScan 0.00 root eq(rangecolumnsmulti.t.a, 10), eq(rangecolumnsmulti.t.b, 2022-01-01 00:00:00.000000), eq(rangecolumnsmulti.t.c, "Wow") + └─TableReader 0.00 root partition:p3 data:Selection + └─Selection 0.00 cop[tikv] eq(rangecolumnsmulti.t.a, 10), eq(rangecolumnsmulti.t.b, 2022-01-01 00:00:00.000000), eq(rangecolumnsmulti.t.c, "Wow") + └─TableFullScan 10000.00 cop[tikv] table:t keep order:false, stats:pseudo explain format = 'brief' select * from t where a = 10 and b = "2022-01-01" and c <= "Wow"; id estRows task access object operator info - └─TableFullScan 12.00 cop[tikv] table:t keep order:false -TableReader 0.83 root partition:p2,p3 data:Selection -└─Selection 0.83 cop[tikv] eq(rangecolumnsmulti.t.a, 10), eq(rangecolumnsmulti.t.b, 2022-01-01 00:00:00.000000), le(rangecolumnsmulti.t.c, "Wow") +Projection 0.00 root rangecolumnsmulti.t.a, rangecolumnsmulti.t.b, rangecolumnsmulti.t.c +└─UnionScan 0.00 root eq(rangecolumnsmulti.t.a, 10), eq(rangecolumnsmulti.t.b, 2022-01-01 00:00:00.000000), le(rangecolumnsmulti.t.c, "Wow") + └─TableReader 0.00 root partition:p2,p3 data:Selection + └─Selection 0.00 cop[tikv] eq(rangecolumnsmulti.t.a, 10), eq(rangecolumnsmulti.t.b, 2022-01-01 00:00:00.000000), le(rangecolumnsmulti.t.c, "Wow") + └─TableFullScan 10000.00 cop[tikv] table:t keep order:false, stats:pseudo explain format = 'brief' select * from t where a = 10 and b = "2022-01-01" and c < "Wow"; id estRows task access object operator info - └─TableFullScan 12.00 cop[tikv] table:t keep order:false -TableReader 0.31 root partition:p2 data:Selection -└─Selection 0.31 cop[tikv] eq(rangecolumnsmulti.t.a, 10), eq(rangecolumnsmulti.t.b, 2022-01-01 00:00:00.000000), lt(rangecolumnsmulti.t.c, "Wow") +Projection 0.00 root rangecolumnsmulti.t.a, rangecolumnsmulti.t.b, rangecolumnsmulti.t.c +└─UnionScan 0.00 root eq(rangecolumnsmulti.t.a, 10), eq(rangecolumnsmulti.t.b, 2022-01-01 00:00:00.000000), lt(rangecolumnsmulti.t.c, "Wow") + └─TableReader 0.00 root partition:p2 data:Selection + └─Selection 0.00 cop[tikv] eq(rangecolumnsmulti.t.a, 10), eq(rangecolumnsmulti.t.b, 2022-01-01 00:00:00.000000), lt(rangecolumnsmulti.t.c, "Wow") + └─TableFullScan 10000.00 cop[tikv] table:t keep order:false, stats:pseudo explain format = 'brief' select * from t where a = 10 and b = "2022-01-01" and c > "Wow"; id estRows task access object operator info - └─TableFullScan 12.00 cop[tikv] table:t keep order:false -TableReader 0.10 root partition:p3 data:Selection -└─Selection 0.10 cop[tikv] eq(rangecolumnsmulti.t.a, 10), eq(rangecolumnsmulti.t.b, 2022-01-01 00:00:00.000000), gt(rangecolumnsmulti.t.c, "Wow") +Projection 0.00 root rangecolumnsmulti.t.a, rangecolumnsmulti.t.b, rangecolumnsmulti.t.c +└─UnionScan 0.00 root eq(rangecolumnsmulti.t.a, 10), eq(rangecolumnsmulti.t.b, 2022-01-01 00:00:00.000000), gt(rangecolumnsmulti.t.c, "Wow") + └─TableReader 0.00 root partition:p3 data:Selection + └─Selection 0.00 cop[tikv] eq(rangecolumnsmulti.t.a, 10), eq(rangecolumnsmulti.t.b, 2022-01-01 00:00:00.000000), gt(rangecolumnsmulti.t.c, "Wow") + └─TableFullScan 10000.00 cop[tikv] table:t keep order:false, stats:pseudo explain format = 'brief' select * from t where a = 10 and b = "2022-01-01" and c >= "Wow"; id estRows task access object operator info - └─TableFullScan 12.00 cop[tikv] table:t keep order:false -TableReader 0.62 root partition:p3 data:Selection -└─Selection 0.62 cop[tikv] eq(rangecolumnsmulti.t.a, 10), eq(rangecolumnsmulti.t.b, 2022-01-01 00:00:00.000000), ge(rangecolumnsmulti.t.c, "Wow") +Projection 0.00 root rangecolumnsmulti.t.a, rangecolumnsmulti.t.b, rangecolumnsmulti.t.c +└─UnionScan 0.00 root eq(rangecolumnsmulti.t.a, 10), eq(rangecolumnsmulti.t.b, 2022-01-01 00:00:00.000000), ge(rangecolumnsmulti.t.c, "Wow") + └─TableReader 0.00 root partition:p3 data:Selection + └─Selection 0.00 cop[tikv] eq(rangecolumnsmulti.t.a, 10), eq(rangecolumnsmulti.t.b, 2022-01-01 00:00:00.000000), ge(rangecolumnsmulti.t.c, "Wow") + └─TableFullScan 10000.00 cop[tikv] table:t keep order:false, stats:pseudo select * from t where a <= 10 and b <= '2022-01-01' and c < "Wow"; a b c -2147483648 0000-00-00 00:00:00 @@ -778,9 +788,11 @@ a b c 5 0000-00-00 00:00:00 Hi explain format = 'brief' select * from t where a <= 10 and b <= '2022-01-01' and c < "Wow"; id estRows task access object operator info - └─TableFullScan 12.00 cop[tikv] table:t keep order:false -TableReader 1.50 root partition:p1,p2,p3 data:Selection -└─Selection 1.50 cop[tikv] le(rangecolumnsmulti.t.a, 10), le(rangecolumnsmulti.t.b, 2022-01-01 00:00:00.000000), lt(rangecolumnsmulti.t.c, "Wow") +Projection 367.05 root rangecolumnsmulti.t.a, rangecolumnsmulti.t.b, rangecolumnsmulti.t.c +└─UnionScan 367.05 root le(rangecolumnsmulti.t.a, 10), le(rangecolumnsmulti.t.b, 2022-01-01 00:00:00.000000), lt(rangecolumnsmulti.t.c, "Wow") + └─TableReader 367.05 root partition:p1,p2,p3 data:Selection + └─Selection 367.05 cop[tikv] le(rangecolumnsmulti.t.a, 10), le(rangecolumnsmulti.t.b, 2022-01-01 00:00:00.000000), lt(rangecolumnsmulti.t.c, "Wow") + └─TableFullScan 10000.00 cop[tikv] table:t keep order:false, stats:pseudo select * from t where a <= 11 and b <= '2022-01-01' and c < "Wow"; a b c -2147483648 0000-00-00 00:00:00 @@ -788,23 +800,27 @@ a b c 5 0000-00-00 00:00:00 Hi explain format = 'brief' select * from t where a <= 10 and b <= '2022-01-01' and c < "Wow"; id estRows task access object operator info -TableReader 1.50 root partition:p1,p2,p3 data:Selection -└─Selection 1.50 cop[tikv] le(rangecolumnsmulti.t.a, 10), le(rangecolumnsmulti.t.b, 2022-01-01 00:00:00.000000), lt(rangecolumnsmulti.t.c, "Wow") - └─TableFullScan 12.00 cop[tikv] table:t keep order:false +Projection 367.05 root rangecolumnsmulti.t.a, rangecolumnsmulti.t.b, rangecolumnsmulti.t.c +└─UnionScan 367.05 root le(rangecolumnsmulti.t.a, 10), le(rangecolumnsmulti.t.b, 2022-01-01 00:00:00.000000), lt(rangecolumnsmulti.t.c, "Wow") + └─TableReader 367.05 root partition:p1,p2,p3 data:Selection + └─Selection 367.05 cop[tikv] le(rangecolumnsmulti.t.a, 10), le(rangecolumnsmulti.t.b, 2022-01-01 00:00:00.000000), lt(rangecolumnsmulti.t.c, "Wow") + └─TableFullScan 10000.00 cop[tikv] table:t keep order:false, stats:pseudo create table tref (a int, b datetime, c varchar(255), key (a,b,c)); set @@sql_mode = ''; insert into tref select * from t; set @@sql_mode = DEFAULT; explain format = 'brief' select * from tref where a <= 10 and b <= '2022-01-01' and c < "Wow"; id estRows task access object operator info -IndexReader 367.05 root index:Selection -└─Selection 367.05 cop[tikv] le(rangecolumnsmulti.tref.b, 2022-01-01 00:00:00.000000), lt(rangecolumnsmulti.tref.c, "Wow") - └─IndexRangeScan 3323.33 cop[tikv] table:tref, index:a(a, b, c) range:[-inf,10], keep order:false, stats:pseudo +Projection 367.05 root rangecolumnsmulti.tref.a, rangecolumnsmulti.tref.b, rangecolumnsmulti.tref.c +└─UnionScan 367.05 root le(rangecolumnsmulti.tref.a, 10), le(rangecolumnsmulti.tref.b, 2022-01-01 00:00:00.000000), lt(rangecolumnsmulti.tref.c, "Wow") + └─IndexReader 367.05 root index:Selection + └─Selection 367.05 cop[tikv] le(rangecolumnsmulti.tref.b, 2022-01-01 00:00:00.000000), lt(rangecolumnsmulti.tref.c, "Wow") + └─IndexRangeScan 3323.33 cop[tikv] table:tref, index:a(a, b, c) range:[-inf,10], keep order:false, stats:pseudo explain format = 'brief' select * from t where a <= 10 and b <= '2022-01-01' and c <= "Wow"; id estRows task access object operator info -TableReader 4.00 root partition:p1,p2,p3 data:Selection -└─Selection 4.00 cop[tikv] le(rangecolumnsmulti.t.a, 10), le(rangecolumnsmulti.t.b, 2022-01-01 00:00:00.000000), le(rangecolumnsmulti.t.c, "Wow") - └─TableFullScan 12.00 cop[tikv] table:t keep order:false +TableReader 367.05 root partition:p1,p2,p3 data:Selection +└─Selection 367.05 cop[tikv] le(rangecolumnsmulti.t.a, 10), le(rangecolumnsmulti.t.b, 2022-01-01 00:00:00.000000), le(rangecolumnsmulti.t.c, "Wow") + └─TableFullScan 10000.00 cop[tikv] table:t keep order:false, stats:pseudo select * from t where a = 2 and b = "2022-01-02" and c = "Hi" or b = '2022-01-01' and c = "Wow"; a b c NULL 2022-01-01 00:00:00 Wow @@ -819,33 +835,33 @@ select * from t where a = 2 and b = "2022-01-02" and c < "Hi"; a b c select * from t where a < 2; a b c --2147483648 0000-00-00 00:00:00 -2147483648 0000-00-00 00:00:00 NULL +-2147483648 0000-00-00 00:00:00 1 NULL Wow select * from t where a <= 2 and b <= "2022-01-02" and c < "Hi"; a b c -2147483648 0000-00-00 00:00:00 explain format = 'brief' select * from t where a < 2; id estRows task access object operator info -TableReader 3.00 root partition:p1,p2 data:Selection -└─Selection 3.00 cop[tikv] lt(rangecolumnsmulti.t.a, 2) - └─TableFullScan 12.00 cop[tikv] table:t keep order:false +TableReader 3323.33 root partition:p1,p2 data:Selection +└─Selection 3323.33 cop[tikv] lt(rangecolumnsmulti.t.a, 2) + └─TableFullScan 10000.00 cop[tikv] table:t keep order:false, stats:pseudo select * from t where a < 2 and a > -22; a b c 1 NULL Wow explain format = 'brief' select * from t where a < 2 and a > -22; id estRows task access object operator info -TableReader 1.00 root partition:p2 data:Selection -└─Selection 1.00 cop[tikv] gt(rangecolumnsmulti.t.a, -22), lt(rangecolumnsmulti.t.a, 2) - └─TableFullScan 12.00 cop[tikv] table:t keep order:false +TableReader 250.00 root partition:p2 data:Selection +└─Selection 250.00 cop[tikv] gt(rangecolumnsmulti.t.a, -22), lt(rangecolumnsmulti.t.a, 2) + └─TableFullScan 10000.00 cop[tikv] table:t keep order:false, stats:pseudo select * from t where c = ""; a b c -2147483648 0000-00-00 00:00:00 explain format = 'brief' select * from t where c = ""; id estRows task access object operator info -TableReader 1.00 root partition:all data:Selection -└─Selection 1.00 cop[tikv] eq(rangecolumnsmulti.t.c, "") - └─TableFullScan 12.00 cop[tikv] table:t keep order:false +TableReader 10.00 root partition:all data:Selection +└─Selection 10.00 cop[tikv] eq(rangecolumnsmulti.t.c, "") + └─TableFullScan 10000.00 cop[tikv] table:t keep order:false, stats:pseudo create database RColumnsMulti; use RColumnsMulti; create table t (a int, b datetime, c varchar(255), key (a,b,c)) partition by range columns (a,b,c) (partition p0 values less than (-2147483648, '0000-01-01', ""), partition p1 values less than (-2147483648, '0001-01-01', ""), partition p2 values less than (-2, '0001-01-01', ""), partition p3 values less than (0, '0001-01-01', ""), partition p4 values less than (0, '2031-01-01', ""), partition p5 values less than (0, '2031-01-01', "Wow"), partition p6 values less than (0, '2031-01-01', MAXVALUE), partition p7 values less than (0, MAXVALUE, MAXVALUE), partition p8 values less than (MAXVALUE, MAXVALUE, MAXVALUE)); @@ -880,17 +896,23 @@ a b c 1 NULL Wow explain format = 'brief' select a,b,c from t where a = 1 AND c = "Wow"; id estRows task access object operator info -IndexReader 0.50 root partition:p8 index:Selection -└─Selection 0.50 cop[tikv] eq(rcolumnsmulti.t.c, "Wow") - └─IndexRangeScan 1.00 cop[tikv] table:t, index:a(a, b, c) range:[1,1], keep order:false +Projection 0.01 root rcolumnsmulti.t.a, rcolumnsmulti.t.b, rcolumnsmulti.t.c +└─UnionScan 0.01 root eq(rcolumnsmulti.t.a, 1), eq(rcolumnsmulti.t.c, "Wow") + └─IndexLookUp 0.01 root partition:p8 + ├─Selection(Build) 0.01 cop[tikv] eq(rcolumnsmulti.t.c, "Wow") + │ └─IndexRangeScan 10.00 cop[tikv] table:t, index:a(a, b, c) range:[1,1], keep order:false, stats:pseudo + └─TableRowIDScan(Probe) 0.01 cop[tikv] table:t keep order:false, stats:pseudo select a,b,c from t where a = 0 AND c = "Wow"; a b c 0 2020-01-01 00:00:00 Wow explain format = 'brief' select a,b,c from t where a = 0 AND c = "Wow"; id estRows task access object operator info -IndexReader 0.50 root partition:p3,p4,p5,p6,p7 index:Selection -└─Selection 0.50 cop[tikv] eq(rcolumnsmulti.t.c, "Wow") - └─IndexRangeScan 1.00 cop[tikv] table:t, index:a(a, b, c) range:[0,0], keep order:false +Projection 0.01 root rcolumnsmulti.t.a, rcolumnsmulti.t.b, rcolumnsmulti.t.c +└─UnionScan 0.01 root eq(rcolumnsmulti.t.a, 0), eq(rcolumnsmulti.t.c, "Wow") + └─IndexLookUp 0.01 root partition:p3,p4,p5,p6,p7 + ├─Selection(Build) 0.01 cop[tikv] eq(rcolumnsmulti.t.c, "Wow") + │ └─IndexRangeScan 10.00 cop[tikv] table:t, index:a(a, b, c) range:[0,0], keep order:false, stats:pseudo + └─TableRowIDScan(Probe) 0.01 cop[tikv] table:t keep order:false, stats:pseudo create database rce; use rce; create table tref (a int unsigned, b int, c int); @@ -995,34 +1017,46 @@ a b c 17 17 17 explain format = 'brief' select * from t where c = 3; id estRows task access object operator info -TableReader 1.00 root partition:all data:Selection -└─Selection 1.00 cop[tikv] eq(rce.t.c, 3) - └─TableFullScan 21.00 cop[tikv] table:t keep order:false +Projection 10.00 root rce.t.a, rce.t.b, rce.t.c +└─UnionScan 10.00 root eq(rce.t.c, 3) + └─TableReader 10.00 root partition:all data:Selection + └─Selection 10.00 cop[tikv] eq(rce.t.c, 3) + └─TableFullScan 10000.00 cop[tikv] table:t keep order:false, stats:pseudo explain format = 'brief' select * from t where b > 3 and c = 3; id estRows task access object operator info -TableReader 0.52 root partition:all data:Selection -└─Selection 0.52 cop[tikv] eq(rce.t.c, 3), gt(rce.t.b, 3) - └─TableFullScan 21.00 cop[tikv] table:t keep order:false +Projection 3.33 root rce.t.a, rce.t.b, rce.t.c +└─UnionScan 3.33 root eq(rce.t.c, 3), gt(rce.t.b, 3) + └─TableReader 3.33 root partition:all data:Selection + └─Selection 3.33 cop[tikv] eq(rce.t.c, 3), gt(rce.t.b, 3) + └─TableFullScan 10000.00 cop[tikv] table:t keep order:false, stats:pseudo explain format = 'brief' select * from t where a = 5 and c = 3; id estRows task access object operator info -TableReader 0.05 root partition:p9 data:Selection -└─Selection 0.05 cop[tikv] eq(rce.t.a, 5), eq(rce.t.c, 3) - └─TableFullScan 21.00 cop[tikv] table:t keep order:false +Projection 0.01 root rce.t.a, rce.t.b, rce.t.c +└─UnionScan 0.01 root eq(rce.t.a, 5), eq(rce.t.c, 3) + └─TableReader 0.01 root partition:p9 data:Selection + └─Selection 0.01 cop[tikv] eq(rce.t.a, 5), eq(rce.t.c, 3) + └─TableFullScan 10000.00 cop[tikv] table:t keep order:false, stats:pseudo explain format = 'brief' select * from t where a = 4 and c = 3; id estRows task access object operator info -TableReader 0.43 root partition:p1,p2,p3,p4,p5,p6,p7,p8 data:Selection -└─Selection 0.43 cop[tikv] eq(rce.t.a, 4), eq(rce.t.c, 3) - └─TableFullScan 21.00 cop[tikv] table:t keep order:false +Projection 0.01 root rce.t.a, rce.t.b, rce.t.c +└─UnionScan 0.01 root eq(rce.t.a, 4), eq(rce.t.c, 3) + └─TableReader 0.01 root partition:p1,p2,p3,p4,p5,p6,p7,p8 data:Selection + └─Selection 0.01 cop[tikv] eq(rce.t.a, 4), eq(rce.t.c, 3) + └─TableFullScan 10000.00 cop[tikv] table:t keep order:false, stats:pseudo explain format = 'brief' select * from t where a in (4,14) and c = 3; id estRows task access object operator info -TableReader 0.57 root partition:p1,p2,p3,p4,p5,p6,p7,p8,p11,p12 data:Selection -└─Selection 0.57 cop[tikv] eq(rce.t.c, 3), in(rce.t.a, 4, 14) - └─TableFullScan 21.00 cop[tikv] table:t keep order:false +Projection 0.02 root rce.t.a, rce.t.b, rce.t.c +└─UnionScan 0.02 root eq(rce.t.c, 3), in(rce.t.a, 4, 14) + └─TableReader 0.02 root partition:p1,p2,p3,p4,p5,p6,p7,p8,p11,p12 data:Selection + └─Selection 0.02 cop[tikv] eq(rce.t.c, 3), in(rce.t.a, 4, 14) + └─TableFullScan 10000.00 cop[tikv] table:t keep order:false, stats:pseudo explain format = 'brief' select * from t where a in (4,14) and b in (null,10); id estRows task access object operator info -TableReader 1.14 root partition:p5,p12 data:Selection -└─Selection 1.14 cop[tikv] in(rce.t.a, 4, 14), in(rce.t.b, NULL, 10) - └─TableFullScan 21.00 cop[tikv] table:t keep order:false +Projection 0.02 root rce.t.a, rce.t.b, rce.t.c +└─UnionScan 0.02 root in(rce.t.a, 4, 14), in(rce.t.b, NULL, 10) + └─TableReader 0.02 root partition:p5,p12 data:Selection + └─Selection 0.02 cop[tikv] in(rce.t.a, 4, 14), in(rce.t.b, NULL, 10) + └─TableFullScan 10000.00 cop[tikv] table:t keep order:false, stats:pseudo select * from tref where a in (4,14) and b in (null,10); a b c 14 10 4 @@ -1033,9 +1067,11 @@ a b c 4 10 3 explain format = 'brief' select * from t where a in (4,14) and (b in (11,10) OR b is null); id estRows task access object operator info -TableReader 3.43 root partition:p1,p5,p6,p11,p12 data:Selection -└─Selection 3.43 cop[tikv] in(rce.t.a, 4, 14), or(in(rce.t.b, 11, 10), isnull(rce.t.b)) - └─TableFullScan 21.00 cop[tikv] table:t keep order:false +Projection 0.06 root rce.t.a, rce.t.b, rce.t.c +└─UnionScan 0.06 root in(rce.t.a, 4, 14), or(in(rce.t.b, 11, 10), isnull(rce.t.b)) + └─TableReader 0.06 root partition:p1,p5,p6,p11,p12 data:Selection + └─Selection 0.06 cop[tikv] in(rce.t.a, 4, 14), or(in(rce.t.b, 11, 10), isnull(rce.t.b)) + └─TableFullScan 10000.00 cop[tikv] table:t keep order:false, stats:pseudo select * from tref where a in (4,14) and (b in (11,10) OR b is null); a b c 14 NULL NULL @@ -1099,14 +1135,18 @@ h l explain format = 'brief' select * from t where a > 'C' and a < 'q'; id estRows task access object operator info -TableReader 6.00 root partition:p1,p2,p3,p4 data:Selection -└─Selection 6.00 cop[tikv] gt(cwc.t.a, "C"), lt(cwc.t.a, "q") - └─TableFullScan 14.00 cop[tikv] table:t keep order:false +Projection 250.00 root cwc.t.a +└─UnionScan 250.00 root gt(cwc.t.a, "C"), lt(cwc.t.a, "q") + └─TableReader 250.00 root partition:p1,p2,p3,p4 data:Selection + └─Selection 250.00 cop[tikv] gt(cwc.t.a, "C"), lt(cwc.t.a, "q") + └─TableFullScan 10000.00 cop[tikv] table:t keep order:false, stats:pseudo explain format = 'brief' select * from t where a > 'c' and a < 'Q'; id estRows task access object operator info -TableReader 6.00 root partition:p1,p2,p3,p4 data:Selection -└─Selection 6.00 cop[tikv] gt(cwc.t.a, "c"), lt(cwc.t.a, "Q") - └─TableFullScan 14.00 cop[tikv] table:t keep order:false +Projection 250.00 root cwc.t.a +└─UnionScan 250.00 root gt(cwc.t.a, "c"), lt(cwc.t.a, "Q") + └─TableReader 250.00 root partition:p1,p2,p3,p4 data:Selection + └─Selection 250.00 cop[tikv] gt(cwc.t.a, "c"), lt(cwc.t.a, "Q") + └─TableFullScan 10000.00 cop[tikv] table:t keep order:false, stats:pseudo drop database if exists rcd; create database rcd; use rcd; @@ -1156,69 +1196,95 @@ a 2020-01-01 explain select * from t where a < '1943-02-12'; id estRows task access object operator info -TableReader_7 0.00 root partition:p0 data:Selection_6 -└─Selection_6 0.00 cop[tikv] lt(rcd.t.a, 1943-02-12 00:00:00.000000) - └─TableFullScan_5 7.00 cop[tikv] table:t keep order:false +Projection_5 3323.33 root rcd.t.a +└─UnionScan_6 3323.33 root lt(rcd.t.a, 1943-02-12 00:00:00.000000) + └─TableReader_9 3323.33 root partition:p0 data:Selection_8 + └─Selection_8 3323.33 cop[tikv] lt(rcd.t.a, 1943-02-12 00:00:00.000000) + └─TableFullScan_7 10000.00 cop[tikv] table:t keep order:false, stats:pseudo explain select * from t where a >= '19690213'; id estRows task access object operator info -TableReader_7 7.00 root partition:all data:Selection_6 -└─Selection_6 7.00 cop[tikv] ge(rcd.t.a, 1969-02-13 00:00:00.000000) - └─TableFullScan_5 7.00 cop[tikv] table:t keep order:false +Projection_5 3333.33 root rcd.t.a +└─UnionScan_6 3333.33 root ge(rcd.t.a, 1969-02-13 00:00:00.000000) + └─TableReader_9 3333.33 root partition:all data:Selection_8 + └─Selection_8 3333.33 cop[tikv] ge(rcd.t.a, 1969-02-13 00:00:00.000000) + └─TableFullScan_7 10000.00 cop[tikv] table:t keep order:false, stats:pseudo explain select * from t where a > '2003-03-13'; id estRows task access object operator info -TableReader_7 4.00 root partition:p2,p3,p4,p5,p6 data:Selection_6 -└─Selection_6 4.00 cop[tikv] gt(rcd.t.a, 2003-03-13 00:00:00.000000) - └─TableFullScan_5 7.00 cop[tikv] table:t keep order:false +Projection_5 3333.33 root rcd.t.a +└─UnionScan_6 3333.33 root gt(rcd.t.a, 2003-03-13 00:00:00.000000) + └─TableReader_9 3333.33 root partition:p2,p3,p4,p5,p6 data:Selection_8 + └─Selection_8 3333.33 cop[tikv] gt(rcd.t.a, 2003-03-13 00:00:00.000000) + └─TableFullScan_7 10000.00 cop[tikv] table:t keep order:false, stats:pseudo explain select * from t where a < '2006-02-03'; id estRows task access object operator info -TableReader_7 3.00 root partition:p0,p1,p2 data:Selection_6 -└─Selection_6 3.00 cop[tikv] lt(rcd.t.a, 2006-02-03 00:00:00.000000) - └─TableFullScan_5 7.00 cop[tikv] table:t keep order:false +Projection_5 3323.33 root rcd.t.a +└─UnionScan_6 3323.33 root lt(rcd.t.a, 2006-02-03 00:00:00.000000) + └─TableReader_9 3323.33 root partition:p0,p1,p2 data:Selection_8 + └─Selection_8 3323.33 cop[tikv] lt(rcd.t.a, 2006-02-03 00:00:00.000000) + └─TableFullScan_7 10000.00 cop[tikv] table:t keep order:false, stats:pseudo explain select * from t where a = '20070707'; id estRows task access object operator info -TableReader_7 0.00 root partition:p2 data:Selection_6 -└─Selection_6 0.00 cop[tikv] eq(rcd.t.a, 2007-07-07 00:00:00.000000) - └─TableFullScan_5 7.00 cop[tikv] table:t keep order:false +Projection_5 10.00 root rcd.t.a +└─UnionScan_6 10.00 root eq(rcd.t.a, 2007-07-07 00:00:00.000000) + └─TableReader_9 10.00 root partition:p2 data:Selection_8 + └─Selection_8 10.00 cop[tikv] eq(rcd.t.a, 2007-07-07 00:00:00.000000) + └─TableFullScan_7 10000.00 cop[tikv] table:t keep order:false, stats:pseudo explain select * from t where a > '1949-10-10'; id estRows task access object operator info -TableReader_7 7.00 root partition:all data:Selection_6 -└─Selection_6 7.00 cop[tikv] gt(rcd.t.a, 1949-10-10 00:00:00.000000) - └─TableFullScan_5 7.00 cop[tikv] table:t keep order:false +Projection_5 3333.33 root rcd.t.a +└─UnionScan_6 3333.33 root gt(rcd.t.a, 1949-10-10 00:00:00.000000) + └─TableReader_9 3333.33 root partition:all data:Selection_8 + └─Selection_8 3333.33 cop[tikv] gt(rcd.t.a, 1949-10-10 00:00:00.000000) + └─TableFullScan_7 10000.00 cop[tikv] table:t keep order:false, stats:pseudo explain select * from t where a > '2016-02-01' AND a < '20000103'; id estRows task access object operator info -TableReader_7 0.00 root partition:dual data:Selection_6 -└─Selection_6 0.00 cop[tikv] gt(rcd.t.a, 2016-02-01 00:00:00.000000), lt(rcd.t.a, 2000-01-03 00:00:00.000000) - └─TableFullScan_5 7.00 cop[tikv] table:t keep order:false +Projection_5 0.00 root rcd.t.a +└─UnionScan_6 0.00 root gt(rcd.t.a, 2016-02-01 00:00:00.000000), lt(rcd.t.a, 2000-01-03 00:00:00.000000) + └─TableReader_9 0.00 root partition:dual data:Selection_8 + └─Selection_8 0.00 cop[tikv] gt(rcd.t.a, 2016-02-01 00:00:00.000000), lt(rcd.t.a, 2000-01-03 00:00:00.000000) + └─TableFullScan_7 10000.00 cop[tikv] table:t keep order:false, stats:pseudo explain select * from t where a < '19691112' or a >= '2019-09-18'; id estRows task access object operator info -TableReader_7 1.00 root partition:p0,p5,p6 data:Selection_6 -└─Selection_6 1.00 cop[tikv] or(lt(rcd.t.a, 1969-11-12 00:00:00.000000), ge(rcd.t.a, 2019-09-18 00:00:00.000000)) - └─TableFullScan_5 7.00 cop[tikv] table:t keep order:false +Projection_5 6656.67 root rcd.t.a +└─UnionScan_6 6656.67 root or(lt(rcd.t.a, 1969-11-12 00:00:00.000000), ge(rcd.t.a, 2019-09-18 00:00:00.000000)) + └─TableReader_9 6656.67 root partition:p0,p5,p6 data:Selection_8 + └─Selection_8 6656.67 cop[tikv] or(lt(rcd.t.a, 1969-11-12 00:00:00.000000), ge(rcd.t.a, 2019-09-18 00:00:00.000000)) + └─TableFullScan_7 10000.00 cop[tikv] table:t keep order:false, stats:pseudo explain select * from t where a is null; id estRows task access object operator info -TableReader_7 0.00 root partition:p0 data:Selection_6 -└─Selection_6 0.00 cop[tikv] isnull(rcd.t.a) - └─TableFullScan_5 7.00 cop[tikv] table:t keep order:false +Projection_5 10.00 root rcd.t.a +└─UnionScan_6 10.00 root isnull(rcd.t.a) + └─TableReader_9 10.00 root partition:p0 data:Selection_8 + └─Selection_8 10.00 cop[tikv] isnull(rcd.t.a) + └─TableFullScan_7 10000.00 cop[tikv] table:t keep order:false, stats:pseudo explain select * from t where '2003-02-27' >= a; id estRows task access object operator info -TableReader_7 3.00 root partition:p0,p1,p2 data:Selection_6 -└─Selection_6 3.00 cop[tikv] ge(2003-02-27 00:00:00.000000, rcd.t.a) - └─TableFullScan_5 7.00 cop[tikv] table:t keep order:false +Projection_5 3323.33 root rcd.t.a +└─UnionScan_6 3323.33 root ge(2003-02-27 00:00:00.000000, rcd.t.a) + └─TableReader_9 3323.33 root partition:p0,p1,p2 data:Selection_8 + └─Selection_8 3323.33 cop[tikv] ge(2003-02-27 00:00:00.000000, rcd.t.a) + └─TableFullScan_7 10000.00 cop[tikv] table:t keep order:false, stats:pseudo explain select * from t where '20141024' < a; id estRows task access object operator info -TableReader_7 2.00 root partition:p4,p5,p6 data:Selection_6 -└─Selection_6 2.00 cop[tikv] lt(2014-10-24 00:00:00.000000, rcd.t.a) - └─TableFullScan_5 7.00 cop[tikv] table:t keep order:false +Projection_5 3333.33 root rcd.t.a +└─UnionScan_6 3333.33 root lt(2014-10-24 00:00:00.000000, rcd.t.a) + └─TableReader_9 3333.33 root partition:p4,p5,p6 data:Selection_8 + └─Selection_8 3333.33 cop[tikv] lt(2014-10-24 00:00:00.000000, rcd.t.a) + └─TableFullScan_7 10000.00 cop[tikv] table:t keep order:false, stats:pseudo explain select * from t where '2003-03-30' > a; id estRows task access object operator info -TableReader_7 3.00 root partition:p0,p1,p2 data:Selection_6 -└─Selection_6 3.00 cop[tikv] gt(2003-03-30 00:00:00.000000, rcd.t.a) - └─TableFullScan_5 7.00 cop[tikv] table:t keep order:false +Projection_5 3323.33 root rcd.t.a +└─UnionScan_6 3323.33 root gt(2003-03-30 00:00:00.000000, rcd.t.a) + └─TableReader_9 3323.33 root partition:p0,p1,p2 data:Selection_8 + └─Selection_8 3323.33 cop[tikv] gt(2003-03-30 00:00:00.000000, rcd.t.a) + └─TableFullScan_7 10000.00 cop[tikv] table:t keep order:false, stats:pseudo explain select * from t where a between '2003-03-30' AND '2014-01-01'; id estRows task access object operator info -TableReader_7 2.00 root partition:p2,p3,p4 data:Selection_6 -└─Selection_6 2.00 cop[tikv] ge(rcd.t.a, 2003-03-30 00:00:00.000000), le(rcd.t.a, 2014-01-01 00:00:00.000000) - └─TableFullScan_5 7.00 cop[tikv] table:t keep order:false +Projection_5 250.00 root rcd.t.a +└─UnionScan_6 250.00 root ge(rcd.t.a, 2003-03-30 00:00:00.000000), le(rcd.t.a, 2014-01-01 00:00:00.000000) + └─TableReader_9 250.00 root partition:p2,p3,p4 data:Selection_8 + └─Selection_8 250.00 cop[tikv] ge(rcd.t.a, 2003-03-30 00:00:00.000000), le(rcd.t.a, 2014-01-01 00:00:00.000000) + └─TableFullScan_7 10000.00 cop[tikv] table:t keep order:false, stats:pseudo drop database if exists rcd; create database rcd; use rcd; @@ -1227,9 +1293,11 @@ insert into t1 values ('a', NULL, 'd'); analyze table t1; explain format=brief select * from t1 where a = 'a' AND c = 'd'; id estRows task access object operator info -TableReader 1.00 root partition:p0,p1 data:Selection -└─Selection 1.00 cop[tikv] eq(rcd.t1.a, "a"), eq(rcd.t1.c, "d") - └─TableFullScan 1.00 cop[tikv] table:t1 keep order:false +Projection 0.01 root rcd.t1.a, rcd.t1.b, rcd.t1.c +└─UnionScan 0.01 root eq(rcd.t1.a, "a"), eq(rcd.t1.c, "d") + └─TableReader 0.01 root partition:p0,p1 data:Selection + └─Selection 0.01 cop[tikv] eq(rcd.t1.a, "a"), eq(rcd.t1.c, "d") + └─TableFullScan 10000.00 cop[tikv] table:t1 keep order:false, stats:pseudo select * from t1 where a = 'a' AND c = 'd'; a b c a NULL d diff --git a/tests/integrationtest/r/planner/core/issuetest/planner_issue.result b/tests/integrationtest/r/planner/core/issuetest/planner_issue.result index 2d5a07ac9072d..054e04292eaab 100644 --- a/tests/integrationtest/r/planner/core/issuetest/planner_issue.result +++ b/tests/integrationtest/r/planner/core/issuetest/planner_issue.result @@ -111,11 +111,12 @@ create table tbl_39(col_239 year(4) not null default '2009', primary key(col_239 insert into tbl_39 values (1994),(1995),(1996),(1997); explain select /*+ use_index_merge( tbl_39) */ col_239 from tbl_39 where not( tbl_39.col_239 not in ( '1994' ) ) and tbl_39.col_239 not in ( '2004' , '2010' , '2010' ) or not( tbl_39.col_239 <= '1996' ) and not( tbl_39.col_239 between '2026' and '2011' ) order by tbl_39.col_239 limit 382; id estRows task access object operator info -Limit_12 382.00 root offset:0, count:382 -└─IndexReader_39 382.00 root index:Limit_38 - └─Limit_38 382.00 cop[tikv] offset:0, count:382 - └─Selection_33 382.00 cop[tikv] or(and(eq(planner__core__issuetest__planner_issue.tbl_39.col_239, 1994), not(in(planner__core__issuetest__planner_issue.tbl_39.col_239, 2004, 2010, 2010))), and(gt(planner__core__issuetest__planner_issue.tbl_39.col_239, 1996), or(lt(cast(planner__core__issuetest__planner_issue.tbl_39.col_239, double UNSIGNED BINARY), 2026), gt(cast(planner__core__issuetest__planner_issue.tbl_39.col_239, double UNSIGNED BINARY), 2011)))) - └─IndexRangeScan_32 477.50 cop[tikv] table:tbl_39, index:PRIMARY(col_239) range:[1994,1994], (1996,+inf], keep order:true, stats:pseudo +Projection_8 382.00 root planner__core__issuetest__planner_issue.tbl_39.col_239 +└─Limit_15 382.00 root offset:0, count:382 + └─UnionScan_26 382.00 root or(and(not(not(eq(planner__core__issuetest__planner_issue.tbl_39.col_239, 1994))), not(in(planner__core__issuetest__planner_issue.tbl_39.col_239, 2004, 2010, 2010))), and(not(le(planner__core__issuetest__planner_issue.tbl_39.col_239, 1996)), not(and(ge(cast(planner__core__issuetest__planner_issue.tbl_39.col_239, double UNSIGNED BINARY), 2026), le(cast(planner__core__issuetest__planner_issue.tbl_39.col_239, double UNSIGNED BINARY), 2011))))) + └─IndexReader_29 382.00 root index:Selection_28 + └─Selection_28 382.00 cop[tikv] or(and(eq(planner__core__issuetest__planner_issue.tbl_39.col_239, 1994), not(in(planner__core__issuetest__planner_issue.tbl_39.col_239, 2004, 2010, 2010))), and(gt(planner__core__issuetest__planner_issue.tbl_39.col_239, 1996), or(lt(cast(planner__core__issuetest__planner_issue.tbl_39.col_239, double UNSIGNED BINARY), 2026), gt(cast(planner__core__issuetest__planner_issue.tbl_39.col_239, double UNSIGNED BINARY), 2011)))) + └─IndexRangeScan_27 477.50 cop[tikv] table:tbl_39, index:PRIMARY(col_239) range:[1994,1994], (1996,+inf], keep order:true, stats:pseudo select /*+ use_index_merge( tbl_39) */ col_239 from tbl_39 where not( tbl_39.col_239 not in ( '1994' ) ) and tbl_39.col_239 not in ( '2004' , '2010' , '2010' ) or not( tbl_39.col_239 <= '1996' ) and not( tbl_39.col_239 between '2026' and '2011' ) order by tbl_39.col_239 limit 382; col_239 1994 diff --git a/tests/integrationtest/r/planner/core/point_get_plan.result b/tests/integrationtest/r/planner/core/point_get_plan.result index 0a678a68f4fd7..13d2d97ba1985 100644 --- a/tests/integrationtest/r/planner/core/point_get_plan.result +++ b/tests/integrationtest/r/planner/core/point_get_plan.result @@ -24,7 +24,8 @@ StreamAgg 1.00 root funcs:count(planner__core__point_get_plan.t._tidb_rowid)->C explain format='brief' select *, date_format(b, "") from t where a =1 for update; id estRows task access object operator info Projection 1.00 root planner__core__point_get_plan.t.a, planner__core__point_get_plan.t.b, date_format(cast(planner__core__point_get_plan.t.b, datetime BINARY), )->Column#4 -└─Point_Get 1.00 root table:t, index:idx(a) lock +└─SelectLock 1.00 root for update 0 + └─Point_Get 1.00 root table:t, index:idx(a) create table t1 (pk int, a int, b int, primary key(pk), unique key(a)); explain format='brief' select t1.*, _tidb_rowid from t1 where a = 1; Error 1054 (42S22): Unknown column '_tidb_rowid' in 'field list' @@ -344,7 +345,7 @@ a b explain format = 'brief' update t set b = b + 1 where a in (1, 2, 3, 4); id estRows task access object operator info Update N/A root N/A -└─Batch_Point_Get 4.00 root table:t, partition:p0,p1,p2,p3 handle:[1 2 3 4], keep order:false, desc:false, lock +└─Batch_Point_Get 4.00 root table:t, partition:p0,p1,p2,p3 handle:[1 2 3 4], keep order:false, desc:false update t set b = b + 1 where a in (1, 2, 3, 4); select * from t where a in (1, 2, 3, 4); a b @@ -355,7 +356,7 @@ a b explain format = 'brief' delete from t where a in (1, 2, 3, 4); id estRows task access object operator info Delete N/A root N/A -└─Batch_Point_Get 4.00 root table:t, partition:p0,p1,p2,p3 handle:[1 2 3 4], keep order:false, desc:false, lock +└─Batch_Point_Get 4.00 root table:t, partition:p0,p1,p2,p3 handle:[1 2 3 4], keep order:false, desc:false delete from t where a in (1, 2, 3, 4); select * from t where a in (1, 2, 3, 4); a b @@ -377,7 +378,7 @@ a b c explain format = 'brief' update t set c = c + 1 where (a,b) in ((1,1),(2,2),(3,3),(4,4)); id estRows task access object operator info Update N/A root N/A -└─Batch_Point_Get 4.00 root table:t, partition:p0,p1,p2,p3, clustered index:PRIMARY(a, b) keep order:false, desc:false, lock +└─Batch_Point_Get 4.00 root table:t, partition:p0,p1,p2,p3, clustered index:PRIMARY(a, b) keep order:false, desc:false update t set c = c + 1 where (a,b) in ((1,1),(2,2),(3,3),(4,4)); select * from t where (a, b) in ((1, 1), (2, 2), (3, 3), (4, 4)); a b c @@ -388,7 +389,7 @@ a b c explain format = 'brief' delete from t where (a,b) in ((1,1),(2,2),(3,3),(4,4)); id estRows task access object operator info Delete N/A root N/A -└─Batch_Point_Get 4.00 root table:t, partition:p0,p1,p2,p3, clustered index:PRIMARY(a, b) keep order:false, desc:false, lock +└─Batch_Point_Get 4.00 root table:t, partition:p0,p1,p2,p3, clustered index:PRIMARY(a, b) keep order:false, desc:false delete from t where (a,b) in ((1,1),(2,2),(3,3),(4,4)); select * from t where (a, b) in ((1, 1), (2, 2), (3, 3), (4, 4)); a b c diff --git a/tests/integrationtest/r/planner/core/rule_result_reorder.result b/tests/integrationtest/r/planner/core/rule_result_reorder.result index 9bf9bba5085c0..24cefea1ff4c7 100644 --- a/tests/integrationtest/r/planner/core/rule_result_reorder.result +++ b/tests/integrationtest/r/planner/core/rule_result_reorder.result @@ -13,7 +13,7 @@ execute s1 using @a; a b c d select @@last_plan_from_cache; @@last_plan_from_cache -0 +1 set tidb_enable_prepared_plan_cache=DEFAULT; set tidb_enable_ordered_result_mode=DEFAULT; set tidb_enable_ordered_result_mode=1; diff --git a/tests/integrationtest/r/planner/core/tests/prepare/issue.result b/tests/integrationtest/r/planner/core/tests/prepare/issue.result index f68e848bccdaf..34c3af078411e 100644 --- a/tests/integrationtest/r/planner/core/tests/prepare/issue.result +++ b/tests/integrationtest/r/planner/core/tests/prepare/issue.result @@ -18,7 +18,7 @@ COL1 COL2 COL3 COL4 OÛ ›BÙ™¬0¶©ÀLJû „F Êt -836:46:08 735655453 select @@last_plan_from_cache; @@last_plan_from_cache -0 +1 select * from UK_MU15569 where col2 >= -27225 and col1 is not null and col3 = '-836:46:08'; COL1 COL2 COL3 COL4 OÛ ›BÙ™¬0¶©ÀLJû „F Êt -836:46:08 735655453 @@ -42,7 +42,7 @@ COL1 COL2 COL3 bb -16994 1987 select @@last_plan_from_cache; @@last_plan_from_cache -0 +1 set tidb_enable_prepared_plan_cache=1; drop table if exists PK_MULTI_COL_360; CREATE TABLE PK_MULTI_COL_360 ( @@ -189,7 +189,7 @@ execute stmt using @a; a b c a b select @@last_plan_from_cache; @@last_plan_from_cache -0 +1 prepare stmt from 'select /*+ INL_JOIN(t1,t2) */ * from t1, t2 where t1.a=t2.a and t1.c=?'; set @a=1; execute stmt using @a; @@ -198,7 +198,7 @@ execute stmt using @a; a b c a b select @@last_plan_from_cache; @@last_plan_from_cache -0 +1 set tidb_enable_prepared_plan_cache=1; drop table if exists PK_SIGNED_10094; CREATE TABLE PK_SIGNED_10094 (COL1 decimal(55,0) NOT NULL, PRIMARY KEY (COL1)); @@ -219,7 +219,7 @@ execute stmt using @a,@b; COL1 select @@last_plan_from_cache; @@last_plan_from_cache -0 +1 set tidb_enable_prepared_plan_cache=1; drop table if exists PK_S_MULTI_37; CREATE TABLE PK_S_MULTI_37 (COL1 decimal(55,0) NOT NULL, COL2 decimal(55,0) NOT NULL,PRIMARY KEY (COL1, COL2) /*T![clustered_index] NONCLUSTERED */) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin; @@ -302,7 +302,7 @@ count(distinct col1) 0 select @@last_plan_from_cache; @@last_plan_from_cache -0 +1 prepare stmt from 'select/*+ hash_agg() */ count(distinct col1) from PK_TCOLLATION10197 where col1 > ?;'; execute stmt using @b; count(distinct col1) @@ -325,7 +325,7 @@ col1 b select @@last_plan_from_cache; @@last_plan_from_cache -0 +1 execute stmt using @z; col1 select @@last_plan_from_cache; @@ -345,7 +345,7 @@ execute stmt using @b; col1 select @@last_plan_from_cache; @@last_plan_from_cache -0 +1 execute stmt using @z; col1 select @@last_plan_from_cache; @@ -367,7 +367,7 @@ col1 b select @@last_plan_from_cache; @@last_plan_from_cache -0 +1 execute stmt using @z; col1 select @@last_plan_from_cache; @@ -387,7 +387,7 @@ execute stmt using @b; col1 select @@last_plan_from_cache; @@last_plan_from_cache -0 +1 execute stmt using @z; col1 select @@last_plan_from_cache; @@ -406,7 +406,7 @@ execute stmt; col1 col2 col1 col2 select @@last_plan_from_cache; @@last_plan_from_cache -0 +1 prepare stmt from 'SELECT * FROM t t1 JOIN t t2 ON t1.col1 = t2.col1 WHERE t1.col1 <=> NULL and t2.col2 > ?'; set @a=0; execute stmt using @a; @@ -415,7 +415,7 @@ execute stmt using @a; col1 col2 col1 col2 select @@last_plan_from_cache; @@last_plan_from_cache -0 +1 drop table if exists t4; create table t4 (a date); prepare st1 from "insert into t4(a) select dt from (select ? as dt from dual union all select sysdate() ) a"; diff --git a/tests/integrationtest/r/planner/core/tests/prepare/prepare.result b/tests/integrationtest/r/planner/core/tests/prepare/prepare.result index 8cad62622da3d..c07f168b5ed65 100644 --- a/tests/integrationtest/r/planner/core/tests/prepare/prepare.result +++ b/tests/integrationtest/r/planner/core/tests/prepare/prepare.result @@ -31,7 +31,7 @@ execute stmt; a select @@last_plan_from_cache; @@last_plan_from_cache -0 +1 deallocate prepare stmt; prepare stmt from 'select * from t'; execute stmt; @@ -50,14 +50,14 @@ execute stmt; a select @@last_plan_from_cache; @@last_plan_from_cache -0 +1 deallocate prepare stmt; prepare stmt from 'select * from t'; execute stmt; a select @@last_plan_from_cache; @@last_plan_from_cache -0 +1 set tidb_enable_prepared_plan_cache=1; drop table if exists t1; drop table if exists t2; @@ -70,7 +70,7 @@ execute stmt1; id a b id a b select @@last_plan_from_cache; @@last_plan_from_cache -0 +1 prepare stmt2 from 'SELECT * from t1'; execute stmt2; id a b @@ -78,7 +78,7 @@ execute stmt2; id a b select @@last_plan_from_cache; @@last_plan_from_cache -0 +1 prepare stmt3 from 'SELECT * from t1 where id = 1'; execute stmt3; id a b @@ -86,7 +86,7 @@ execute stmt3; id a b select @@last_plan_from_cache; @@last_plan_from_cache -0 +1 admin flush session plan_cache; execute stmt1; @@ -108,32 +108,32 @@ execute stmt1; id a b id a b select @@last_plan_from_cache; @@last_plan_from_cache -0 +1 execute stmt2; id a b select @@last_plan_from_cache; @@last_plan_from_cache -0 +1 execute stmt3; id a b select @@last_plan_from_cache; @@last_plan_from_cache -0 +1 execute stmt1; id a b id a b select @@last_plan_from_cache; @@last_plan_from_cache -0 +1 execute stmt2; id a b select @@last_plan_from_cache; @@last_plan_from_cache -0 +1 execute stmt3; id a b select @@last_plan_from_cache; @@last_plan_from_cache -0 +1 admin flush global plan_cache; Error 1105 (HY000): Do not support the 'admin flush global scope.' set tidb_enable_prepared_plan_cache=0; @@ -169,6 +169,7 @@ admin flush session plan_cache; show warnings; Level Code Message +Warning 1105 The plan cache is disable. So there no need to flush the plan cache execute stmt1; id a b id a b select @@last_plan_from_cache; @@ -243,7 +244,7 @@ execute s using @x; a select @@last_plan_from_cache; @@last_plan_from_cache -0 +1 set character_set_connection=latin1; set @x='c'; execute s using @x; @@ -256,7 +257,7 @@ execute s using @x; a select @@last_plan_from_cache; @@last_plan_from_cache -0 +1 set collation_connection=binary; set @x='e'; execute s using @x; @@ -269,7 +270,7 @@ execute s using @x; a select @@last_plan_from_cache; @@last_plan_from_cache -0 +1 set tidb_enable_prepared_plan_cache=1; drop table if exists t1; create table t1 ( @@ -315,7 +316,7 @@ execute stmt1 using @a; select @@last_plan_from_cache; @@last_plan_from_cache -0 +1 select * from t2 order by a; a b 1 1 @@ -325,7 +326,7 @@ execute stmt1 using @a; select @@last_plan_from_cache; @@last_plan_from_cache -0 +1 select * from t2 order by a; a b 1 1 @@ -505,7 +506,7 @@ id 1 select @@last_plan_from_cache; @@last_plan_from_cache -0 +1 execute stmt2 using @doma; id 1 @@ -517,7 +518,7 @@ id 1 select @@last_plan_from_cache; @@last_plan_from_cache -0 +1 select * from t where id=1; id 1 @@ -539,7 +540,7 @@ execute stmt using @p; a select @@last_plan_from_cache; @@last_plan_from_cache -0 +1 set @p = 18446744073709551615; execute stmt using @p; a @@ -561,7 +562,7 @@ pk 1 select @@last_plan_from_cache; @@last_plan_from_cache -0 +1 execute stmt using @a3; pk 1 @@ -570,7 +571,7 @@ pk 1 select @@last_plan_from_cache; @@last_plan_from_cache -0 +1 execute stmt using @a0; pk select @@last_plan_from_cache; @@ -584,7 +585,7 @@ pk 1 select @@last_plan_from_cache; @@last_plan_from_cache -0 +1 execute stmt using @a1; pk select @@last_plan_from_cache; @@ -603,7 +604,7 @@ pk 1 select @@last_plan_from_cache; @@last_plan_from_cache -0 +1 execute stmt using @a3; pk 1 @@ -612,7 +613,7 @@ pk 1 select @@last_plan_from_cache; @@last_plan_from_cache -0 +1 execute stmt using @a0; pk select @@last_plan_from_cache; @@ -626,7 +627,7 @@ pk 1 select @@last_plan_from_cache; @@last_plan_from_cache -0 +1 execute stmt using @a1; pk select @@last_plan_from_cache; @@ -646,7 +647,7 @@ a b 1 7 select @@last_plan_from_cache; @@last_plan_from_cache -0 +1 drop table if exists t; create table t(pk int primary key); insert into t values (1), (2), (3), (4), (5); @@ -664,14 +665,14 @@ pk 3 select @@last_plan_from_cache; @@last_plan_from_cache -0 +1 execute stmt using @a0, @a4; pk 1 4 select @@last_plan_from_cache; @@last_plan_from_cache -0 +1 execute stmt using @a1_1, @a5; pk 1 @@ -696,14 +697,14 @@ pk 3 select @@last_plan_from_cache; @@last_plan_from_cache -0 +1 execute stmt using @a0, @a4; pk 1 4 select @@last_plan_from_cache; @@last_plan_from_cache -0 +1 execute stmt using @a1_1, @a5; pk 1 @@ -842,7 +843,7 @@ c1 c2 c3 2 1 1 select @@last_plan_from_cache; @@last_plan_from_cache -0 +1 create table t4(c1 int primary key, c2 int, c3 int, key(c2)); insert into t4 values(2,1,1); prepare s4 from 'select /*+ use_index_merge(t4) */ * from t4 where (c1 >= ? and c1 <= ?) or c2 > 1'; @@ -864,7 +865,7 @@ execute s4 using @b4,@a4; c1 c2 c3 select @@last_plan_from_cache; @@last_plan_from_cache -0 +1 execute s4 using @a4,@b4; c1 c2 c3 2 1 1 diff --git a/tests/integrationtest/r/privilege/privileges.result b/tests/integrationtest/r/privilege/privileges.result index 4b6ba908d1934..c590c5d31ab1c 100644 --- a/tests/integrationtest/r/privilege/privileges.result +++ b/tests/integrationtest/r/privilege/privileges.result @@ -192,29 +192,30 @@ GRANT INSERT ON privilege__privileges.* TO 'tester'@'localhost'; GRANT DROP ON privilege__privileges.* TO 'tester'@'localhost'; alter table pt exchange partition p0 with table nt; CREATE USER 'test_import_into'@'localhost'; +GRANT SELECT ON privilege__privileges.* TO 'test_import_into'@'localhost'; CREATE TABLE IF NOT EXISTS t(a int); IMPORT INTO t FROM '/file.csv'; -Error 1105 (HY000): cannot run IMPORT INTO in explicit transaction +Error 1142 (42000): UPDATE command denied to user 'test_import_into'@'localhost' for table 't' GRANT SELECT on *.* to 'test_import_into'@'localhost'; IMPORT INTO t FROM '/file.csv'; -Error 1105 (HY000): cannot run IMPORT INTO in explicit transaction +Error 1142 (42000): UPDATE command denied to user 'test_import_into'@'localhost' for table 't' GRANT UPDATE on *.* to 'test_import_into'@'localhost'; IMPORT INTO t FROM '/file.csv'; -Error 1105 (HY000): cannot run IMPORT INTO in explicit transaction +Error 1142 (42000): INSERT command denied to user 'test_import_into'@'localhost' for table 't' GRANT INSERT on *.* to 'test_import_into'@'localhost'; IMPORT INTO t FROM '/file.csv'; -Error 1105 (HY000): cannot run IMPORT INTO in explicit transaction +Error 1142 (42000): DELETE command denied to user 'test_import_into'@'localhost' for table 't' GRANT DELETE on *.* to 'test_import_into'@'localhost'; IMPORT INTO t FROM '/file.csv'; -Error 1105 (HY000): cannot run IMPORT INTO in explicit transaction +Error 1142 (42000): ALTER command denied to user 'test_import_into'@'localhost' for table 't' GRANT ALTER on *.* to 'test_import_into'@'localhost'; IMPORT INTO t FROM '/file.csv'; -Error 1105 (HY000): cannot run IMPORT INTO in explicit transaction +Error 1227 (42000): Access denied; you need (at least one of) the FILE privilege(s) for this operation DROP USER 'test_import_into'@'localhost'; CREATE USER 'test_import_into'@'localhost'; GRANT FILE on *.* to 'test_import_into'@'localhost'; IMPORT INTO t FROM '/file.csv'; -Error 1105 (HY000): cannot run IMPORT INTO in explicit transaction +Error 1142 (42000): SELECT command denied to user 'test_import_into'@'localhost' for table 't' drop table if exists t; create user u1; create table t (a int); diff --git a/tests/integrationtest/r/session/clustered_index.result b/tests/integrationtest/r/session/clustered_index.result index d85017ffde861..440d8c470defc 100644 --- a/tests/integrationtest/r/session/clustered_index.result +++ b/tests/integrationtest/r/session/clustered_index.result @@ -208,7 +208,7 @@ select group_concat(name order by name separator '.') from t use index(idx); group_concat(name order by name separator '.') aaa.bbb update t set name = 'aaaaa' where name = 'bbb'; -Error 1062 (23000): Duplicate entry 'aa' for key 't.PRIMARY' +Error 1062 (23000): Duplicate entry 'aaaaa' for key 't.PRIMARY' update ignore t set name = 'aaaaa' where name = 'bbb'; Level Code Message Warning 1062 Duplicate entry 'aaaaa' for key 't.PRIMARY' diff --git a/tests/integrationtest/r/session/vars.result b/tests/integrationtest/r/session/vars.result index 3e74c48ab2305..2ca02bf518e95 100644 --- a/tests/integrationtest/r/session/vars.result +++ b/tests/integrationtest/r/session/vars.result @@ -348,7 +348,7 @@ SELECT /*+ SET_VAR(group_concat_max_len = 1024) SET_VAR(group_concat_max_len = 2 1 select @@warning_count; @@warning_count -0 +1 select @@session.warning_count; @@session.warning_count 0 diff --git a/tests/integrationtest/r/sessionctx/setvar.result b/tests/integrationtest/r/sessionctx/setvar.result index ae3db79da1a6f..4c5014ba8838a 100644 --- a/tests/integrationtest/r/sessionctx/setvar.result +++ b/tests/integrationtest/r/sessionctx/setvar.result @@ -166,7 +166,7 @@ SELECT * FROM t WHERE b < 5 AND a = 2; a b select @@last_plan_from_cache; @@last_plan_from_cache -0 +1 SELECT /*+ SET_VAR(tidb_distsql_scan_concurrency=10) */ * FROM t WHERE b < 5 AND a = 2; a b select @@last_plan_from_cache; @@ -176,7 +176,7 @@ SELECT * FROM t WHERE b < 5 AND a = 2; a b select @@last_plan_from_cache; @@last_plan_from_cache -0 +1 select /*+ set_var(tidb_opt_agg_push_down=0) */ @@tidb_opt_agg_push_down; @@tidb_opt_agg_push_down 0 diff --git a/tests/integrationtest/run-tests.sh b/tests/integrationtest/run-tests.sh index 3c0fa43672cf7..40e05b91cab38 100755 --- a/tests/integrationtest/run-tests.sh +++ b/tests/integrationtest/run-tests.sh @@ -88,7 +88,7 @@ function build_mysql_tester() { echo "building mysql-tester binary: $mysql_tester" rm -rf $mysql_tester - GOBIN=$PWD go install github.com/pingcap/mysql-tester/src@da61c204fac56696f171298126b40c9277119223 + GOBIN=$PWD go install github.com/pingcap/mysql-tester/src@f3b554899a0cb24a3b387f7d45de2687098577c3 mv src mysql_tester } diff --git a/tests/integrationtest/t/planner/core/integration.test b/tests/integrationtest/t/planner/core/integration.test index 98f5fb3c53c3b..4b4cfb8403efd 100644 --- a/tests/integrationtest/t/planner/core/integration.test +++ b/tests/integrationtest/t/planner/core/integration.test @@ -172,6 +172,7 @@ create table strrange(a varchar(10) charset utf8mb4 collate utf8mb4_general_ci, insert into strrange values ('a', 1), ('A', 1), ('y', 1), ('Y', 1), ('q', 1); --sorted_result select * from strrange where a in ('a', 'y'); +## need to run with collation enabled. create table strlist(a varchar(10) charset utf8mb4 collate utf8mb4_general_ci, b int) partition by list columns (a) ( partition p0 values in ('a', 'b'), partition p1 values in ('c', 'd'), @@ -2024,14 +2025,6 @@ drop table if exists t; CREATE TABLE t(col1 enum('p5', '9a33x') NOT NULL DEFAULT 'p5',col2 tinyblob DEFAULT NULL) ENGINE = InnoDB DEFAULT CHARSET = latin1 COLLATE = latin1_bin; (select last_value(col1) over () as r0 from t) union all (select col2 as r0 from t); - -# TestIssue41458 -drop table if exists t; -create table t (a int, b int, c int, index ia(a)); -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; -select plan from information_schema.statements_summary where SCHEMA_NAME = 'test' and STMT_TYPE = 'Select'; - - # TestIssue43116 CREATE TABLE `sbtest1` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, `k` int(11) NOT NULL DEFAULT '0', `c` char(120) NOT NULL DEFAULT '', `pad` char(60) NOT NULL DEFAULT '', PRIMARY KEY (`id`) /*T![clustered_index] CLUSTERED */ , KEY `k_1` (`k`) ); set @@tidb_opt_range_max_size = 111; diff --git a/tests/integrationtest/t/planner/core/integration_partition.test b/tests/integrationtest/t/planner/core/integration_partition.test index b59b2d07a223d..40d0afa5d403a 100644 --- a/tests/integrationtest/t/planner/core/integration_partition.test +++ b/tests/integrationtest/t/planner/core/integration_partition.test @@ -603,15 +603,10 @@ select * from t where a = 10 and b = "2022-01-01" and c < "Wow"; select * from t where a = 10 and b = "2022-01-01" and c > "Wow"; --sorted_result select * from t where a = 10 and b = "2022-01-01" and c >= "Wow"; ---sorted_result explain format = 'brief' select * from t where a = 10 and b = "2022-01-01" and c = "Wow"; ---sorted_result explain format = 'brief' select * from t where a = 10 and b = "2022-01-01" and c <= "Wow"; ---sorted_result explain format = 'brief' select * from t where a = 10 and b = "2022-01-01" and c < "Wow"; ---sorted_result explain format = 'brief' select * from t where a = 10 and b = "2022-01-01" and c > "Wow"; ---sorted_result explain format = 'brief' select * from t where a = 10 and b = "2022-01-01" and c >= "Wow"; --sorted_result select * from t where a <= 10 and b <= '2022-01-01' and c < "Wow"; @@ -619,7 +614,6 @@ select * from t where a <= 10 and b <= '2022-01-01' and c < "Wow"; select * from t where a = 10 and b = "2022-01-01" and c = "Wow"; --sorted_result select * from t where a <= 10 and b <= '2022-01-01' and c <= "Wow"; ---sorted_result explain format = 'brief' select * from t where a <= 10 and b <= '2022-01-01' and c < "Wow"; --sorted_result select * from t where a <= 11 and b <= '2022-01-01' and c < "Wow"; diff --git a/tests/integrationtest/t/privilege/privileges.test b/tests/integrationtest/t/privilege/privileges.test index ff8857c057b23..be44bb6d3b632 100644 --- a/tests/integrationtest/t/privilege/privileges.test +++ b/tests/integrationtest/t/privilege/privileges.test @@ -293,8 +293,9 @@ connection default; # TestImportIntoPrivilegeNegativeCase CREATE USER 'test_import_into'@'localhost'; +GRANT SELECT ON privilege__privileges.* TO 'test_import_into'@'localhost'; CREATE TABLE IF NOT EXISTS t(a int); -connect (test_import_into,localhost,test_import_into,,); +connect (test_import_into,localhost,test_import_into,,privilege__privileges); connection test_import_into; --error ErrTableaccessDenied IMPORT INTO t FROM '/file.csv';