You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by mo...@apache.org on 2022/12/30 08:33:30 UTC

[doris] branch master updated: [fix](nereids) the project node is lost when creating PhysicalStorageLayerAggregate node (#15467)

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

morrysnow pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/master by this push:
     new 93a25e1af5 [fix](nereids) the project node is lost when creating PhysicalStorageLayerAggregate node (#15467)
93a25e1af5 is described below

commit 93a25e1af53731b181d07f6112677f0e41ec278c
Author: starocean999 <40...@users.noreply.github.com>
AuthorDate: Fri Dec 30 16:33:24 2022 +0800

    [fix](nereids) the project node is lost when creating PhysicalStorageLayerAggregate node (#15467)
---
 .../doris/nereids/rules/rewrite/AggregateStrategies.java   | 14 ++++++++++----
 .../rewrite/logical/PhysicalStorageLayerAggregateTest.java | 12 +++++++++---
 regression-test/data/query_p0/keyword/order_group.out      |  2 ++
 regression-test/suites/query_p0/keyword/order_group.groovy |  1 +
 4 files changed, 22 insertions(+), 7 deletions(-)

diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/AggregateStrategies.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/AggregateStrategies.java
index 8377d1bcb0..05bd79c65d 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/AggregateStrategies.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/AggregateStrategies.java
@@ -284,10 +284,16 @@ public class AggregateStrategies implements ImplementationRuleFactory {
                 .build()
                 .transform(olapScan, cascadesContext)
                 .get(0);
-
-        return aggregate.withChildren(ImmutableList.of(
-            new PhysicalStorageLayerAggregate(physicalOlapScan, mergeOp)
-        ));
+        if (project != null) {
+            return aggregate.withChildren(ImmutableList.of(
+                    project.withChildren(
+                            ImmutableList.of(new PhysicalStorageLayerAggregate(physicalOlapScan, mergeOp)))
+            ));
+        } else {
+            return aggregate.withChildren(ImmutableList.of(
+                    new PhysicalStorageLayerAggregate(physicalOlapScan, mergeOp)
+            ));
+        }
     }
 
     /**
diff --git a/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/rewrite/logical/PhysicalStorageLayerAggregateTest.java b/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/rewrite/logical/PhysicalStorageLayerAggregateTest.java
index dac706d825..9b767e1c57 100644
--- a/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/rewrite/logical/PhysicalStorageLayerAggregateTest.java
+++ b/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/rewrite/logical/PhysicalStorageLayerAggregateTest.java
@@ -120,7 +120,9 @@ public class PhysicalStorageLayerAggregateTest implements GeneratedPatterns {
                 .applyImplementation(storageLayerAggregateWithProject())
                 .matches(
                     logicalAggregate(
-                        physicalStorageLayerAggregate().when(agg -> agg.getAggOp() == PushDownAggOp.MIN_MAX)
+                        logicalProject(
+                            physicalStorageLayerAggregate().when(agg -> agg.getAggOp() == PushDownAggOp.MIN_MAX)
+                        )
                     )
                 );
 
@@ -135,7 +137,9 @@ public class PhysicalStorageLayerAggregateTest implements GeneratedPatterns {
                 .applyImplementation(storageLayerAggregateWithProject())
                 .matches(
                     logicalAggregate(
-                        physicalStorageLayerAggregate().when(agg -> agg.getAggOp() == PushDownAggOp.COUNT)
+                        logicalProject(
+                            physicalStorageLayerAggregate().when(agg -> agg.getAggOp() == PushDownAggOp.COUNT)
+                        )
                     )
                 );
 
@@ -152,7 +156,9 @@ public class PhysicalStorageLayerAggregateTest implements GeneratedPatterns {
                 .applyImplementation(storageLayerAggregateWithProject())
                 .matches(
                     logicalAggregate(
-                        physicalStorageLayerAggregate().when(agg -> agg.getAggOp() == PushDownAggOp.MIX)
+                        logicalProject(
+                            physicalStorageLayerAggregate().when(agg -> agg.getAggOp() == PushDownAggOp.MIX)
+                        )
                     )
                 );
     }
diff --git a/regression-test/data/query_p0/keyword/order_group.out b/regression-test/data/query_p0/keyword/order_group.out
index 89177bcedf..9445f24208 100644
--- a/regression-test/data/query_p0/keyword/order_group.out
+++ b/regression-test/data/query_p0/keyword/order_group.out
@@ -1390,3 +1390,5 @@ true	0.1
 -- !group31 --
 1
 
+-- !group1 --
+123.123000000
diff --git a/regression-test/suites/query_p0/keyword/order_group.groovy b/regression-test/suites/query_p0/keyword/order_group.groovy
index d57d088545..6e6d3bc9b7 100644
--- a/regression-test/suites/query_p0/keyword/order_group.groovy
+++ b/regression-test/suites/query_p0/keyword/order_group.groovy
@@ -210,4 +210,5 @@ suite("order_group", "query,p0") {
     sql 'set enable_fallback_to_original_planner=false'
     qt_group31 "select count(*) from ${tableName1} where (k11='2015-03-13 12:36:38' or k11 = '2000-01-01 00:00:00')\
 		    and k5 is not null group by k1%2, k2%2, k3%3, k4%3, k11%2 order by count(*)"
+    qt_group1 "select min(k5) from ${tableName1}"
 }


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org