This is an automated email from the ASF dual-hosted git repository.

yiguolei pushed a commit to branch branch-2.1
in repository https://gitbox.apache.org/repos/asf/doris.git

commit 26efde292528eb5ea025e1dac28a37123c653005
Author: xzj7019 <[email protected]>
AuthorDate: Thu Mar 21 17:27:37 2024 +0800

    [test](Nereids) refine group by eliminate regression test (#32543)
---
 .../eliminate_gby_key/eliminate_gby_key.out        | 164 ---------------------
 .../eliminate_gby_key/eliminate_gby_key.groovy     | 108 +++++++++-----
 2 files changed, 72 insertions(+), 200 deletions(-)

diff --git 
a/regression-test/data/nereids_rules_p0/eliminate_gby_key/eliminate_gby_key.out 
b/regression-test/data/nereids_rules_p0/eliminate_gby_key/eliminate_gby_key.out
deleted file mode 100644
index a7e82975a53..00000000000
--- 
a/regression-test/data/nereids_rules_p0/eliminate_gby_key/eliminate_gby_key.out
+++ /dev/null
@@ -1,164 +0,0 @@
--- This file is automatically generated. You should know what you did if you 
want to edit this
--- !1 --
-cost = 12.09
-PhysicalResultSink[358] ( outputExprs=[t2_c1#10] )
-+--PhysicalDistribute[355]@7 ( stats=1, 
distributionSpec=DistributionSpecGather )
-   +--PhysicalProject[352]@7 ( stats=1, projects=[c1#13 AS `t2_c1`#10] )
-      +--PhysicalHashAggregate[349]@6 ( aggPhase=LOCAL, 
aggMode=INPUT_TO_RESULT, maybeUseStreaming=false, groupByExpr=[c1#13, c3#18], 
outputExpr=[c1#13, c3#18], partitionExpr=Optional[[c1#13, c3#18]], 
requireProperties=[DistributionSpecHash ( orderedShuffledColumns=[13, 18], 
shuffleType=REQUIRE, tableId=-1, selectedIndexId=-1, partitionIds=[], 
equivalenceExprIds=[[13], [18]], exprIdToEquivalenceSet={13=0, 18=1} ) Order: 
([])], stats=1 )
-         +--PhysicalProject[346]@5 ( stats=1, projects=[c1#13, c3#18] )
-            +--PhysicalHashJoin[343]@4 ( type=INNER_JOIN, stats=1, 
hashCondition=[(c3#15 = c2#17)], otherCondition=[], markCondition=[] )
-               |--PhysicalProject[333]@1 ( stats=1, projects=[c1#13, c3#15] )
-               |  +--PhysicalOlapScan[t2]@0 ( stats=1 )
-               +--PhysicalDistribute[340]@3 ( stats=1, 
distributionSpec=DistributionSpecReplicated )
-                  +--PhysicalProject[337]@3 ( stats=1, projects=[c2#17, c3#18] 
)
-                     +--PhysicalOlapScan[t1]@2 ( stats=1 )
-
--- !2 --
-cost = 11.09
-PhysicalResultSink[334] ( outputExprs=[t2_c2#9] )
-+--PhysicalDistribute[331]@6 ( stats=1, 
distributionSpec=DistributionSpecGather )
-   +--PhysicalProject[328]@6 ( stats=1, projects=[t2_c2#19 AS `t2_c2`#9] )
-      +--PhysicalHashAggregate[325]@5 ( aggPhase=LOCAL, 
aggMode=INPUT_TO_RESULT, maybeUseStreaming=false, groupByExpr=[c1#13, c3#18, 
t2_c2#19], outputExpr=[c1#13, c3#18, t2_c2#19], partitionExpr=Optional[[c1#13, 
c3#18, t2_c2#19]], requireProperties=[DistributionSpecHash ( 
orderedShuffledColumns=[13, 18, 19], shuffleType=REQUIRE, tableId=-1, 
selectedIndexId=-1, partitionIds=[], equivalenceExprIds=[[13], [18], [19]], 
exprIdToEquivalenceSet={13=0, 18=1, 19=2} ) Order: ([])], stats=1 )
-         +--PhysicalProject[322]@4 ( stats=1, projects=[substring(c2#14, 1, 3) 
AS `t2_c2`#19, c1#13, c3#18] )
-            +--PhysicalHashJoin[319]@3 ( type=INNER_JOIN, stats=1, 
hashCondition=[(c3#15 = c2#17)], otherCondition=[], markCondition=[] )
-               |--PhysicalOlapScan[t2]@0 ( stats=1 )
-               +--PhysicalDistribute[316]@2 ( stats=1, 
distributionSpec=DistributionSpecReplicated )
-                  +--PhysicalProject[313]@2 ( stats=1, projects=[c2#17, c3#18] 
)
-                     +--PhysicalOlapScan[t1]@1 ( stats=1 )
-
--- !3 --
-cost = 12.09
-PhysicalResultSink[358] ( outputExprs=[c3#11] )
-+--PhysicalDistribute[355]@7 ( stats=1, 
distributionSpec=DistributionSpecGather )
-   +--PhysicalProject[352]@7 ( stats=1, projects=[c3#18 AS `c3`#11] )
-      +--PhysicalHashAggregate[349]@6 ( aggPhase=LOCAL, 
aggMode=INPUT_TO_RESULT, maybeUseStreaming=false, groupByExpr=[c1#13, c3#18], 
outputExpr=[c1#13, c3#18], partitionExpr=Optional[[c1#13, c3#18]], 
requireProperties=[DistributionSpecHash ( orderedShuffledColumns=[13, 18], 
shuffleType=REQUIRE, tableId=-1, selectedIndexId=-1, partitionIds=[], 
equivalenceExprIds=[[13], [18]], exprIdToEquivalenceSet={13=0, 18=1} ) Order: 
([])], stats=1 )
-         +--PhysicalProject[346]@5 ( stats=1, projects=[c1#13, c3#18] )
-            +--PhysicalHashJoin[343]@4 ( type=INNER_JOIN, stats=1, 
hashCondition=[(c3#15 = c2#17)], otherCondition=[], markCondition=[] )
-               |--PhysicalProject[333]@1 ( stats=1, projects=[c1#13, c3#15] )
-               |  +--PhysicalOlapScan[t2]@0 ( stats=1 )
-               +--PhysicalDistribute[340]@3 ( stats=1, 
distributionSpec=DistributionSpecReplicated )
-                  +--PhysicalProject[337]@3 ( stats=1, projects=[c2#17, c3#18] 
)
-                     +--PhysicalOlapScan[t1]@2 ( stats=1 )
-
--- !4 --
-cost = 12.09
-PhysicalResultSink[358] ( outputExprs=[cnt#12] )
-+--PhysicalDistribute[355]@7 ( stats=1, 
distributionSpec=DistributionSpecGather )
-   +--PhysicalProject[352]@7 ( stats=1, projects=[cnt#20 AS `cnt`#12] )
-      +--PhysicalHashAggregate[349]@6 ( aggPhase=LOCAL, 
aggMode=INPUT_TO_RESULT, maybeUseStreaming=false, groupByExpr=[c1#13, c3#18], 
outputExpr=[c1#13, c3#18, count(*) AS `cnt`#20], partitionExpr=Optional[[c1#13, 
c3#18]], requireProperties=[DistributionSpecHash ( orderedShuffledColumns=[13, 
18], shuffleType=REQUIRE, tableId=-1, selectedIndexId=-1, partitionIds=[], 
equivalenceExprIds=[[13], [18]], exprIdToEquivalenceSet={13=0, 18=1} ) Order: 
([])], stats=1 )
-         +--PhysicalProject[346]@5 ( stats=1, projects=[c1#13, c3#18] )
-            +--PhysicalHashJoin[343]@4 ( type=INNER_JOIN, stats=1, 
hashCondition=[(c3#15 = c2#17)], otherCondition=[], markCondition=[] )
-               |--PhysicalProject[333]@1 ( stats=1, projects=[c1#13, c3#15] )
-               |  +--PhysicalOlapScan[t2]@0 ( stats=1 )
-               +--PhysicalDistribute[340]@3 ( stats=1, 
distributionSpec=DistributionSpecReplicated )
-                  +--PhysicalProject[337]@3 ( stats=1, projects=[c2#17, c3#18] 
)
-                     +--PhysicalOlapScan[t1]@2 ( stats=1 )
-
--- !5 --
-cost = 11.09
-PhysicalResultSink[334] ( outputExprs=[t2_c2#9, t2_c1#10] )
-+--PhysicalDistribute[331]@6 ( stats=1, 
distributionSpec=DistributionSpecGather )
-   +--PhysicalProject[328]@6 ( stats=1, projects=[t2_c2#19 AS `t2_c2`#9, c1#13 
AS `t2_c1`#10] )
-      +--PhysicalHashAggregate[325]@5 ( aggPhase=LOCAL, 
aggMode=INPUT_TO_RESULT, maybeUseStreaming=false, groupByExpr=[c1#13, c3#18, 
t2_c2#19], outputExpr=[c1#13, c3#18, t2_c2#19], partitionExpr=Optional[[c1#13, 
c3#18, t2_c2#19]], requireProperties=[DistributionSpecHash ( 
orderedShuffledColumns=[13, 18, 19], shuffleType=REQUIRE, tableId=-1, 
selectedIndexId=-1, partitionIds=[], equivalenceExprIds=[[13], [18], [19]], 
exprIdToEquivalenceSet={13=0, 18=1, 19=2} ) Order: ([])], stats=1 )
-         +--PhysicalProject[322]@4 ( stats=1, projects=[substring(c2#14, 1, 3) 
AS `t2_c2`#19, c1#13, c3#18] )
-            +--PhysicalHashJoin[319]@3 ( type=INNER_JOIN, stats=1, 
hashCondition=[(c3#15 = c2#17)], otherCondition=[], markCondition=[] )
-               |--PhysicalOlapScan[t2]@0 ( stats=1 )
-               +--PhysicalDistribute[316]@2 ( stats=1, 
distributionSpec=DistributionSpecReplicated )
-                  +--PhysicalProject[313]@2 ( stats=1, projects=[c2#17, c3#18] 
)
-                     +--PhysicalOlapScan[t1]@1 ( stats=1 )
-
--- !6 --
-cost = 12.09
-PhysicalResultSink[358] ( outputExprs=[c3#11, t2_c1#10] )
-+--PhysicalDistribute[355]@7 ( stats=1, 
distributionSpec=DistributionSpecGather )
-   +--PhysicalProject[352]@7 ( stats=1, projects=[c3#18 AS `c3`#11, c1#13 AS 
`t2_c1`#10] )
-      +--PhysicalHashAggregate[349]@6 ( aggPhase=LOCAL, 
aggMode=INPUT_TO_RESULT, maybeUseStreaming=false, groupByExpr=[c1#13, c3#18], 
outputExpr=[c1#13, c3#18], partitionExpr=Optional[[c1#13, c3#18]], 
requireProperties=[DistributionSpecHash ( orderedShuffledColumns=[13, 18], 
shuffleType=REQUIRE, tableId=-1, selectedIndexId=-1, partitionIds=[], 
equivalenceExprIds=[[13], [18]], exprIdToEquivalenceSet={13=0, 18=1} ) Order: 
([])], stats=1 )
-         +--PhysicalProject[346]@5 ( stats=1, projects=[c1#13, c3#18] )
-            +--PhysicalHashJoin[343]@4 ( type=INNER_JOIN, stats=1, 
hashCondition=[(c3#15 = c2#17)], otherCondition=[], markCondition=[] )
-               |--PhysicalProject[333]@1 ( stats=1, projects=[c1#13, c3#15] )
-               |  +--PhysicalOlapScan[t2]@0 ( stats=1 )
-               +--PhysicalDistribute[340]@3 ( stats=1, 
distributionSpec=DistributionSpecReplicated )
-                  +--PhysicalProject[337]@3 ( stats=1, projects=[c2#17, c3#18] 
)
-                     +--PhysicalOlapScan[t1]@2 ( stats=1 )
-
--- !7 --
-cost = 11.09
-PhysicalResultSink[334] ( outputExprs=[c3#11, t2_c2#9] )
-+--PhysicalDistribute[331]@6 ( stats=1, 
distributionSpec=DistributionSpecGather )
-   +--PhysicalProject[328]@6 ( stats=1, projects=[c3#18 AS `c3`#11, t2_c2#19 
AS `t2_c2`#9] )
-      +--PhysicalHashAggregate[325]@5 ( aggPhase=LOCAL, 
aggMode=INPUT_TO_RESULT, maybeUseStreaming=false, groupByExpr=[c1#13, c3#18, 
t2_c2#19], outputExpr=[c1#13, c3#18, t2_c2#19], partitionExpr=Optional[[c1#13, 
c3#18, t2_c2#19]], requireProperties=[DistributionSpecHash ( 
orderedShuffledColumns=[13, 18, 19], shuffleType=REQUIRE, tableId=-1, 
selectedIndexId=-1, partitionIds=[], equivalenceExprIds=[[13], [18], [19]], 
exprIdToEquivalenceSet={13=0, 18=1, 19=2} ) Order: ([])], stats=1 )
-         +--PhysicalProject[322]@4 ( stats=1, projects=[substring(c2#14, 1, 3) 
AS `t2_c2`#19, c1#13, c3#18] )
-            +--PhysicalHashJoin[319]@3 ( type=INNER_JOIN, stats=1, 
hashCondition=[(c3#15 = c2#17)], otherCondition=[], markCondition=[] )
-               |--PhysicalOlapScan[t2]@0 ( stats=1 )
-               +--PhysicalDistribute[316]@2 ( stats=1, 
distributionSpec=DistributionSpecReplicated )
-                  +--PhysicalProject[313]@2 ( stats=1, projects=[c2#17, c3#18] 
)
-                     +--PhysicalOlapScan[t1]@1 ( stats=1 )
-
--- !8 --
-cost = 12.09
-PhysicalResultSink[358] ( outputExprs=[t2_c1#10, cnt#12] )
-+--PhysicalDistribute[355]@7 ( stats=1, 
distributionSpec=DistributionSpecGather )
-   +--PhysicalProject[352]@7 ( stats=1, projects=[c1#13 AS `t2_c1`#10, cnt#20 
AS `cnt`#12] )
-      +--PhysicalHashAggregate[349]@6 ( aggPhase=LOCAL, 
aggMode=INPUT_TO_RESULT, maybeUseStreaming=false, groupByExpr=[c1#13, c3#18], 
outputExpr=[c1#13, c3#18, count(*) AS `cnt`#20], partitionExpr=Optional[[c1#13, 
c3#18]], requireProperties=[DistributionSpecHash ( orderedShuffledColumns=[13, 
18], shuffleType=REQUIRE, tableId=-1, selectedIndexId=-1, partitionIds=[], 
equivalenceExprIds=[[13], [18]], exprIdToEquivalenceSet={13=0, 18=1} ) Order: 
([])], stats=1 )
-         +--PhysicalProject[346]@5 ( stats=1, projects=[c1#13, c3#18] )
-            +--PhysicalHashJoin[343]@4 ( type=INNER_JOIN, stats=1, 
hashCondition=[(c3#15 = c2#17)], otherCondition=[], markCondition=[] )
-               |--PhysicalProject[333]@1 ( stats=1, projects=[c1#13, c3#15] )
-               |  +--PhysicalOlapScan[t2]@0 ( stats=1 )
-               +--PhysicalDistribute[340]@3 ( stats=1, 
distributionSpec=DistributionSpecReplicated )
-                  +--PhysicalProject[337]@3 ( stats=1, projects=[c2#17, c3#18] 
)
-                     +--PhysicalOlapScan[t1]@2 ( stats=1 )
-
--- !9 --
-cost = 12.09
-PhysicalResultSink[358] ( outputExprs=[c3#11, cnt#12] )
-+--PhysicalDistribute[355]@7 ( stats=1, 
distributionSpec=DistributionSpecGather )
-   +--PhysicalProject[352]@7 ( stats=1, projects=[c3#18 AS `c3`#11, cnt#20 AS 
`cnt`#12] )
-      +--PhysicalHashAggregate[349]@6 ( aggPhase=LOCAL, 
aggMode=INPUT_TO_RESULT, maybeUseStreaming=false, groupByExpr=[c1#13, c3#18], 
outputExpr=[c1#13, c3#18, count(*) AS `cnt`#20], partitionExpr=Optional[[c1#13, 
c3#18]], requireProperties=[DistributionSpecHash ( orderedShuffledColumns=[13, 
18], shuffleType=REQUIRE, tableId=-1, selectedIndexId=-1, partitionIds=[], 
equivalenceExprIds=[[13], [18]], exprIdToEquivalenceSet={13=0, 18=1} ) Order: 
([])], stats=1 )
-         +--PhysicalProject[346]@5 ( stats=1, projects=[c1#13, c3#18] )
-            +--PhysicalHashJoin[343]@4 ( type=INNER_JOIN, stats=1, 
hashCondition=[(c3#15 = c2#17)], otherCondition=[], markCondition=[] )
-               |--PhysicalProject[333]@1 ( stats=1, projects=[c1#13, c3#15] )
-               |  +--PhysicalOlapScan[t2]@0 ( stats=1 )
-               +--PhysicalDistribute[340]@3 ( stats=1, 
distributionSpec=DistributionSpecReplicated )
-                  +--PhysicalProject[337]@3 ( stats=1, projects=[c2#17, c3#18] 
)
-                     +--PhysicalOlapScan[t1]@2 ( stats=1 )
-
--- !10 --
-cost = 12.09
-PhysicalResultSink[358] ( outputExprs=[t2_c1#10, c3#11, cnt#12] )
-+--PhysicalDistribute[355]@7 ( stats=1, 
distributionSpec=DistributionSpecGather )
-   +--PhysicalProject[352]@7 ( stats=1, projects=[c1#13 AS `t2_c1`#10, c3#18 
AS `c3`#11, cnt#20 AS `cnt`#12] )
-      +--PhysicalHashAggregate[349]@6 ( aggPhase=LOCAL, 
aggMode=INPUT_TO_RESULT, maybeUseStreaming=false, groupByExpr=[c1#13, c3#18], 
outputExpr=[c1#13, c3#18, count(*) AS `cnt`#20], partitionExpr=Optional[[c1#13, 
c3#18]], requireProperties=[DistributionSpecHash ( orderedShuffledColumns=[13, 
18], shuffleType=REQUIRE, tableId=-1, selectedIndexId=-1, partitionIds=[], 
equivalenceExprIds=[[13], [18]], exprIdToEquivalenceSet={13=0, 18=1} ) Order: 
([])], stats=1 )
-         +--PhysicalProject[346]@5 ( stats=1, projects=[c1#13, c3#18] )
-            +--PhysicalHashJoin[343]@4 ( type=INNER_JOIN, stats=1, 
hashCondition=[(c3#15 = c2#17)], otherCondition=[], markCondition=[] )
-               |--PhysicalProject[333]@1 ( stats=1, projects=[c1#13, c3#15] )
-               |  +--PhysicalOlapScan[t2]@0 ( stats=1 )
-               +--PhysicalDistribute[340]@3 ( stats=1, 
distributionSpec=DistributionSpecReplicated )
-                  +--PhysicalProject[337]@3 ( stats=1, projects=[c2#17, c3#18] 
)
-                     +--PhysicalOlapScan[t1]@2 ( stats=1 )
-
--- !11 --
-cost = 11.09
-PhysicalResultSink[332] ( outputExprs=[t2_c2#9, c3#11, t2_c1#10] )
-+--PhysicalDistribute[329]@6 ( stats=1, 
distributionSpec=DistributionSpecGather )
-   +--PhysicalProject[326]@6 ( stats=1, projects=[t2_c2#19 AS `t2_c2`#9, c3#18 
AS `c3`#11, c1#13 AS `t2_c1`#10] )
-      +--PhysicalHashAggregate[323]@5 ( aggPhase=LOCAL, 
aggMode=INPUT_TO_RESULT, maybeUseStreaming=false, groupByExpr=[c1#13, c3#18, 
t2_c2#19], outputExpr=[c1#13, c3#18, t2_c2#19], partitionExpr=Optional[[c1#13, 
c3#18, t2_c2#19]], requireProperties=[DistributionSpecHash ( 
orderedShuffledColumns=[13, 18, 19], shuffleType=REQUIRE, tableId=-1, 
selectedIndexId=-1, partitionIds=[], equivalenceExprIds=[[13], [18], [19]], 
exprIdToEquivalenceSet={13=0, 18=1, 19=2} ) Order: ([])], stats=1 )
-         +--PhysicalProject[320]@4 ( stats=1, projects=[substring(c2#14, 1, 3) 
AS `t2_c2`#19, c1#13, c3#18] )
-            +--PhysicalHashJoin[317]@3 ( type=INNER_JOIN, stats=1, 
hashCondition=[(c3#15 = c2#17)], otherCondition=[], markCondition=[] )
-               |--PhysicalOlapScan[t2]@0 ( stats=1 )
-               +--PhysicalDistribute[314]@2 ( stats=1, 
distributionSpec=DistributionSpecReplicated )
-                  +--PhysicalProject[311]@2 ( stats=1, projects=[c2#17, c3#18] 
)
-                     +--PhysicalOlapScan[t1]@1 ( stats=1 )
-
--- !12 --
-cost = 11.09
-PhysicalResultSink[330] ( outputExprs=[t2_c2#9, c3#11, t2_c1#10, cnt#12] )
-+--PhysicalDistribute[327]@6 ( stats=1, 
distributionSpec=DistributionSpecGather )
-   +--PhysicalProject[324]@6 ( stats=1, projects=[t2_c2#19 AS `t2_c2`#9, c3#18 
AS `c3`#11, c1#13 AS `t2_c1`#10, cnt#20 AS `cnt`#12] )
-      +--PhysicalHashAggregate[321]@5 ( aggPhase=LOCAL, 
aggMode=INPUT_TO_RESULT, maybeUseStreaming=false, groupByExpr=[c1#13, c3#18, 
t2_c2#19], outputExpr=[c1#13, c3#18, t2_c2#19, count(*) AS `cnt`#20], 
partitionExpr=Optional[[c1#13, c3#18, t2_c2#19]], 
requireProperties=[DistributionSpecHash ( orderedShuffledColumns=[13, 18, 19], 
shuffleType=REQUIRE, tableId=-1, selectedIndexId=-1, partitionIds=[], 
equivalenceExprIds=[[13], [18], [19]], exprIdToEquivalenceSet={13=0, 18=1, 
19=2} ) Order:  [...]
-         +--PhysicalProject[318]@4 ( stats=1, projects=[substring(c2#14, 1, 3) 
AS `t2_c2`#19, c1#13, c3#18] )
-            +--PhysicalHashJoin[315]@3 ( type=INNER_JOIN, stats=1, 
hashCondition=[(c3#15 = c2#17)], otherCondition=[], markCondition=[] )
-               |--PhysicalOlapScan[t2]@0 ( stats=1 )
-               +--PhysicalDistribute[312]@2 ( stats=1, 
distributionSpec=DistributionSpecReplicated )
-                  +--PhysicalProject[309]@2 ( stats=1, projects=[c2#17, c3#18] 
)
-                     +--PhysicalOlapScan[t1]@1 ( stats=1 )
-
diff --git 
a/regression-test/suites/nereids_rules_p0/eliminate_gby_key/eliminate_gby_key.groovy
 
b/regression-test/suites/nereids_rules_p0/eliminate_gby_key/eliminate_gby_key.groovy
index 831e5e6eb3f..e092ad71e4e 100644
--- 
a/regression-test/suites/nereids_rules_p0/eliminate_gby_key/eliminate_gby_key.groovy
+++ 
b/regression-test/suites/nereids_rules_p0/eliminate_gby_key/eliminate_gby_key.groovy
@@ -45,8 +45,9 @@ suite("eliminate_gby_key") {
     alter table t2 add constraint t2_c1_pk primary key (c1);
     """
 
-    qt_1 """
-        explain physical plan
+    explain {
+       sql("""
+        physical plan
         with temp
              as (select substr(t2.c2, 1, 3) t2_c2,
                         t2.c1               t2_c1,
@@ -60,10 +61,13 @@ suite("eliminate_gby_key") {
                            t1.c3)
         select t2_c1
         from   temp; 
-    """
+       """)
+       contains("groupByExpr=[c1#13, c3#18], outputExpr=[c1#13, c3#18]")
+    }
 
-    qt_2 """
-        explain physical plan
+    explain {
+       sql("""
+        physical plan
         with temp
              as (select substr(t2.c2, 1, 3) t2_c2,
                         t2.c1               t2_c1,
@@ -77,10 +81,13 @@ suite("eliminate_gby_key") {
                            t1.c3)
         select t2_c2
         from   temp;
-    """
+       """)
+       contains("groupByExpr=[c1#13, c3#18, t2_c2#19], outputExpr=[c1#13, 
c3#18, t2_c2#19]")
+    }
 
-    qt_3 """
-        explain physical plan
+    explain {
+        sql("""
+        physical plan
         with temp
              as (select substr(t2.c2, 1, 3) t2_c2,
                         t2.c1                t2_c1,
@@ -94,10 +101,13 @@ suite("eliminate_gby_key") {
                            t1.c3)
         select c3
         from   temp; 
-    """
+       """)
+       contains("groupByExpr=[c1#13, c3#18], outputExpr=[c1#13, c3#18]")
+    }
 
-    qt_4 """
-        explain physical plan
+    explain {
+       sql("""
+        physical plan
         with temp
              as (select substr(t2.c2, 1, 3) t2_c2,
                         t2.c1                t2_c1,
@@ -111,10 +121,13 @@ suite("eliminate_gby_key") {
                            t1.c3)
         select cnt
         from   temp; 
-    """
+       """)
+       contains("groupByExpr=[c1#13, c3#18], outputExpr=[c1#13, c3#18, 
count(*) AS `cnt`#20]")
+    }
 
-    qt_5 """
-        explain physical plan
+    explain {
+       sql("""
+        physical plan
         with temp
              as (select substr(t2.c2, 1, 3) t2_c2,
                         t2.c1                t2_c1,
@@ -128,10 +141,13 @@ suite("eliminate_gby_key") {
                            t1.c3)
         select t2_c2, t2_c1
         from   temp; 
-    """
+       """)
+       contains("groupByExpr=[c1#13, c3#18, t2_c2#19], outputExpr=[c1#13, 
c3#18, t2_c2#19]")
+    }
 
-    qt_6 """
-        explain physical plan
+    explain {
+       sql("""
+        physical plan
         with temp
              as (select substr(t2.c2, 1, 3) t2_c2,
                         t2.c1                t2_c1,
@@ -145,10 +161,13 @@ suite("eliminate_gby_key") {
                            t1.c3)
         select c3, t2_c1
         from   temp; 
-    """
+       """)
+       contains("groupByExpr=[c1#13, c3#18], outputExpr=[c1#13, c3#18]")
+    }
 
-    qt_7 """
-        explain physical plan
+    explain {
+       sql("""
+        physical plan
         with temp
              as (select substr(t2.c2, 1, 3) t2_c2,
                         t2.c1                t2_c1,
@@ -162,10 +181,13 @@ suite("eliminate_gby_key") {
                            t1.c3)
         select c3, t2_c2
         from   temp; 
-    """
+       """)
+       contains("groupByExpr=[c1#13, c3#18, t2_c2#19], outputExpr=[c1#13, 
c3#18, t2_c2#19]")
+    }  
 
-    qt_8 """
-        explain physical plan
+    explain {
+       sql("""
+        physical plan
         with temp
              as (select substr(t2.c2, 1, 3) t2_c2,
                         t2.c1                t2_c1,
@@ -179,10 +201,13 @@ suite("eliminate_gby_key") {
                            t1.c3)
         select t2_c1, cnt
         from   temp; 
-    """
+       """)
+       contains("groupByExpr=[c1#13, c3#18], outputExpr=[c1#13, c3#18, 
count(*) AS `cnt`#20]")
+    }
 
-    qt_9 """
-        explain physical plan
+    explain {
+       sql("""
+        physical plan
         with temp
              as (select substr(t2.c2, 1, 3) t2_c2,
                         t2.c1                t2_c1,
@@ -196,10 +221,13 @@ suite("eliminate_gby_key") {
                            t1.c3)
         select c3, cnt
         from   temp; 
-    """
+       """)
+       contains("groupByExpr=[c1#13, c3#18], outputExpr=[c1#13, c3#18, 
count(*) AS `cnt`#20]")
+    }
 
-    qt_10 """
-        explain physical plan
+    explain {
+       sql("""
+        physical plan
         with temp
              as (select substr(t2.c2, 1, 3) t2_c2,
                         t2.c1                t2_c1,
@@ -213,10 +241,13 @@ suite("eliminate_gby_key") {
                            t1.c3)
         select t2_c1, c3, cnt
         from   temp; 
-    """
+       """)
+       contains("groupByExpr=[c1#13, c3#18], outputExpr=[c1#13, c3#18, 
count(*) AS `cnt`#20]")
+    }
 
-    qt_11 """
-        explain physical plan
+    explain {
+       sql("""
+        physical plan
         with temp
              as (select substr(t2.c2, 1, 3) t2_c2,
                         t2.c1                t2_c1,
@@ -230,10 +261,13 @@ suite("eliminate_gby_key") {
                            t1.c3)
         select t2_c2, c3, t2_c1
         from   temp; 
-    """
+       """)
+       contains("groupByExpr=[c1#13, c3#18, t2_c2#19], outputExpr=[c1#13, 
c3#18, t2_c2#19]")
+    }
 
-    qt_12 """
-        explain physical plan
+    explain {
+       sql("""
+        physical plan
         with temp
              as (select substr(t2.c2, 1, 3) t2_c2,
                         t2.c1                t2_c1,
@@ -247,5 +281,7 @@ suite("eliminate_gby_key") {
                            t1.c3)
         select t2_c2, c3, t2_c1, cnt
         from   temp; 
-    """
+       """)
+       contains("groupByExpr=[c1#13, c3#18, t2_c2#19], outputExpr=[c1#13, 
c3#18, t2_c2#19, count(*) AS `cnt`#20]")
+    }
 }


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to