-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-30556][SQL][FOLLOWUP] Reset the status changed in SQLExecution.withThreadLocalCaptured #27516
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
210b195 to
0128a37
Compare
sql/core/src/main/scala/org/apache/spark/sql/execution/SQLExecution.scala
Outdated
Show resolved
Hide resolved
| val localProps = Utils.cloneProperties(sc.getLocalProperties) | ||
| Future { | ||
| val originalContext = SparkSession.getActiveSession | ||
| val originalLocalProps = Utils.cloneProperties(sc.getLocalProperties) |
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.
do we need to clone?
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.
We can assure the LocalProps is used in current thread here, getLocalProperties is enough, done in a33154c, thanks.
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.
I think clone is required. Please read
#27267 (comment)
Also i dont see why we need to reset. By default pool threads do not have any localproperties or localsession variable set. That means after the thread is used for first time, this change will always try to retain those properties and session by always finally resetting it to same, which is kind of stale already. Right.?
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.
I think clone is required.
The two scenarios are different, the first one needs clone since we want a snapshot of local properties during submit. But for this one, we need to reset by the variable self. If use clone here, changes in other places might be dropped.
Also i dont see why we need to reset.
For the function added in SQLExecution here, I think we need to clean up all the side effects as far as possible, even though it works in this case.
|
Test build #118115 has finished for PR 27516 at commit
|
sql/core/src/main/scala/org/apache/spark/sql/execution/SQLExecution.scala
Show resolved
Hide resolved
|
Test build #118119 has finished for PR 27516 at commit
|
|
|
||
| // set local configuration and assert | ||
| val confValue1 = "e" | ||
| val confValue1 = UUID.randomUUID().toString() |
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.
I don't think this is particularly needed. The value here doesn't matter at all. It doesn't test if the given value itself was correct or not. It just tests if the value is set or not. But .. I am okay.
|
Test build #118142 has finished for PR 27516 at commit
|
|
retest this please |
|
Test build #118160 has finished for PR 27516 at commit
|
hvanhovell
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 - thanks for addressing this!
|
Merging in master/3.0. |
….withThreadLocalCaptured ### What changes were proposed in this pull request? Follow up for #27267, reset the status changed in SQLExecution.withThreadLocalCaptured. ### Why are the changes needed? For code safety. ### Does this PR introduce any user-facing change? No. ### How was this patch tested? Existing UT. Closes #27516 from xuanyuanking/SPARK-30556-follow. Authored-by: Yuanjian Li <[email protected]> Signed-off-by: herman <[email protected]> (cherry picked from commit a6b91d2) Signed-off-by: herman <[email protected]>
|
Thanks all for review. |
|
The original PR #27340 was merged to 2.4 too. Should we fix 2.4? |
|
Copy, will send a backport. |
….withThreadLocalCaptured Follow up for apache#27267, reset the status changed in SQLExecution.withThreadLocalCaptured. For code safety. No. Existing UT. Closes apache#27516 from xuanyuanking/SPARK-30556-follow. (cherry picked from commit a6b91d2)
….withThreadLocalCaptured ### What changes were proposed in this pull request? Follow up for apache#27267, reset the status changed in SQLExecution.withThreadLocalCaptured. ### Why are the changes needed? For code safety. ### Does this PR introduce any user-facing change? No. ### How was this patch tested? Existing UT. Closes apache#27516 from xuanyuanking/SPARK-30556-follow. Authored-by: Yuanjian Li <[email protected]> Signed-off-by: herman <[email protected]>
What changes were proposed in this pull request?
Follow up for #27267, reset the status changed in SQLExecution.withThreadLocalCaptured.
Why are the changes needed?
For code safety.
Does this PR introduce any user-facing change?
No.
How was this patch tested?
Existing UT.