morrySnow commented on code in PR #10891:
URL: https://github.com/apache/doris/pull/10891#discussion_r922140493


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/memo/Memo.java:
##########
@@ -82,13 +83,15 @@ public GroupExpression copyIn(Plan node, @Nullable Group 
target, boolean rewrite
             } else if (child.getGroupExpression().isPresent()) {
                 
childrenGroups.add(child.getGroupExpression().get().getParent());
             } else {
-                childrenGroups.add(copyIn(child, null, rewrite).getParent());
+                childrenGroups.add(copyIn(child, null, 
rewrite).second.getParent());
             }
         }
         node = replaceChildrenToGroupPlan(node, childrenGroups);
         GroupExpression newGroupExpression = new GroupExpression(node);
         newGroupExpression.setChildren(childrenGroups);
-        return insertOrRewriteGroupExpression(newGroupExpression, target, 
rewrite, node.getLogicalProperties());
+        newGroupExpression = 
insertOrRewriteGroupExpression(newGroupExpression, target, rewrite,

Review Comment:
   insertOrRewriteGroupExpression could also return exist group expression



##########
fe/fe-core/src/main/java/org/apache/doris/nereids/jobs/cascades/ApplyRuleJob.java:
##########
@@ -63,7 +63,7 @@ public void execute() throws AnalysisException {
             List<Plan> newPlans = rule.transform(plan, 
context.getPlannerContext());
             for (Plan newPlan : newPlans) {
                 GroupExpression newGroupExpression = 
context.getPlannerContext().getMemo()
-                        .copyIn(newPlan, groupExpression.getParent(), 
rule.isRewrite());
+                        .copyIn(newPlan, groupExpression.getParent(), 
rule.isRewrite()).second;

Review Comment:
   when we return a exist group expression, maybe we could just return



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


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

Reply via email to