morrySnow commented on code in PR #12396: URL: https://github.com/apache/doris/pull/12396#discussion_r964323933
########## fe/fe-core/src/main/java/org/apache/doris/nereids/memo/Memo.java: ########## @@ -309,16 +310,11 @@ private Group mergeGroup(Group source, Group destination) { if (source.equals(destination)) { return source; } - List<GroupExpression> needReplaceChild = Lists.newArrayList(); - groupExpressions.values().forEach(groupExpression -> { - if (groupExpression.children().contains(source)) { - if (groupExpression.getOwnerGroup().equals(destination)) { - // cycle, we should not merge - return; - } - needReplaceChild.add(groupExpression); - } - }); + List<GroupExpression> needReplaceChild = groupExpressions.values().stream() + .filter(groupExpression -> groupExpression.children().contains(source)) + // cycle, we should not merge + .filter(groupExpression -> !groupExpression.getOwnerGroup().equals(destination)) + .collect(Collectors.toList()); Review Comment: the new statement do not equal with the old one. Since old one will return immediately if any groupExpression's owner group is not destination -- 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