-
Notifications
You must be signed in to change notification settings - Fork 28.3k
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-50366][SQL] Isolate user-defined tags on thread level for SparkSession in Classic #48906
Conversation
sql/core/src/main/scala/org/apache/spark/sql/SparkSession.scala
Outdated
Show resolved
Hide resolved
* A UUID that is unique on the thread level. Used by managedJobTags to make sure that a same | ||
* tag from two threads does not overlap in the underlying SparkContext/SQLExecution. | ||
*/ | ||
private[sql] lazy val threadUuid = new InheritableThreadLocal[String] { |
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.
Could we have a simple test for this inheritance? Otherwise, looks fine from a cursory look.
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.
cc @itholic too |
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 except for a nit comment
sql/core/src/main/scala/org/apache/spark/sql/SparkSession.scala
Outdated
Show resolved
Hide resolved
Merged to master. |
What changes were proposed in this pull request?
This PR changes the implementation of user-provided tags to be thread-local, so that tags added by two threads to the same SparkSession do not interfere with each other.
Overlaps (from the
SparkContext
perspective) are avoided by introducing a thread-local random UUID which is attached to all tags in the same thread.Why are the changes needed?
To make tags isolated per thread.
Does this PR introduce any user-facing change?
Yes, user-provided tags are now isolated on the session level.
How was this patch tested?
Local test.
Was this patch authored or co-authored using generative AI tooling?
No.