-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve coerce API so it does not need DFSchema #10331
Conversation
@@ -258,7 +258,7 @@ pub fn physical_expr(schema: &Schema, expr: Expr) -> Result<Arc<dyn PhysicalExpr | |||
ExprSimplifier::new(SimplifyContext::new(&props).with_schema(df_schema.clone())); | |||
|
|||
// apply type coercion here to ensure types match | |||
let expr = simplifier.coerce(expr, df_schema.clone())?; | |||
let expr = simplifier.coerce(expr, &df_schema)?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This shows the effect of this API change on users (add a &)
// it manually. | ||
// https://github.com/apache/datafusion/issues/3793 | ||
pub fn coerce(&self, expr: Expr, schema: DFSchemaRef) -> Result<Expr> { | ||
pub fn coerce(&self, expr: Expr, schema: &DFSchema) -> Result<Expr> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the actual change (I don't think making it take SimplifyInfo
is practical given how much coerce does)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Thank you for the review @jayzhan211 |
Which issue does this PR close?
Closes #3793
Rationale for this change
&DFSchema
rather than an ownedWhat changes are included in this PR?
Change
coerce
API fromto
Are these changes tested?
By existing CI
Are there any user-facing changes?
The API to call coerce is slightly changed. Note I am in the process of adding a proper fully baked API in #10181