You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by kx...@apache.org on 2023/07/14 10:33:40 UTC

[doris] 11/18: [fix](Nereids) use groupExpr's children to make logicalPlan (#21794)

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

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

commit 466b7b854dc2878f28608386da9f7893c6021f2f
Author: 谢健 <ji...@gmail.com>
AuthorDate: Fri Jul 14 11:41:38 2023 +0800

    [fix](Nereids) use groupExpr's children to make logicalPlan (#21794)
    
    After mergeGroup, the children of the plan are different from GroupExpr. To avoid optimizing out-dated group, we should construct new plan with groupExpr's children rather than plan's children
---
 .../nereids/jobs/joinorder/hypergraph/receiver/PlanReceiver.java    | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/jobs/joinorder/hypergraph/receiver/PlanReceiver.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/jobs/joinorder/hypergraph/receiver/PlanReceiver.java
index be7e462b49..8023d806da 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/nereids/jobs/joinorder/hypergraph/receiver/PlanReceiver.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/jobs/joinorder/hypergraph/receiver/PlanReceiver.java
@@ -306,7 +306,7 @@ public class PlanReceiver implements AbstractReceiver {
             }
             hasGenerated.add(groupExpression);
 
-            // process child first
+            // process child first, plan's child may be changed due to mergeGroup
             Plan physicalPlan = groupExpression.getPlan();
             for (Group child : groupExpression.children()) {
                 makeLogicalExpression(child);
@@ -316,12 +316,12 @@ public class PlanReceiver implements AbstractReceiver {
             if (physicalPlan instanceof PhysicalProject) {
                 PhysicalProject physicalProject = (PhysicalProject) physicalPlan;
                 logicalPlan = new LogicalProject<>(physicalProject.getProjects(),
-                        physicalProject.child(0));
+                        new GroupPlan(groupExpression.child(0)));
             } else if (physicalPlan instanceof AbstractPhysicalJoin) {
                 AbstractPhysicalJoin physicalJoin = (AbstractPhysicalJoin) physicalPlan;
                 logicalPlan = new LogicalJoin<>(physicalJoin.getJoinType(), physicalJoin.getHashJoinConjuncts(),
                         physicalJoin.getOtherJoinConjuncts(), JoinHint.NONE, physicalJoin.getMarkJoinSlotReference(),
-                        physicalJoin.children());
+                        groupExpression.children().stream().map(g -> new GroupPlan(g)).collect(Collectors.toList()));
             } else {
                 throw new RuntimeException("DPhyp can only handle join and project operator");
             }


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