Skip to content

Conversation

@xuanyuanking
Copy link
Member

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.

@xuanyuanking
Copy link
Member Author

val localProps = Utils.cloneProperties(sc.getLocalProperties)
Future {
val originalContext = SparkSession.getActiveSession
val originalLocalProps = Utils.cloneProperties(sc.getLocalProperties)
Copy link
Contributor

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?

Copy link
Member Author

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.

Copy link
Contributor

@ajithme ajithme Feb 10, 2020

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.?

Copy link
Member Author

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.

@SparkQA
Copy link

SparkQA commented Feb 10, 2020

Test build #118115 has finished for PR 27516 at commit 0128a37.

  • This patch fails Spark unit tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@SparkQA
Copy link

SparkQA commented Feb 10, 2020

Test build #118119 has finished for PR 27516 at commit a33154c.

  • This patch fails due to an unknown error code, -9.
  • This patch merges cleanly.
  • This patch adds no public classes.


// set local configuration and assert
val confValue1 = "e"
val confValue1 = UUID.randomUUID().toString()
Copy link
Member

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.

@SparkQA
Copy link

SparkQA commented Feb 10, 2020

Test build #118142 has finished for PR 27516 at commit 51f7fc8.

  • This patch fails PySpark unit tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@cloud-fan
Copy link
Contributor

retest this please

@SparkQA
Copy link

SparkQA commented Feb 10, 2020

Test build #118160 has finished for PR 27516 at commit 51f7fc8.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

Copy link
Contributor

@hvanhovell hvanhovell left a 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!

@hvanhovell
Copy link
Contributor

Merging in master/3.0.

hvanhovell pushed a commit that referenced this pull request Feb 10, 2020
….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]>
@xuanyuanking
Copy link
Member Author

Thanks all for review.

@xuanyuanking xuanyuanking deleted the SPARK-30556-follow branch February 11, 2020 02:36
@gatorsmile
Copy link
Member

The original PR #27340 was merged to 2.4 too. Should we fix 2.4?

@xuanyuanking
Copy link
Member Author

Copy, will send a backport.

xuanyuanking added a commit to xuanyuanking/spark that referenced this pull request Feb 19, 2020
….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)
sjincho pushed a commit to sjincho/spark that referenced this pull request Apr 15, 2020
….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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants