diff --git a/regression-test/data/nereids_rules_p0/push_count_into_union_all/push_count_into_union_all.out b/regression-test/data/nereids_rules_p0/push_count_into_union_all/push_count_into_union_all.out index 3d5d235dde2204a..f0c84c4c3f31cd3 100644 --- a/regression-test/data/nereids_rules_p0/push_count_into_union_all/push_count_into_union_all.out +++ b/regression-test/data/nereids_rules_p0/push_count_into_union_all/push_count_into_union_all.out @@ -326,3 +326,39 @@ PhysicalResultSink --------------------filter((mal_test_push_count.a = 1)) ----------------------PhysicalOlapScan[mal_test_push_count] +-- !test_upper_refer_count_star -- +1 10 +2 2 +3 6 +4 2 +5 10 +7 2 + +-- !test_upper_refer_count_star_shape -- +PhysicalResultSink +--PhysicalQuickSort[MERGE_SORT] +----PhysicalDistribute[DistributionSpecGather] +------PhysicalQuickSort[LOCAL_SORT] +--------hashAgg[GLOBAL] +----------PhysicalDistribute[DistributionSpecHash] +------------hashAgg[LOCAL] +--------------PhysicalUnion +----------------hashAgg[GLOBAL] +------------------PhysicalDistribute[DistributionSpecHash] +--------------------hashAgg[LOCAL] +----------------------PhysicalProject +------------------------filter((mal_test_push_count.a > 1)) +--------------------------PhysicalOlapScan[mal_test_push_count] +----------------hashAgg[GLOBAL] +------------------PhysicalDistribute[DistributionSpecHash] +--------------------hashAgg[LOCAL] +----------------------PhysicalProject +------------------------filter((mal_test_push_count.a < 100)) +--------------------------PhysicalOlapScan[mal_test_push_count] +----------------hashAgg[GLOBAL] +------------------PhysicalDistribute[DistributionSpecHash] +--------------------hashAgg[LOCAL] +----------------------PhysicalProject +------------------------filter((mal_test_push_count.a = 1)) +--------------------------PhysicalOlapScan[mal_test_push_count] + diff --git a/regression-test/suites/nereids_rules_p0/push_count_into_union_all/push_count_into_union_all.groovy b/regression-test/suites/nereids_rules_p0/push_count_into_union_all/push_count_into_union_all.groovy index 3bf77492ac30f3a..694cd08b156d8f3 100644 --- a/regression-test/suites/nereids_rules_p0/push_count_into_union_all/push_count_into_union_all.groovy +++ b/regression-test/suites/nereids_rules_p0/push_count_into_union_all/push_count_into_union_all.groovy @@ -115,4 +115,15 @@ suite("push_count_into_union_all") { explain shape plan select a,count(b) c1,sum(b) from (select a,b from mal_test_push_count where a>1 union all select a,b from mal_test_push_count where a<100 union all select a,b from mal_test_push_count where a=1 ) t group by a order by 1,2,3;""" + + qt_test_upper_refer_count_star """ + select a,c1 from ( + select a,count(*) c1 from (select a,b from mal_test_push_count where a>1 union all select a,b from mal_test_push_count where a<100 + union all select a,b from mal_test_push_count where a=1 ) t group by a) outer_table order by 1,2;""" + + qt_test_upper_refer_count_star_shape """ + explain shape plan + select a,c1 from ( + select a,count(*) c1 from (select a,b from mal_test_push_count where a>1 union all select a,b from mal_test_push_count where a<100 + union all select a,b from mal_test_push_count where a=1 ) t group by a) outer_table order by 1,2;""" } \ No newline at end of file