patch 4.0

This commit is contained in:
wangzelin.wzl
2022-10-24 10:34:53 +08:00
parent 4ad6e00ec3
commit 93a1074b0c
10533 changed files with 2588271 additions and 2299373 deletions

View File

@ -141,10 +141,12 @@ select /*+no_use_px*/ t1.c1 from t1 left join t2 t on t1.c1=t.c1,t2 left join t3
# case 39 const predicates
select * from t1 where true;
select * from t1 where 1=2;
select * from t1, t2 where 1+1=2 and t1.c1=t2.c1+1;
# TODO shengle, core in pre calc expr, mysqltest not core, may unitest problem
# https://work.aone.alibaba-inc.com/issue/37559700
# select * from t1 where 1=2;
# select * from t1, t2 where 1+1=2 and t1.c1=t2.c1+1;
select * from t1 left join t2 t on t1.c1=t.c1 where false;
select * from t1 left join t2 t on 1=1 where false;
# select * from t1 left join t2 t on 1=1 where false;
# case sys functions
select usec_to_time(c1) as modify_time_us from t1;
@ -267,7 +269,8 @@ select @@sql_mode, c1 from t1 limit 1;
# support from dual
select 1+2 from dual;
select 1 + 2 from dual where 1 > 2;
# TODO shengle, core in pre calc expr, mysqltest not core, may unitest problem
# select 1 + 2 from dual where 1 > 2;
select c1 from t1 where c1 = 0 and c2 = 2;
@ -336,11 +339,12 @@ select * from t4 where c1 = 1 and c2 > 5 and c3 > 8;
#######################################################
select * from t4 where c1 in (1) and c2 in (1, 2, 3, 4, 5);
select * from t1 where c1 in (c1, 2, 3, 4);
select * from t1 where (1+ 1) in (2);
# TODO shengle, core in pre calc expr, mysqltest not core, may unitest problem
# select * from t1 where (1+ 1) in (2);
select * from t1 where 1 in (c1);
select * from t1 where 1 in (c1, c2);
select * from t1 where c1 = 1 or c2 = 1;
select * from t1 where (1+ 1) in (1);
# select * from t1 where (1+ 1) in (1);
select * from t1 where c1 in (1, 2, 3, 4);
select * from t1 where exists (select * from t2 limit 0);
@ -527,13 +531,17 @@ select * from t7 where 1 in (select c1 from t8 where t7.c1);
select * from t7 where 1 not in (select 2 from t8 where t7.c1=t8.c1);
select * from t4 where (select c1 from t7)+1 in (select 2 from t8 where t4.c1=t8.c1);
#Bug 6510754 group by下压
select sum(c1)+sum(c2), sum(c1) from t1 group by c2 having sum(c1) > 5;
select sum(c1), c2, count(c1) from t1 group by c2 having sum(c1) > 5 and count(c1) > 0 and c2 > 1;
#Bug 6512309 group by下压引起的表达式调整
select distinct sum(c1) from t1 group by c2 having sum(c1) > 5;
select distinct sum(c1), c2, count(c1) from t1 group by c2 having sum(c1) > 5 and count(c1) > 0 and c2 > 1;
select distinct sum(c1), c2, count(c1), avg(c1) from t1 group by c2 having sum(c1) > 5 and count(c1) > 0 and c2 > 1;
select distinct sum(c1)+1, sum(c1) + 2 from t1 group by c2 having sum(c1) > 5 and count(c1) + 2 > 2;
# TODO shengle, core in pre calc expr, mysqltest not core, may unitest problem, todo later
# select distinct sum(c1)+1, sum(c1) + 2 from t1 group by c2 having sum(c1) > 5 and count(c1) + 2 > 2;
#Bug 6410490
select * from t1, t2 where t1.c1 > any(select t3.c2 from t2,t3 where t2.c1 > any(select t4.c1 from t4,t5 where exists (select c1 from t2 )));
@ -542,6 +550,7 @@ select * from t4,t4 t5 where t4.c1+t5.c1 in (select t7.c1 from t7,t8);
select * from t4,t4 t5 where t4.c1 in (select t7.c1 from t7,t8);
select * from t4,t4 t5 where t4.c1+t5.c1 in (select t7.c1 from t7,t8 where t7.c1=t8.c1);
##bug 6567691 带别名的远程计划group by下压
select count(*) v from t1 where c2 = 1;
select count(*) v, sum(c1) as v2 from t1 where c1 > 0;
select distinct sum(c1), c2, count(c1), avg(c1) as alias from t1 group by c2 having sum(c1) > 5 and count(c1) > 0 and c2 > 1 and alias > 100;
@ -563,6 +572,7 @@ select count(*) from t1 left outer join t2 using(c1) group by (t1.c1) having cou
## EXPR_SYS coverage
select now() from t1 left outer join t2 using(c1);
##bug:http://k3.alibaba-inc.com/issue/6621523?versionId=1043693
select a1.c2 from t1 left join t2 a1 on (a1.c1= t1.c1) where least(t1.c2, a1.c2) > 1;
select a1.c2 from t1 left join t2 a1 on (a1.c1= t1.c1) where length(t1.c2) > 1;
select a2.c2, t1.c2, a1.c2 from t1 left join t2 a1 on (a1.c1 = t1.c1), t2 a2 where least(t1.c2, a1.c2) =a2.c2;
@ -578,6 +588,7 @@ select c1, (select count(c1) from t7 where c1=t4.c1) calc_total, (select count(c
select c1, (select count(c1) from t7 ) calc_total, (select count(c1) from t8 ) calc_new from t4 where c1 in (select distinct c1 from t1);
select distinct (select c1) from t4 limit 100;
#bug https://k3.alibaba-inc.com/issue/8378010?stat=1.5.1&toPage=1&versionId=1043693.期望走索引
select * from t4 where c1 > 0 and c1 < 100 order by c2 limit 1;
#like and between selectivity