-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Description
Is your feature request related to a problem or challenge?
Our database uses sqlparser to parse a custom SQL statement, and we skip the logical plan to directly construct an execution plan with DataFusion. This SQL statement includes a WHERE clause, so we need to construct a FilterExec. During the process of building FilterExec, we found that the create_physical_expr method from the datafusion-physical-expr module doesn’t perform type coercion, but instead assumes all expressions have already undergone type coercion.
To implement type coercion, we reviewed the DataFusion source code and found that from higher-level APIs to lower-level ones, there are several approaches that support type coercion for expressions:
- Using
SessionContext::create_physical_expr - Using
ExprSimplifier::coerce - Using
TreeNodeRewriter::rewrite based on TypeCoercionRewriter - Using
TreeNode::transform
In our case, we only want to perform type coercion on expressions, so TypeCoercionRewriter seems to be the best fit. However, we’re unable to create a TypeCoercionRewriter instance because its new method isn’t public.
We would like DataFusion to expose TypeCoercionRewriter::new. If there is another, simpler method to achieve this, please let us know. Thank you.
Describe the solution you'd like
No response
Describe alternatives you've considered
No response
Additional context
No response