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

@ -1,22 +1,27 @@
######################## test for hierarchical query #######################################
#### test for from item ###
## 一基表 #
#select t1.c1 from t1 connect by prior t1.c1 = c2;
#
## 两张基表 #
#select t1.c1 from t1, t2 connect by prior t1.c1 = t2.c1;
#select t1.c1 from t1 join t2 connect by prior t1.c1 = t2.c1;
#select t1.c1 from t1 left join t2 on t1.c1 = t2.c1 connect by prior t1.c1 = t2.c1;
#select t1.c1 from t1 right join t2 on t1.c1 = t2.c1 connect by prior t1.c1 = t2.c1;
#
## 一个基表,一个view #
#select c1 from (select * from t1) as tt connect by prior c1 = c2;
#select tt.c1 from (select * from t1) as tt , t2 connect by prior tt.c1 = t2.c2;
#select tt.c1 from (select * from t1) as tt join t2 on tt.c1 = t2.c1 connect by prior tt.c1 = t2.c2;
#select tt.c1 from (select * from t1) as tt left join t2 on tt.c1 = t2.c1 connect by prior tt.c1 = t2.c2;
#select tt.c1 from (select * from t1) as tt right join t2 on tt.c1 = t2.c1 connect by prior tt.c1 = t2.c2;
#
## 三个表 #
#select t1.c1 from t1, t2, t3 connect by prior t1.c1 = t2.c1;
#select t1.c1 from (t1 join t2 on t1.c1 = t2. c1) , t3 connect by prior t1.c1 = t2.c1;
#select t1.c1 from (t1 join t2 on t1.c1 = t2. c1) join t3 on t2.c3 = t3.c3 connect by prior t1.c1 = t2.c1;
#
## 四个表 #
#select t1.c1 from t1, t2, t3, t4 connect by prior t1.c1 = t2.c1;
#select t1.c1 from t1 join t2 on t1.c1 = t2.c1, t3, t4 connect by prior t1.c1 = t2.c1;
#select t1.c1 from t1 join t2 on t1.c1 = t2.c1, t3 join t4 on t3.c3 = t4.c3 connect by prior t1.c1 = t2.c1;
@ -26,6 +31,7 @@
#
#### test for rewrite start with filter column expr ###
#
## 单表 #
#
#select t1.c1 from t1 start with t1.c1 connect by prior 1 = 1;
#select t1.c1 from t1 start with t1.c1 = 1 connect by prior 1 = 1;
@ -35,10 +41,12 @@
#select t1.c1 from t1 start with c1 + c2 = 1 connect by prior t1.c1 = c2;
#select t1.c1 from t1 start with c1 > (select c2 from t3) connect by prior t1.c1 = c2;
#select t1.c1 from t1 start with c1 > (select c2 from t3) + c2 connect by prior t1.c1 = c2;
### 暂时不支持相关子查询!!! ###
### select t1.c1 from t1 start with c1 > (select c2 from t3 where t3.c3 > t1.c1) connect by prior t1.c1 = c2;
### select t1.c1 from t1 start with c1 > (select c2 from t3 where t1.c1) connect by prior t1.c1 = c2;
### select t1.c1 from t1 start with c1 > (select c2 from (select * from t3 where t3.c3 > t1.c1) as tt) connect by prior t1.c1 = c2;
#
## 多表 #
#select t1.c1 from t1 join t2 start with t1.c1 + t2.c2 = 1 connect by prior t1.c1 = t1.c2;
### select t1.c1 from t1 join t2 start with t1.c1 > (select c2 from t3 where t3.c2 > t2.c2) connect by prior t1.c1 = t1.c2;
#
@ -50,6 +58,7 @@
#
#### test for rewrite prior expr ###
#
## 测试对不同位置表达处理 #
#select t1.c1 from t1 start with t1.c1 connect by prior c1 = c2;
#select prior c2 from t1 start with t1.c1 connect by prior 1 = 1;
#select prior c2 from t1 where prior c2 > 1 start with t1.c1 connect by prior 1 = 1;
@ -60,7 +69,9 @@
###select max(c1) from t1 start with t1.c1 connect by prior 1 = 1 group by c1 having prior c2;
###select c1 from t1 start with t1.c1 connect by prior 1 = 1 order by prior c2;
#
## 测试prior const expr #
#select prior 1 from t1 start with t1.c1 connect by prior 1 = 1;
## 测试subquery #
### select c2 from t1 where c1 > (select c1 from t2 where prior t1.c1 > t2.c2 ) start with t1.c1 connect by prior 1 = 1;
### select c2 from t1 where c1 > (select c1 from t2 where prior t1.c1) start with t1.c1 connect by prior 1 = 1;
### select c2 from t1 where c1 > (select c1 from (select * from t2 where prior t1.c1 > t2.c2 ) as tt) start with t1.c1 connect by prior 1 = 1;
@ -72,6 +83,7 @@
#
## alias table #
#
## 测试copy origin prior expr #
#select prior (c1 + c2) from t1 start with t1.c1 connect by prior c1 = c2;
#select prior (abs(c1) + c2) from t1 start with t1.c1 connect by prior c1 = c2;
#select prior ((abs(c1) + c2) * 3) from t1 start with t1.c1 connect by prior c1 = c2;
@ -81,6 +93,7 @@
#select c1 from st1 connect by prior c1 = c2;
#select c1,level, connect_by_isleaf, connect_by_iscycle, connect_by_root c1, sys_connect_by_path(c1, '|') from st1 connect by nocycle prior c1 = c2;
# distinct消除冗余表
select distinct a from pjt1,pjt2;
select distinct c from pjt1,pjt2,pjt3;
select distinct a,d,g from pjt1,pjt2,pjt3,pjt4;
@ -124,6 +137,7 @@ select max(a+c) from pjt1, pjt2;
select distinct a, e from ((select a from pjt1) union (select c from pjt2)), pjt3;
select distinct a from pjt3, pjt1 join pjt2 on b=d;
# 测试 order by 非 UNIQUE KEY 的消除
## test on pk
select sum(c1) from t1 group by c1, c2;
select sum(c1) from t1 group by c2, c1;