-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-34660][TESTS][3.1] Don't use ParVector with withExistingConf which is not thread-safe
#31775
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
…h is not thread-safe
|
cc @leanken , @cloud-fan , @rednaxelafx , @maropu , @kiszk , @viirya |
withExistingConf which is not thread-safewithExistingConf which is not thread-safe
|
Great analysis! |
|
Thank you, @kiszk ! |
|
This is a test-only PR and I tested this manually. Merged to branch-3.1 to recover the branch. |
… which is not thread-safe ### What changes were proposed in this pull request? This PR aims to remove `ParVector` usage with `withExistingConf` in `CastSuite` in order to fix UT failures. - This was added by SPARK-33498 . - `master` branch doesn't use `ParVector`. ```scala - new ParVector(ALL_TIMEZONES.toVector).foreach { zid => + ALL_TIMEZONES.foreach { zid => ``` ### Why are the changes needed? `withExistingConf` is not thread-safe like the following. We should not use `ParVector` on it. ```scala def withExistingConf[T](conf: SQLConf)(f: => T): T = { val old = existingConf.get() existingConf.set(conf) try { f } finally { if (old != null) { existingConf.set(old) } else { existingConf.remove() } } } ``` ### Does this PR introduce _any_ user-facing change? **BEFORE** ``` $ build/sbt "catalyst/testOnly *AnsiCastSuiteWithAnsiModeOn *ExpressionEncoderSuite -- -z parse -z nested" ... [info] *** 4 TESTS FAILED *** [error] Failed: Total 8, Failed 4, Errors 0, Passed 4 [error] Failed tests: [error] org.apache.spark.sql.catalyst.encoders.ExpressionEncoderSuite ``` **AFTER** ``` $ build/sbt "catalyst/testOnly *AnsiCastSuiteWithAnsiModeOn *ExpressionEncoderSuite -- -z parse -z nested" ... [info] All tests passed. ``` ### How was this patch tested? Pass the CIs on `branch-3.1`. Currently, it's broken. Closes #31775 from dongjoon-hyun/SPARK-34660. Authored-by: Dongjoon Hyun <[email protected]> Signed-off-by: Dongjoon Hyun <[email protected]>
|
late lgtm. |
|
late LGTM |
| val activeConf = conf | ||
| new ParVector(ALL_TIMEZONES.toVector).foreach { zid => | ||
| ALL_TIMEZONES.foreach { zid => | ||
| def checkCastWithParseError(str: String): Unit = { |
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.
nit: It looks like we don't need to wrap SQLConf.withExistingConf now.
|
late lgtm |
|
Test build #135857 has finished for PR 31775 at commit
|
|
Thank you, @maropu , @cloud-fan , @viirya . BTW, @maropu . Could you make a follow-up if needed, please?
|
|
Yea, I'll do it later. |
…n CastSuite ### What changes were proposed in this pull request? This PR intends to remove unnecessary `SQLConf.withExistingConf` in `CastSuite`; since we've remove `ParVector ` in #31775, we no longer need to copy SQL configs into each thread env. ### Why are the changes needed? Clean up the code. ### Does this PR introduce _any_ user-facing change? No. ### How was this patch tested? Run the existing tests. Closes #31785 from maropu/UpdateCastSuite. Authored-by: Takeshi Yamamuro <[email protected]> Signed-off-by: Dongjoon Hyun <[email protected]>
…onf in CastSuite ### What changes were proposed in this pull request? This PR intends to remove unnecessary `SQLConf.withExistingConf` in `CastSuite`; since we've remove `ParVector ` in #31775, we no longer need to copy SQL configs into each thread env. This PR is a backport of #31785. ### Why are the changes needed? Clean up the code. ### Does this PR introduce _any_ user-facing change? No. ### How was this patch tested? Run the existing tests. Closes #31813 from maropu/SPARK-33498-BRANCH3.1. Authored-by: Takeshi Yamamuro <[email protected]> Signed-off-by: Dongjoon Hyun <[email protected]>
… which is not thread-safe
This PR aims to remove `ParVector` usage with `withExistingConf` in `CastSuite` in order to fix UT failures.
- This was added by SPARK-33498 .
- `master` branch doesn't use `ParVector`.
```scala
- new ParVector(ALL_TIMEZONES.toVector).foreach { zid =>
+ ALL_TIMEZONES.foreach { zid =>
```
`withExistingConf` is not thread-safe like the following. We should not use `ParVector` on it.
```scala
def withExistingConf[T](conf: SQLConf)(f: => T): T = {
val old = existingConf.get()
existingConf.set(conf)
try {
f
} finally {
if (old != null) {
existingConf.set(old)
} else {
existingConf.remove()
}
}
}
```
**BEFORE**
```
$ build/sbt "catalyst/testOnly *AnsiCastSuiteWithAnsiModeOn *ExpressionEncoderSuite -- -z parse -z nested"
...
[info] *** 4 TESTS FAILED ***
[error] Failed: Total 8, Failed 4, Errors 0, Passed 4
[error] Failed tests:
[error] org.apache.spark.sql.catalyst.encoders.ExpressionEncoderSuite
```
**AFTER**
```
$ build/sbt "catalyst/testOnly *AnsiCastSuiteWithAnsiModeOn *ExpressionEncoderSuite -- -z parse -z nested"
...
[info] All tests passed.
```
Pass the CIs on `branch-3.1`. Currently, it's broken.
Closes apache#31775 from dongjoon-hyun/SPARK-34660.
Authored-by: Dongjoon Hyun <[email protected]>
Signed-off-by: Dongjoon Hyun <[email protected]>
…onf in CastSuite ### What changes were proposed in this pull request? This PR intends to remove unnecessary `SQLConf.withExistingConf` in `CastSuite`; since we've remove `ParVector ` in apache#31775, we no longer need to copy SQL configs into each thread env. This PR is a backport of apache#31785. ### Why are the changes needed? Clean up the code. ### Does this PR introduce _any_ user-facing change? No. ### How was this patch tested? Run the existing tests. Closes apache#31813 from maropu/SPARK-33498-BRANCH3.1. Authored-by: Takeshi Yamamuro <[email protected]> Signed-off-by: Dongjoon Hyun <[email protected]>
What changes were proposed in this pull request?
This PR aims to remove
ParVectorusage withwithExistingConfinCastSuitein order to fix UT failures.masterbranch doesn't useParVector.Why are the changes needed?
withExistingConfis not thread-safe like the following. We should not useParVectoron it.Does this PR introduce any user-facing change?
BEFORE
AFTER
How was this patch tested?
Pass the CIs on
branch-3.1. Currently, it's broken.