From ecdd0726355ea639e978a478e6bafab23087a721 Mon Sep 17 00:00:00 2001 From: feiniaofeiafei Date: Wed, 30 Oct 2024 20:18:14 +0800 Subject: [PATCH] fix regression --- .../infer_predicate/pull_up_predicate_agg.out | 102 +++++++++--------- .../pull_up_predicate_agg.groovy | 48 ++++----- 2 files changed, 75 insertions(+), 75 deletions(-) diff --git a/regression-test/data/nereids_rules_p0/infer_predicate/pull_up_predicate_agg.out b/regression-test/data/nereids_rules_p0/infer_predicate/pull_up_predicate_agg.out index fa5c73530965b5d..0e5c4b477cdf35d 100644 --- a/regression-test/data/nereids_rules_p0/infer_predicate/pull_up_predicate_agg.out +++ b/regression-test/data/nereids_rules_p0/infer_predicate/pull_up_predicate_agg.out @@ -4,70 +4,70 @@ PhysicalResultSink --hashJoin[INNER_JOIN] hashCondition=((t.c1 = t2.a)) otherCondition=() ----hashAgg[GLOBAL] ------hashAgg[LOCAL] ---------filter((test_like1.a < 10) and (test_like1.a > 1)) -----------PhysicalOlapScan[test_like1] +--------filter((test_pull_up_agg_t1.a < 10) and (test_pull_up_agg_t1.a > 1)) +----------PhysicalOlapScan[test_pull_up_agg_t1] ----filter((t2.a < 10) and (t2.a > 1)) -------PhysicalOlapScan[test_like2] +------PhysicalOlapScan[test_pull_up_agg_t2] -- !test_max_greater -- PhysicalResultSink --hashJoin[INNER_JOIN] hashCondition=((t.c1 = t2.a)) otherCondition=() ----hashAgg[GLOBAL] ------hashAgg[LOCAL] ---------filter((test_like1.a > 10)) -----------PhysicalOlapScan[test_like1] +--------filter((test_pull_up_agg_t1.a > 10)) +----------PhysicalOlapScan[test_pull_up_agg_t1] ----filter((t2.a > 10)) -------PhysicalOlapScan[test_like2] +------PhysicalOlapScan[test_pull_up_agg_t2] -- !test_max_less_equal -- PhysicalResultSink --hashJoin[INNER_JOIN] hashCondition=((t.c1 = t2.a)) otherCondition=() ----hashAgg[GLOBAL] ------hashAgg[LOCAL] ---------filter((test_like1.a <= 10) and (test_like1.a > 1)) -----------PhysicalOlapScan[test_like1] +--------filter((test_pull_up_agg_t1.a <= 10) and (test_pull_up_agg_t1.a > 1)) +----------PhysicalOlapScan[test_pull_up_agg_t1] ----filter((t2.a <= 10) and (t2.a > 1)) -------PhysicalOlapScan[test_like2] +------PhysicalOlapScan[test_pull_up_agg_t2] -- !test_max_greater_equal -- PhysicalResultSink --hashJoin[INNER_JOIN] hashCondition=((t.c1 = t2.a)) otherCondition=() ----hashAgg[GLOBAL] ------hashAgg[LOCAL] ---------filter((test_like1.a >= 10)) -----------PhysicalOlapScan[test_like1] +--------filter((test_pull_up_agg_t1.a >= 10)) +----------PhysicalOlapScan[test_pull_up_agg_t1] ----filter((t2.a >= 10)) -------PhysicalOlapScan[test_like2] +------PhysicalOlapScan[test_pull_up_agg_t2] -- !test_max_equal -- PhysicalResultSink --hashJoin[INNER_JOIN] hashCondition=((t.c1 = t2.a)) otherCondition=() ----hashAgg[GLOBAL] ------hashAgg[LOCAL] ---------filter((test_like1.a = 10)) -----------PhysicalOlapScan[test_like1] +--------filter((test_pull_up_agg_t1.a = 10)) +----------PhysicalOlapScan[test_pull_up_agg_t1] ----filter((t2.a = 10)) -------PhysicalOlapScan[test_like2] +------PhysicalOlapScan[test_pull_up_agg_t2] -- !test_max_null_safe_equal -- PhysicalResultSink --hashJoin[INNER_JOIN] hashCondition=((t.c1 = t2.a)) otherCondition=() ----hashAgg[GLOBAL] ------hashAgg[LOCAL] ---------filter((test_like1.a <=> 10) and (test_like1.a > 1)) -----------PhysicalOlapScan[test_like1] +--------filter((test_pull_up_agg_t1.a <=> 10) and (test_pull_up_agg_t1.a > 1)) +----------PhysicalOlapScan[test_pull_up_agg_t1] ----filter((t2.a <=> 10) and (t2.a > 1)) -------PhysicalOlapScan[test_like2] +------PhysicalOlapScan[test_pull_up_agg_t2] -- !test_min_less -- PhysicalResultSink --hashJoin[INNER_JOIN] hashCondition=((t.c1 = t2.a)) otherCondition=() ----hashAgg[GLOBAL] ------hashAgg[LOCAL] ---------filter((test_like1.c < 1)) -----------PhysicalOlapScan[test_like1] +--------filter((test_pull_up_agg_t1.c < 1)) +----------PhysicalOlapScan[test_pull_up_agg_t1] ----filter((t2.a < 1)) -------PhysicalOlapScan[test_like2] +------PhysicalOlapScan[test_pull_up_agg_t2] -- !test_min_greater -- PhysicalResultSink @@ -75,10 +75,10 @@ PhysicalResultSink ----filter((c1 > 1)) ------hashAgg[GLOBAL] --------hashAgg[LOCAL] -----------filter((test_like1.c > 10)) -------------PhysicalOlapScan[test_like1] +----------filter((test_pull_up_agg_t1.c > 10)) +------------PhysicalOlapScan[test_pull_up_agg_t1] ----filter((t2.a > 10)) -------PhysicalOlapScan[test_like2] +------PhysicalOlapScan[test_pull_up_agg_t2] -- !test_min_less_equal -- PhysicalResultSink @@ -86,10 +86,10 @@ PhysicalResultSink ----filter((c1 >= 1)) ------hashAgg[GLOBAL] --------hashAgg[LOCAL] -----------filter((test_like1.c <= 10)) -------------PhysicalOlapScan[test_like1] +----------filter((test_pull_up_agg_t1.c <= 10)) +------------PhysicalOlapScan[test_pull_up_agg_t1] ----filter((t2.a <= 10) and (t2.a >= 1)) -------PhysicalOlapScan[test_like2] +------PhysicalOlapScan[test_pull_up_agg_t2] -- !test_min_greater_equal -- PhysicalResultSink @@ -101,10 +101,10 @@ PhysicalResultSink ----filter((c1 > 1)) ------hashAgg[GLOBAL] --------hashAgg[LOCAL] -----------filter((test_like1.c = 10)) -------------PhysicalOlapScan[test_like1] +----------filter((test_pull_up_agg_t1.c = 10)) +------------PhysicalOlapScan[test_pull_up_agg_t1] ----filter((t2.a = 10)) -------PhysicalOlapScan[test_like2] +------PhysicalOlapScan[test_pull_up_agg_t2] -- !test_min_null_safe_equal -- PhysicalResultSink @@ -112,68 +112,68 @@ PhysicalResultSink ----filter((c1 = 1)) ------hashAgg[GLOBAL] --------hashAgg[LOCAL] -----------filter((test_like1.c <=> 10)) -------------PhysicalOlapScan[test_like1] +----------filter((test_pull_up_agg_t1.c <=> 10)) +------------PhysicalOlapScan[test_pull_up_agg_t1] ----filter((t2.a <=> 10) and (t2.a = 1)) -------PhysicalOlapScan[test_like2] +------PhysicalOlapScan[test_pull_up_agg_t2] -- !test_avg_less -- PhysicalResultSink --hashJoin[INNER_JOIN] hashCondition=((t.c1 = expr_cast(a as DOUBLE))) otherCondition=() ----hashAgg[GLOBAL] ------hashAgg[LOCAL] ---------filter((test_like1.a > 1) and (test_like1.c < 10)) -----------PhysicalOlapScan[test_like1] +--------filter((test_pull_up_agg_t1.a > 1) and (test_pull_up_agg_t1.c < 10)) +----------PhysicalOlapScan[test_pull_up_agg_t1] ----filter((t2.a < 10)) -------PhysicalOlapScan[test_like2] +------PhysicalOlapScan[test_pull_up_agg_t2] -- !test_avg_greater -- PhysicalResultSink --hashJoin[INNER_JOIN] hashCondition=((t.c1 = expr_cast(a as DOUBLE))) otherCondition=() ----hashAgg[GLOBAL] ------hashAgg[LOCAL] ---------filter((test_like1.a > 1) and (test_like1.c > 10)) -----------PhysicalOlapScan[test_like1] +--------filter((test_pull_up_agg_t1.a > 1) and (test_pull_up_agg_t1.c > 10)) +----------PhysicalOlapScan[test_pull_up_agg_t1] ----filter((t2.a > 10)) -------PhysicalOlapScan[test_like2] +------PhysicalOlapScan[test_pull_up_agg_t2] -- !test_avg_less_equal -- PhysicalResultSink --hashJoin[INNER_JOIN] hashCondition=((t.c1 = expr_cast(a as DOUBLE))) otherCondition=() ----hashAgg[GLOBAL] ------hashAgg[LOCAL] ---------filter((test_like1.a > 1) and (test_like1.c <= 10)) -----------PhysicalOlapScan[test_like1] +--------filter((test_pull_up_agg_t1.a > 1) and (test_pull_up_agg_t1.c <= 10)) +----------PhysicalOlapScan[test_pull_up_agg_t1] ----filter((t2.a <= 10)) -------PhysicalOlapScan[test_like2] +------PhysicalOlapScan[test_pull_up_agg_t2] -- !test_avg_greater_equal -- PhysicalResultSink --hashJoin[INNER_JOIN] hashCondition=((t.c1 = expr_cast(a as DOUBLE))) otherCondition=() ----hashAgg[GLOBAL] ------hashAgg[LOCAL] ---------filter((test_like1.a > 1) and (test_like1.c >= 10)) -----------PhysicalOlapScan[test_like1] +--------filter((test_pull_up_agg_t1.a > 1) and (test_pull_up_agg_t1.c >= 10)) +----------PhysicalOlapScan[test_pull_up_agg_t1] ----filter((t2.a >= 10)) -------PhysicalOlapScan[test_like2] +------PhysicalOlapScan[test_pull_up_agg_t2] -- !test_avg_equal -- PhysicalResultSink --hashJoin[INNER_JOIN] hashCondition=((t.c1 = expr_cast(a as DOUBLE))) otherCondition=() ----hashAgg[GLOBAL] ------hashAgg[LOCAL] ---------filter((test_like1.a > 1) and (test_like1.c = 10)) -----------PhysicalOlapScan[test_like1] +--------filter((test_pull_up_agg_t1.a > 1) and (test_pull_up_agg_t1.c = 10)) +----------PhysicalOlapScan[test_pull_up_agg_t1] ----filter((t2.a = 10)) -------PhysicalOlapScan[test_like2] +------PhysicalOlapScan[test_pull_up_agg_t2] -- !test_avg_null_safe_equal -- PhysicalResultSink --hashJoin[INNER_JOIN] hashCondition=((t.c1 = expr_cast(a as DOUBLE))) otherCondition=() ----hashAgg[GLOBAL] ------hashAgg[LOCAL] ---------filter((test_like1.a > 1) and (test_like1.c <=> 10)) -----------PhysicalOlapScan[test_like1] +--------filter((test_pull_up_agg_t1.a > 1) and (test_pull_up_agg_t1.c <=> 10)) +----------PhysicalOlapScan[test_pull_up_agg_t1] ----filter((t2.a <=> 10)) -------PhysicalOlapScan[test_like2] +------PhysicalOlapScan[test_pull_up_agg_t2] diff --git a/regression-test/suites/nereids_rules_p0/infer_predicate/pull_up_predicate_agg.groovy b/regression-test/suites/nereids_rules_p0/infer_predicate/pull_up_predicate_agg.groovy index 9235c1bd580235e..1a41ec80b4e49f8 100644 --- a/regression-test/suites/nereids_rules_p0/infer_predicate/pull_up_predicate_agg.groovy +++ b/regression-test/suites/nereids_rules_p0/infer_predicate/pull_up_predicate_agg.groovy @@ -22,11 +22,11 @@ suite("test_pull_up_agg") { sql 'set runtime_filter_mode=off' sql 'set disable_join_reorder=true' - sql "drop table if exists test_like1" - sql "drop table if exists test_like2" + sql "drop table if exists test_pull_up_agg_t1" + sql "drop table if exists test_pull_up_agg_t2" sql """ - CREATE TABLE `test_like1` ( + CREATE TABLE `test_pull_up_agg_t1` ( `a` INT NULL, `b` VARCHAR(10) NULL, `c` INT NULL, @@ -40,7 +40,7 @@ suite("test_pull_up_agg") { """ sql """ - CREATE TABLE `test_like2` ( + CREATE TABLE `test_pull_up_agg_t2` ( `a` INT NULL, `b` VARCHAR(10) NULL, `c` INT NULL, @@ -54,32 +54,32 @@ suite("test_pull_up_agg") { """ sql """ - insert into test_like1 values(1,'d2',3,5),(0,'d2',3,5),(-3,'d2',2,2),(-2,'d2',2,2); + insert into test_pull_up_agg_t1 values(1,'d2',3,5),(0,'d2',3,5),(-3,'d2',2,2),(-2,'d2',2,2); """ sql """ - insert into test_like2 values(1,'d2',2,2),(-3,'d2',2,2),(0,'d2',3,5); + insert into test_pull_up_agg_t2 values(1,'d2',2,2),(-3,'d2',2,2),(0,'d2',3,5); """ - qt_test_max_less "explain shape plan select * from (select max(a) c1 from test_like1 where a<10 group by a having max(a)>1) t inner join test_like2 t2 on t.c1=t2.a;" - qt_test_max_greater "explain shape plan select * from (select max(a) c1 from test_like1 where a>10 group by a having max(a)>1) t inner join test_like2 t2 on t.c1=t2.a;" - qt_test_max_less_equal "explain shape plan select * from (select max(a) c1 from test_like1 where a<=10 group by a having max(a)>1) t inner join test_like2 t2 on t.c1=t2.a;" - qt_test_max_greater_equal "explain shape plan select * from (select max(a) c1 from test_like1 where a>=10 group by a having max(a)>1) t inner join test_like2 t2 on t.c1=t2.a;" - qt_test_max_equal "explain shape plan select * from (select max(a) c1 from test_like1 where a=10 group by a having max(a)>1) t inner join test_like2 t2 on t.c1=t2.a;" - qt_test_max_null_safe_equal "explain shape plan select * from (select max(a) c1 from test_like1 where a<=>10 group by a having max(a)>1) t inner join test_like2 t2 on t.c1=t2.a;" + qt_test_max_less "explain shape plan select * from (select max(a) c1 from test_pull_up_agg_t1 where a<10 group by a having max(a)>1) t inner join test_pull_up_agg_t2 t2 on t.c1=t2.a;" + qt_test_max_greater "explain shape plan select * from (select max(a) c1 from test_pull_up_agg_t1 where a>10 group by a having max(a)>1) t inner join test_pull_up_agg_t2 t2 on t.c1=t2.a;" + qt_test_max_less_equal "explain shape plan select * from (select max(a) c1 from test_pull_up_agg_t1 where a<=10 group by a having max(a)>1) t inner join test_pull_up_agg_t2 t2 on t.c1=t2.a;" + qt_test_max_greater_equal "explain shape plan select * from (select max(a) c1 from test_pull_up_agg_t1 where a>=10 group by a having max(a)>1) t inner join test_pull_up_agg_t2 t2 on t.c1=t2.a;" + qt_test_max_equal "explain shape plan select * from (select max(a) c1 from test_pull_up_agg_t1 where a=10 group by a having max(a)>1) t inner join test_pull_up_agg_t2 t2 on t.c1=t2.a;" + qt_test_max_null_safe_equal "explain shape plan select * from (select max(a) c1 from test_pull_up_agg_t1 where a<=>10 group by a having max(a)>1) t inner join test_pull_up_agg_t2 t2 on t.c1=t2.a;" // test min(non-groupby-column) - qt_test_min_less "explain shape plan select * from (select min(c) c1 from test_like1 where c<10 group by a having min(c)<1) t inner join test_like2 t2 on t.c1=t2.a;" - qt_test_min_greater "explain shape plan select * from (select min(c) c1 from test_like1 where c>10 group by a having min(c)>1) t inner join test_like2 t2 on t.c1=t2.a;" - qt_test_min_less_equal "explain shape plan select * from (select min(c) c1 from test_like1 where c<=10 group by a having min(c)>=1) t inner join test_like2 t2 on t.c1=t2.a;" - qt_test_min_greater_equal "explain shape plan select * from (select min(c) c1 from test_like1 where c>=10 group by a having min(c)<=1) t inner join test_like2 t2 on t.c1=t2.a;" - qt_test_min_equal "explain shape plan select * from (select min(c) c1 from test_like1 where c=10 group by a having min(c)>1) t inner join test_like2 t2 on t.c1=t2.a;" - qt_test_min_null_safe_equal "explain shape plan select * from (select min(c) c1 from test_like1 where c<=>10 group by a having min(c)=1) t inner join test_like2 t2 on t.c1=t2.a;" + qt_test_min_less "explain shape plan select * from (select min(c) c1 from test_pull_up_agg_t1 where c<10 group by a having min(c)<1) t inner join test_pull_up_agg_t2 t2 on t.c1=t2.a;" + qt_test_min_greater "explain shape plan select * from (select min(c) c1 from test_pull_up_agg_t1 where c>10 group by a having min(c)>1) t inner join test_pull_up_agg_t2 t2 on t.c1=t2.a;" + qt_test_min_less_equal "explain shape plan select * from (select min(c) c1 from test_pull_up_agg_t1 where c<=10 group by a having min(c)>=1) t inner join test_pull_up_agg_t2 t2 on t.c1=t2.a;" + qt_test_min_greater_equal "explain shape plan select * from (select min(c) c1 from test_pull_up_agg_t1 where c>=10 group by a having min(c)<=1) t inner join test_pull_up_agg_t2 t2 on t.c1=t2.a;" + qt_test_min_equal "explain shape plan select * from (select min(c) c1 from test_pull_up_agg_t1 where c=10 group by a having min(c)>1) t inner join test_pull_up_agg_t2 t2 on t.c1=t2.a;" + qt_test_min_null_safe_equal "explain shape plan select * from (select min(c) c1 from test_pull_up_agg_t1 where c<=>10 group by a having min(c)=1) t inner join test_pull_up_agg_t2 t2 on t.c1=t2.a;" - qt_test_avg_less "explain shape plan select * from (select avg(c) c1 from test_like1 where c<10 group by a having a>1) t inner join test_like2 t2 on t.c1=t2.a;" - qt_test_avg_greater "explain shape plan select * from (select avg(c) c1 from test_like1 where c>10 group by a having a>1) t inner join test_like2 t2 on t.c1=t2.a;" - qt_test_avg_less_equal "explain shape plan select * from (select avg(c) c1 from test_like1 where c<=10 group by a having a>1) t inner join test_like2 t2 on t.c1=t2.a;" - qt_test_avg_greater_equal "explain shape plan select * from (select avg(c) c1 from test_like1 where c>=10 group by a having a>1) t inner join test_like2 t2 on t.c1=t2.a;" - qt_test_avg_equal "explain shape plan select * from (select avg(c) c1 from test_like1 where c=10 group by a having a>1) t inner join test_like2 t2 on t.c1=t2.a;" - qt_test_avg_null_safe_equal "explain shape plan select * from (select avg(c) c1 from test_like1 where c<=>10 group by a having a>1) t inner join test_like2 t2 on t.c1=t2.a;" + qt_test_avg_less "explain shape plan select * from (select avg(c) c1 from test_pull_up_agg_t1 where c<10 group by a having a>1) t inner join test_pull_up_agg_t2 t2 on t.c1=t2.a;" + qt_test_avg_greater "explain shape plan select * from (select avg(c) c1 from test_pull_up_agg_t1 where c>10 group by a having a>1) t inner join test_pull_up_agg_t2 t2 on t.c1=t2.a;" + qt_test_avg_less_equal "explain shape plan select * from (select avg(c) c1 from test_pull_up_agg_t1 where c<=10 group by a having a>1) t inner join test_pull_up_agg_t2 t2 on t.c1=t2.a;" + qt_test_avg_greater_equal "explain shape plan select * from (select avg(c) c1 from test_pull_up_agg_t1 where c>=10 group by a having a>1) t inner join test_pull_up_agg_t2 t2 on t.c1=t2.a;" + qt_test_avg_equal "explain shape plan select * from (select avg(c) c1 from test_pull_up_agg_t1 where c=10 group by a having a>1) t inner join test_pull_up_agg_t2 t2 on t.c1=t2.a;" + qt_test_avg_null_safe_equal "explain shape plan select * from (select avg(c) c1 from test_pull_up_agg_t1 where c<=>10 group by a having a>1) t inner join test_pull_up_agg_t2 t2 on t.c1=t2.a;" } \ No newline at end of file