alamb commented on code in PR #5092:
URL: https://github.com/apache/arrow-datafusion/pull/5092#discussion_r1091075063


##########
datafusion/expr/src/expr_rewriter.rs:
##########
@@ -519,6 +495,49 @@ pub fn unnormalize_cols(exprs: impl IntoIterator<Item = 
Expr>) -> Vec<Expr> {
     exprs.into_iter().map(unnormalize_col).collect()
 }
 
+struct RewriterAdapter<F> {
+    f: F,
+}
+
+impl<F> ExprRewriter for RewriterAdapter<F>
+where
+    F: FnMut(Expr) -> Result<Expr>,
+{
+    fn mutate(&mut self, expr: Expr) -> Result<Expr> {

Review Comment:
   That is an interesting idea. What usecase do you have in mind? 
   
   Since `mutate` takes the expr by ownership (rather than by reference), I 
think returning `expr` would be the same as not changing the original `expr` 
(perhaps the same as returning `None`?)
   
   However, I do wonder what actually happens when rewriting Boxed exprs 🤔 
maybe they are still copied



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