-
Notifications
You must be signed in to change notification settings - Fork 28.9k
[SPARK-34504][SQL] Avoid unnecessary resolving of SQL temp views for DDL commands #31853
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
| // inside a view maybe resolved incorrectly. | ||
| // But for commands like `DropViewCommand`, resolving view is unnecessary even though | ||
| // there is unresolved node. So use the `performCheck` flag to skip the analysis check | ||
| // for these commands. |
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 trick doesn't always work. Sometimes the analyzer may fail eagerly instead of waiting for checkAnalysis.
| .getOrElse(u) | ||
| } | ||
|
|
||
| def lookupTempView( |
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.
private?
| tmpView | ||
| } | ||
|
|
||
| def lookupAndResolveTempView( |
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.
ditto: private?
maropu
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 fine if the tests pass.
|
Kubernetes integration test starting |
|
Kubernetes integration test status failure |
imback82
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.
LGTM
|
Test build #136119 has finished for PR 31853 at commit
|
|
Hm, the scala-2.13 build failure seems to be not related to this PR and it is reported in https://issues.apache.org/jira/browse/SPARK-34762. |
|
yea the scala 2.13 issue is not related, I'm merging it to master/3.1, thanks for the review! |
…DDL commands For DDL commands like DROP VIEW, they don't really need to resolve the view (parse and analyze the view SQL text), they just need to get the view metadata. This PR fixes the rule `ResolveTempViews` to only resolve the temp view for `UnresolvedRelation`. This also fixes a bug for DROP VIEW, as previously it tried to resolve the view and failed to drop invalid views. bug fix no new test Closes #31853 from cloud-fan/view-resolve. Authored-by: Wenchen Fan <[email protected]> Signed-off-by: Wenchen Fan <[email protected]> (cherry picked from commit af55373) Signed-off-by: Wenchen Fan <[email protected]>
|
late LGTM |
…DDL commands For DDL commands like DROP VIEW, they don't really need to resolve the view (parse and analyze the view SQL text), they just need to get the view metadata. This PR fixes the rule `ResolveTempViews` to only resolve the temp view for `UnresolvedRelation`. This also fixes a bug for DROP VIEW, as previously it tried to resolve the view and failed to drop invalid views. bug fix no new test Closes apache#31853 from cloud-fan/view-resolve. Authored-by: Wenchen Fan <[email protected]> Signed-off-by: Wenchen Fan <[email protected]> (cherry picked from commit af55373) Signed-off-by: Wenchen Fan <[email protected]>
…DDL commands For DDL commands like DROP VIEW, they don't really need to resolve the view (parse and analyze the view SQL text), they just need to get the view metadata. This PR fixes the rule `ResolveTempViews` to only resolve the temp view for `UnresolvedRelation`. This also fixes a bug for DROP VIEW, as previously it tried to resolve the view and failed to drop invalid views. bug fix no new test Closes apache#31853 from cloud-fan/view-resolve. Authored-by: Wenchen Fan <[email protected]> Signed-off-by: Wenchen Fan <[email protected]> (cherry picked from commit af55373) Signed-off-by: Wenchen Fan <[email protected]>
What changes were proposed in this pull request?
For DDL commands like DROP VIEW, they don't really need to resolve the view (parse and analyze the view SQL text), they just need to get the view metadata.
This PR fixes the rule
ResolveTempViewsto only resolve the temp view forUnresolvedRelation. This also fixes a bug for DROP VIEW, as previously it tried to resolve the view and failed to drop invalid views.Why are the changes needed?
bug fix
Does this PR introduce any user-facing change?
no
How was this patch tested?
new test