adriangb commented on code in PR #22298:
URL: https://github.com/apache/datafusion/pull/22298#discussion_r3262038382


##########
datafusion/optimizer/src/optimizer.rs:
##########
@@ -357,6 +360,95 @@ impl TreeNodeRewriter for Rewriter<'_> {
     }
 }
 
+/// Rewrites a plan tree in place using `Arc::make_mut` for
+/// copy-on-write semantics on `Arc<LogicalPlan>` children.
+///
+/// This avoids the `Arc::unwrap_or_clone` + `Arc::new` cycle that the
+/// ownership-based `TreeNode::rewrite` performs at every child node.
+/// When the `Arc` refcount is 1 (always true in the optimizer),

Review Comment:
   I think it's _usually_ true except for stuff like 
`DynamicFilterPhsyicalExpr`. But I'll remove the comment, I don't think it's 
helpful.



-- 
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