-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-29530][SQL] Make SQLConf in SQL parse process thread safe #26187
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -600,6 +600,7 @@ class SparkSession private( | |||||
| * @since 2.0.0 | ||||||
| */ | ||||||
| def sql(sqlText: String): DataFrame = { | ||||||
| SparkSession.setActiveSession(this) | ||||||
| val tracker = new QueryPlanningTracker | ||||||
| val plan = tracker.measurePhase(QueryPlanningTracker.PARSING) { | ||||||
| sessionState.sqlParser.parsePlan(sqlText) | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I know that we use
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Parser use spark/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/parser/ParseDriver.scala Line 94 in e99a9f7
spark/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/parser/ParseDriver.scala Line 95 in e99a9f7
It is all about error happened in #26172
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. shall we define a
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
How about new change? Test is ok for #26172 . also cc @juliuszsompolski |
||||||
|
|
||||||
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.
Who takes responsibility to set this back if we set the active session in this method? For example, the current active session is
spark1when callingspark2.sql(...), then the active session will becomespark2. When we will set it back tospark1, or it will always bespark2?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.
Under normal circumstances, our spark program use one SparkSession, if some one write program use multi sparksession, they should control these things.
And for analyzer, it will set this.
spark/sql/core/src/main/scala/org/apache/spark/sql/execution/QueryExecution.scala
Line 64 in e99a9f7
And only
SparkSession.cleanupAnyExistingSession()will call