924060929 commented on code in PR #70666:
URL: https://github.com/apache/doris/pull/70666#discussion_r4676973719


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/memo/GroupExpression.java:
##########
@@ -296,6 +303,8 @@ public void mergeToNotOwnerRemove(GroupExpression target) {
         this.children.forEach(child -> child.removeParentExpression(this));
         this.children.clear();
         this.ownerGroup = null;
+        // Mark unused only after detaching: a recursive owner-group merge can 
be rejected to avoid a cycle.
+        this.setUnused(true);

Review Comment:
   Fixed in 853393c954f8d1441e633721559db1fbc186b150.
   
   Confirmed with the registered MergeProjectsCBO rule and public copyIn 
operations: the new test fails on e6adc8e22cb because the remaining P(L) 
candidate is disconnected from the root. ApplyRuleJob now keeps a local 
insertion target and follows the canonical result's owner only when copyIn 
removed that target from the Memo. A refused merge retains the registered 
target.
   
   All eight projection cases pass. The new case also costs the prepared Memo 
and verifies that the remaining candidate participates in selecting a plan with 
one physical projection. This adds no graph search or per-expression forwarding 
state.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to