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-26409][SQL][TESTS] SQLConf should be serializable in test sessions #23352
Conversation
@@ -27,4 +27,9 @@ class SerializationSuite extends SparkFunSuite with SharedSQLContext { | |||
val spark = SparkSession.builder.getOrCreate() | |||
new JavaSerializer(new SparkConf()).newInstance().serialize(spark.sqlContext) | |||
} | |||
|
|||
test("[SPARK-26409] SQLConf should be serializable") { |
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.
[SPARK-26409]
-> SPARK-26409
?
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.
It is following the other test case in the test suite. I can change it to either way. What do you think?
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.
Yea, it should be okay as is. Honestly I want to to reformat all of them tho, it's obviously separate topic to discuss across the codebase.
val conf = parentState.map(_.conf.clone()).getOrElse { | ||
new SQLConf { | ||
clear() | ||
override def clear(): Unit = { | ||
super.clear() | ||
// Make sure we start with the default test configs even after clear | ||
overrideConfs.foreach { case (key, value) => setConfString(key, value) } | ||
overrideConfigurations.foreach { case (key, value) => setConfString(key, value) } |
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.
Technically, this is touching src/main
instead of src/test
. But, no problem because it's WithTestConf
. :)
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.
maybe we should move this trait to src/test
?
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.
@cloud-fan agree.
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 tried but failed.
Warning from IDE: Interface org.apache.spark.sql.internal.WithTestConf
, referenced in file TestHive.scala
, will not be accessible from module spark-hive
Hi, @gengliangwang . |
Test build #100298 has finished for PR 23352 at commit
|
I'm not sure if PySpark test failure is flaky or not. Let's do test again.
|
Retest this please. |
Test build #100319 has finished for PR 23352 at commit
|
@dongjoon-hyun I checked and the issue exists since 2.2.0. |
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! Merged to master.
@gatorsmile . I'm wondering if we can backport this to the old branches at least 2.4? |
Since this only impacts the tests, I am fine either way. |
Thanks, @gatorsmile . I'll backport to |
…ions ## What changes were proposed in this pull request? `SQLConf` is supposed to be serializable. However, currently it is not serializable in `WithTestConf`. `WithTestConf` uses the method `overrideConfs` in closure, while the classes which implements it (`TestHiveSessionStateBuilder` and `TestSQLSessionStateBuilder`) are not serializable. This PR is to use a local variable to fix it. ## How was this patch tested? Add unit test. Closes #23352 from gengliangwang/serializableSQLConf. Authored-by: Gengliang Wang <gengliang.wang@databricks.com> Signed-off-by: gatorsmile <gatorsmile@gmail.com> (cherry picked from commit 6692bac) Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
…ions ## What changes were proposed in this pull request? `SQLConf` is supposed to be serializable. However, currently it is not serializable in `WithTestConf`. `WithTestConf` uses the method `overrideConfs` in closure, while the classes which implements it (`TestHiveSessionStateBuilder` and `TestSQLSessionStateBuilder`) are not serializable. This PR is to use a local variable to fix it. ## How was this patch tested? Add unit test. Closes apache#23352 from gengliangwang/serializableSQLConf. Authored-by: Gengliang Wang <gengliang.wang@databricks.com> Signed-off-by: gatorsmile <gatorsmile@gmail.com>
…ions ## What changes were proposed in this pull request? `SQLConf` is supposed to be serializable. However, currently it is not serializable in `WithTestConf`. `WithTestConf` uses the method `overrideConfs` in closure, while the classes which implements it (`TestHiveSessionStateBuilder` and `TestSQLSessionStateBuilder`) are not serializable. This PR is to use a local variable to fix it. ## How was this patch tested? Add unit test. Closes apache#23352 from gengliangwang/serializableSQLConf. Authored-by: Gengliang Wang <gengliang.wang@databricks.com> Signed-off-by: gatorsmile <gatorsmile@gmail.com>
…ions ## What changes were proposed in this pull request? `SQLConf` is supposed to be serializable. However, currently it is not serializable in `WithTestConf`. `WithTestConf` uses the method `overrideConfs` in closure, while the classes which implements it (`TestHiveSessionStateBuilder` and `TestSQLSessionStateBuilder`) are not serializable. This PR is to use a local variable to fix it. ## How was this patch tested? Add unit test. Closes apache#23352 from gengliangwang/serializableSQLConf. Authored-by: Gengliang Wang <gengliang.wang@databricks.com> Signed-off-by: gatorsmile <gatorsmile@gmail.com> (cherry picked from commit 6692bac) Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
…ions ## What changes were proposed in this pull request? `SQLConf` is supposed to be serializable. However, currently it is not serializable in `WithTestConf`. `WithTestConf` uses the method `overrideConfs` in closure, while the classes which implements it (`TestHiveSessionStateBuilder` and `TestSQLSessionStateBuilder`) are not serializable. This PR is to use a local variable to fix it. ## How was this patch tested? Add unit test. Closes apache#23352 from gengliangwang/serializableSQLConf. Authored-by: Gengliang Wang <gengliang.wang@databricks.com> Signed-off-by: gatorsmile <gatorsmile@gmail.com> (cherry picked from commit 6692bac) Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
What changes were proposed in this pull request?
SQLConf
is supposed to be serializable. However, currently it is not serializable inWithTestConf
.WithTestConf
uses the methodoverrideConfs
in closure, while the classes which implements it (TestHiveSessionStateBuilder
andTestSQLSessionStateBuilder
) are not serializable.This PR is to use a local variable to fix it.
How was this patch tested?
Add unit test.