-
Notifications
You must be signed in to change notification settings - Fork 28.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
[SPARK-34504][SQL] Avoid unnecessary resolving of SQL temp views for DDL commands #31853
Conversation
@@ -1147,16 +1152,10 @@ class Analyzer(override val catalogManager: CatalogManager) | |||
} | |||
// Fail the analysis eagerly because outside AnalysisContext, the unresolved operators | |||
// 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
.
@@ -950,8 +950,7 @@ class Analyzer(override val catalogManager: CatalogManager) | |||
|
|||
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?
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 |
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 <wenchen@databricks.com> Signed-off-by: Wenchen Fan <wenchen@databricks.com> (cherry picked from commit af55373) Signed-off-by: Wenchen Fan <wenchen@databricks.com>
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 <wenchen@databricks.com> Signed-off-by: Wenchen Fan <wenchen@databricks.com> (cherry picked from commit af55373) Signed-off-by: Wenchen Fan <wenchen@databricks.com>
…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 <wenchen@databricks.com> Signed-off-by: Wenchen Fan <wenchen@databricks.com> (cherry picked from commit af55373) Signed-off-by: Wenchen Fan <wenchen@databricks.com>
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
ResolveTempViews
to 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