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

jakevin 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 b3db904847 [fix](Nereids): when child is Aggregate, don't infer 
Distinct for it (#21519)
b3db904847 is described below

commit b3db90484726c458f09ce75cb8cefd2f2f37187b
Author: jakevin <jakevin...@gmail.com>
AuthorDate: Wed Jul 5 19:39:41 2023 +0800

    [fix](Nereids): when child is Aggregate, don't infer Distinct for it 
(#21519)
---
 .../doris/nereids/rules/rewrite/InferSetOperatorDistinct.java     | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/InferSetOperatorDistinct.java
 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/InferSetOperatorDistinct.java
index 9bb24869e4..b9f99c0758 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/InferSetOperatorDistinct.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/InferSetOperatorDistinct.java
@@ -50,7 +50,8 @@ public class InferSetOperatorDistinct extends 
OneRewriteRuleFactory {
                     }
 
                     List<Plan> newChildren = setOperation.children().stream()
-                            .map(child -> new 
LogicalAggregate<>(ImmutableList.copyOf(child.getOutput()), true, child))
+                            .map(child -> isAgg(child) ? child
+                                    : new 
LogicalAggregate<>(ImmutableList.copyOf(child.getOutput()), true, child))
                             .collect(ImmutableList.toImmutableList());
                     if (newChildren.equals(setOperation.children())) {
                         return null;
@@ -59,6 +60,11 @@ public class InferSetOperatorDistinct extends 
OneRewriteRuleFactory {
                 }).toRule(RuleType.INFER_SET_OPERATOR_DISTINCT);
     }
 
+    private boolean isAgg(Plan plan) {
+        return plan instanceof LogicalAggregate || (plan instanceof 
LogicalProject && plan.child(
+                0) instanceof LogicalAggregate);
+    }
+
     // if children exist NLJ, we can't infer distinct
     private boolean rejectNLJ(Plan plan) {
         if (plan instanceof LogicalProject) {


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

Reply via email to