XieJiann commented on code in PR #22123: URL: https://github.com/apache/doris/pull/22123#discussion_r1273477331
########## fe/fe-core/src/main/java/org/apache/doris/nereids/memo/Memo.java: ########## @@ -544,13 +559,25 @@ public void mergeGroup(Group source, Group destination) { reinsertGroupExpr.mergeTo(existGroupExpr); } else { // reinsertGroupExpr & existGroupExpr aren't in same group, need to merge their OwnerGroup. - mergeGroup(reinsertGroupExpr.getOwnerGroup(), existGroupExpr.getOwnerGroup()); + mergeGroup(reinsertGroupExpr.getOwnerGroup(), existGroupExpr.getOwnerGroup(), planTable); } } else { groupExpressions.put(reinsertGroupExpr, reinsertGroupExpr); } } + // replace source with destination in groups of planTable + if (planTable != null) { + planTable.forEach((bitset, group) -> { + if (group.equals(source)) { + planTable.put(bitset, destination); + } Review Comment: This should not be hit because the plan table with different bitset must have different outputs. ########## fe/fe-core/src/main/java/org/apache/doris/nereids/jobs/joinorder/hypergraph/receiver/PlanReceiver.java: ########## @@ -272,7 +273,7 @@ public void addGroup(long bitmap, Group group) { usdEdges.put(bitmap, new BitSet()); Plan plan = proposeProject(Lists.newArrayList(new GroupPlan(group)), new ArrayList<>(), bitmap, bitmap).get(0); if (!(plan instanceof GroupPlan)) { - CopyInResult copyInResult = jobContext.getCascadesContext().getMemo().copyIn(plan, null, false); + CopyInResult copyInResult = jobContext.getCascadesContext().getMemo().copyIn(plan, null, false, planTable); group = copyInResult.correspondingExpression.getOwnerGroup(); } Review Comment: planTable.put(group.ownerGroup) -- 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