Dandandan opened a new issue, #3431:
URL: https://github.com/apache/arrow-datafusion/issues/3431

   **Is your feature request related to a problem or challenge? Please describe 
what you are trying to do.**
   The recently added an optimizer pass that performs type coercion on the 
logical plan.
   There is some oppurtunity to simplify the expressions as often it creates 
casts on constants, like:
   
   `CAST(Int64(1) AS Float32)`
   
   This could be const evaluated to:
   `Float32(1.0)`
   
   Simplifying the plan and leaving more room for further optimization.
   
   **Describe the solution you'd like**
   When wrapping the expression in a cast, we can directly evaluate the result. 
Alternatively we could run the "simplify_expressions" again after type 
coercion, however this seems unneeded.
   It seems we can use the `evaluate_to_scalar` function to evaluate the 
created `Expr`
   
https://github.com/apache/arrow-datafusion/blob/master/datafusion/optimizer/src/simplify_expressions.rs#L487
   
   **Describe alternatives you've considered**
   n/a
   
   **Additional context**
   


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