-
Notifications
You must be signed in to change notification settings - Fork 28.4k
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-50600][CONNECT][SQL] Set analyzed on analysis failure #49383
base: master
Are you sure you want to change the base?
Conversation
815a10c
to
d69efe0
Compare
5ef6c5c
to
5863371
Compare
29333e8
to
771da36
Compare
771da36
to
11d42f2
Compare
@@ -147,6 +157,17 @@ class QueryPlanningTracker( | |||
ret | |||
} | |||
|
|||
/** | |||
* Set when the query has been parsed. |
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.
* Set when the query has been parsed. | |
* Set when the query has been parsed but failed to be analyzed. |
@@ -145,13 +145,19 @@ case class ExecuteEventsManager(executeHolder: ExecuteHolder, clock: Clock) { | |||
* | |||
* @param analyzedPlan | |||
* The analyzed plan generated by the Connect request plan. None when the request does not | |||
* generate a Spark plan or analysis fails. | |||
* @param parsedPlan | |||
* The analyzed plan generated by the Connect request plan. None when the request does not |
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.
does not fail analysis?
@@ -251,6 +257,10 @@ case class ExecuteEventsManager(executeHolder: ExecuteHolder, clock: Clock) { | |||
postAnalyzed(Some(analyzedPlan)) | |||
} | |||
|
|||
override def analysisFailed(tracker: QueryPlanningTracker, parsedPlan: LogicalPlan): Unit = { | |||
postAnalyzed(None, Some(parsedPlan)) |
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.
postAnalyzed(None, Some(parsedPlan)) | |
postAnalyzed(parsedPlan = Some(parsedPlan)) |
@@ -342,9 +352,15 @@ case class SparkListenerConnectOperationAnalyzed( | |||
extends SparkListenerEvent { | |||
|
|||
/** | |||
* Analyzed Spark plan generated by the Connect request. None when the Connect request does not | |||
* Parsed Spark plan generated by the Connect request. None when the Connect request does not | |||
* generate a Spark plan. |
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, it's None when request is analyzed successfully?
val plan = executePhase(QueryPlanningTracker.ANALYSIS) { | ||
// We can't clone `logical` here, which will reset the `_analyzed` flag. | ||
sparkSession.sessionState.analyzer.executeAndCheck(logical, tracker) | ||
val plan = Try { |
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.
can we use the primitive try?
try {
val plan = ...
...
} catch {
case NonFatal(_) => tracker. setAnalysisFailed...
}
What changes were proposed in this pull request?
As part of SPARK-44145, a callback was added to track completion of analysis and optimization phase of a query. While the analyzed plan is sent when analysis completes successfully it does not when it fail. In that case, we should fallback to the ParsedPlan.
Why are the changes needed?
The purpose of the analyze event is to track when analysis completes, as such it should also be sent on both success & failure.
Does this PR introduce any user-facing change?
No
How was this patch tested?
Unit
Was this patch authored or co-authored using generative AI tooling?
No