Dandandan commented on code in PR #20111:
URL: https://github.com/apache/datafusion/pull/20111#discussion_r2755751620


##########
datafusion/physical-expr/src/simplifier/mod.rs:
##########
@@ -58,11 +67,11 @@ impl<'a> PhysicalExprSimplifier<'a> {
 
                 // Apply NOT expression simplification first, then unwrap cast 
optimization,
                 // then constant expression evaluation
-                let rewritten = simplify_not_expr(&node, schema)?
+                let rewritten = simplify_not_expr(node, schema)?
+                    .transform_data(|node| unwrap_cast_in_comparison(node, 
schema))?
                     .transform_data(|node| {
-                        unwrap_cast::unwrap_cast_in_comparison(node, schema)
-                    })?
-                    .transform_data(|node| 
const_evaluator::simplify_const_expr(&node))?;
+                        simplify_const_expr_with_dummy(node, &batch)

Review Comment:
   Looking more at the implementation, I believe 
`simplify_const_expr_with_dummy` should be called outside of the `transform` 
loop (the expression either does or does not evaluate to a constant - no need 
to do it recursively as the evaluation already is recursive)



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