-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Qualified field resolution too strict #810
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
Conversation
houqp
left a comment
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.
good catch 👍
|
@houqp Thank you for your comments. I have addressed them and pushed the new code. |
houqp
left a comment
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 @seddonm1 !
|
thanks @houqp ! |
alamb
left a comment
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.
Looks good to me -- thanks @seddonm1 I have some stylistic questions, but the tests look good to me 👍
datafusion/src/sql/planner.rs
Outdated
|
|
||
| /// Rewrite aliases which are not-complete (e.g. ones that only include only table qualifier in a schema.table qualified relation) | ||
| fn rewrite_partial_qualifier(&self, expr: Expr, schema: &DFSchema) -> Expr { | ||
| match expr.clone() { |
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.
given you are passing in expr here, I wonder if we could remove the call to clone and save a copy?
| let expr = self.sql_expr_to_logical_expr(sql, schema)?; | ||
| let mut expr = self.sql_expr_to_logical_expr(sql, schema)?; | ||
| self.validate_schema_satisfies_exprs(schema, &[expr.clone()])?; | ||
| expr = self.rewrite_partial_qualifier(expr, 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.
I wonder if we should do the rewrite prior to calling validate_schema_satisfies_exprs?
|
@alamb I have taken your feedback and managed to remove the dfschema.rs changes entirely. I think this is ready now. |
alamb
left a comment
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.
I think it looks very good -- thanks @seddonm1. Thank you.
Which issue does this PR close?
Closes #809.
Rationale for this change
Due to the way the field qualification works a query this does not work as technically the field is qualified but the matching only works on complete matches between the field qualifier
personand the schema qualifierpublic.person.What changes are included in this PR?
This PR adds:
Are there any user-facing changes?
No, just more standard Postgres SQL will work.