morrySnow commented on code in PR #15833: URL: https://github.com/apache/doris/pull/15833#discussion_r1067844668
########## fe/fe-core/src/main/java/org/apache/doris/nereids/memo/Memo.java: ########## @@ -465,6 +468,8 @@ public Group mergeGroup(Group source, Group destination) { source.moveOwnership(destination); groups.remove(source.getGroupId()); } + + needMergeGroups.forEach(this::mergeGroup); Review Comment: consider a scenario: if we have two entry in the map: B -> A and C -> B. when we do merge group. we first merge B to A, and then B is removed. after that, we want to merge C to B, but B is not exist anymore. So, maybe we need to use **disjoint set** do find a common parent, and then merge all other group to it in one **disjoint set**. -- 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