englefly commented on code in PR #11717: URL: https://github.com/apache/doris/pull/11717#discussion_r944146690
########## fe/fe-core/src/main/java/org/apache/doris/nereids/memo/Memo.java: ########## @@ -169,7 +169,8 @@ private Pair<Boolean, GroupExpression> rewriteGroupExpression( GroupExpression groupExpression, Group target, LogicalProperties logicalProperties) { boolean newGroupExpressionGenerated = true; GroupExpression existedGroupExpression = groupExpressions.get(groupExpression); - if (existedGroupExpression != null) { + if (existedGroupExpression != null + && (target == null || target.equals(existedGroupExpression.getOwnerGroup()))) { Review Comment: if target is not null, and not the owner group of existedGroupExpression, should we merge them, as we do in insertGroupExpression()? Otherwise, there are two groups with equivalent group expressions in Memo. I think this issue is introduced by former pr, which split insertGroupExpression() and rewriteGroupExpression() from insertOrRewriteGroupExpression(). -- 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