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 4c36e3dfa6 [fix](Nereids)LogicalAggregate's equals and hashCode 
missing two attributes (#12393)
4c36e3dfa6 is described below

commit 4c36e3dfa651b6ea81a2da2a516e479c26bef88a
Author: minghong <minghong.z...@163.com>
AuthorDate: Wed Sep 7 00:07:26 2022 +0800

    [fix](Nereids)LogicalAggregate's equals and hashCode missing two attributes 
(#12393)
    
    After applying NormalizeAggregate rule, owner groups of all aggregate 
children are removed.
    The root cause is the new aggregate node is regarded as the old aggregate 
node, because LogicalAggregate.equals() does not take some attributes 
("normalized", "disassembled") into account.
---
 .../nereids/trees/plans/logical/LogicalAggregate.java     |  6 ++++--
 .../apache/doris/nereids/trees/plans/PlanEqualsTest.java  | 15 +++++++++++++++
 2 files changed, 19 insertions(+), 2 deletions(-)

diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/logical/LogicalAggregate.java
 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/logical/LogicalAggregate.java
index acdcbd173b..b9aa420f06 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/logical/LogicalAggregate.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/logical/LogicalAggregate.java
@@ -160,12 +160,14 @@ public class LogicalAggregate<CHILD_TYPE extends Plan> 
extends LogicalUnary<CHIL
         LogicalAggregate that = (LogicalAggregate) o;
         return Objects.equals(groupByExpressions, that.groupByExpressions)
                 && Objects.equals(outputExpressions, that.outputExpressions)
-                && aggPhase == that.aggPhase;
+                && aggPhase == that.aggPhase
+                && disassembled == that.disassembled
+                && normalized == that.normalized;
     }
 
     @Override
     public int hashCode() {
-        return Objects.hash(groupByExpressions, outputExpressions, aggPhase);
+        return Objects.hash(groupByExpressions, outputExpressions, aggPhase, 
normalized, disassembled);
     }
 
     @Override
diff --git 
a/fe/fe-core/src/test/java/org/apache/doris/nereids/trees/plans/PlanEqualsTest.java
 
b/fe/fe-core/src/test/java/org/apache/doris/nereids/trees/plans/PlanEqualsTest.java
index 5f72875361..13f01ea491 100644
--- 
a/fe/fe-core/src/test/java/org/apache/doris/nereids/trees/plans/PlanEqualsTest.java
+++ 
b/fe/fe-core/src/test/java/org/apache/doris/nereids/trees/plans/PlanEqualsTest.java
@@ -68,6 +68,21 @@ public class PlanEqualsTest {
                 new SlotReference(new ExprId(1), "b", BigIntType.INSTANCE, 
true, Lists.newArrayList())),
                 child);
         Assertions.assertNotEquals(unexpected, actual);
+
+        unexpected = new LogicalAggregate<>(Lists.newArrayList(), 
ImmutableList.of(
+                new SlotReference(new ExprId(1), "b", BigIntType.INSTANCE, 
true, Lists.newArrayList())),
+                true, false, AggPhase.GLOBAL, child);
+        Assertions.assertNotEquals(unexpected, actual);
+
+        unexpected = new LogicalAggregate<>(Lists.newArrayList(), 
ImmutableList.of(
+                new SlotReference(new ExprId(1), "b", BigIntType.INSTANCE, 
true, Lists.newArrayList())),
+                false, true, AggPhase.GLOBAL, child);
+        Assertions.assertNotEquals(unexpected, actual);
+
+        unexpected = new LogicalAggregate<>(Lists.newArrayList(), 
ImmutableList.of(
+                new SlotReference(new ExprId(1), "b", BigIntType.INSTANCE, 
true, Lists.newArrayList())),
+                false, false, AggPhase.LOCAL, child);
+        Assertions.assertNotEquals(unexpected, actual);
     }
 
     @Test


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

Reply via email to