alamb commented on code in PR #10330:
URL: https://github.com/apache/datafusion/pull/10330#discussion_r1587503305
##########
datafusion/core/src/execution/context/mod.rs:
##########
@@ -1947,6 +1982,36 @@ impl SessionState {
.await
}
+ /// Create a [`PhysicalExpr`] from an [`Expr`] after applying type
+ /// coercion, and function rewrites.
+ ///
+ /// Note: The expression is not [simplified]
Review Comment:
My rationale was that simplification is substantially more expensive due to
the rewrites required and is not strictly necessary for evaluation, so I felt
not simplifying would be less surprising
Also, if we are going to do simplification, it might also be reasonable to
ask "why not other optimization like [comparison cast
unwrapping](https://docs.rs/datafusion/latest/datafusion/optimizer/unwrap_cast_in_comparison/index.html)"
too
I think it is important to apply coercion as is very hard to create the
right expression to get the type exactly aligned resulting in hard to fix
errors. Same thing for this function rewriting.
I'll add this context to the comments in this PR
--
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]