You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by "jackwener (via GitHub)" <gi...@apache.org> on 2023/04/19 12:29:00 UTC

[GitHub] [doris] jackwener commented on a diff in pull request #18687: [enhance](Nereids): memo get needReplaceChild by getParentGroupExpressions().

jackwener commented on code in PR #18687:
URL: https://github.com/apache/doris/pull/18687#discussion_r1171265536


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/memo/Memo.java:
##########
@@ -450,21 +451,23 @@ private CopyInResult insertGroupExpression(
      *
      * @param source source group
      * @param destination destination group
-     * @return merged group
      */
-    public Group mergeGroup(Group source, Group destination) {
+    public void mergeGroup(Group source, Group destination) {
         if (source.equals(destination)) {
-            return source;
+            return;
         }
         List<GroupExpression> needReplaceChild = Lists.newArrayList();
-        for (GroupExpression groupExpression : groupExpressions.values()) {
-            if (groupExpression.children().contains(source)) {
-                if (groupExpression.getOwnerGroup().equals(destination)) {
-                    // cycle, we should not merge
-                    return null;
-                }
-                needReplaceChild.add(groupExpression);
+        for (GroupExpression parent : source.getParentGroupExpressions()) {
+            if (parent.getOwnerGroup().equals(destination)) {

Review Comment:
   It's a good question, we need think about it in following PR.



-- 
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-unsubscribe@doris.apache.org

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


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