peter-toth commented on code in PR #10115:
URL: 
https://github.com/apache/arrow-datafusion/pull/10115#discussion_r1569102800


##########
datafusion/optimizer/src/unwrap_cast_in_comparison.rs:
##########
@@ -140,140 +139,132 @@ struct UnwrapCastExprRewriter {
 impl TreeNodeRewriter for UnwrapCastExprRewriter {
     type Node = Expr;
 
-    fn f_up(&mut self, expr: Expr) -> Result<Transformed<Expr>> {
-        match &expr {
+    fn f_up(&mut self, mut expr: Expr) -> Result<Transformed<Expr>> {
+        match &mut expr {

Review Comment:
   I was trying a few different patterns to remove `Expr` clones in this rule. 
The `match &mut expr` way seems to be most straightforward as `expr` is still 
available after pattern matching so we can return it unchanged if needed 
(`return Ok(Transformed::no(expr));`) but we can also mutate some parts of the 
`expr` if needed.



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

Reply via email to