-
Notifications
You must be signed in to change notification settings - Fork 28.5k
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-26060][SQL] Track SparkConf entries and make SET command reject such entries. #23031
Conversation
Test build #98817 has finished for PR 23031 at commit
|
Test build #98818 has finished for PR 23031 at commit
|
Jenkins, retest this please. |
Test build #98827 has finished for PR 23031 at commit
|
All entries are already captured in the You could warn if anybody tries to update something that's in there, but not in |
@vanzin Thanks for letting me know it and that's really good to know. |
Test build #98858 has finished for PR 23031 at commit
|
Jenkins, retest this please. |
Test build #98862 has finished for PR 23031 at commit
|
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.
@@ -154,5 +154,9 @@ class RuntimeConfig private[sql](sqlConf: SQLConf = new SQLConf) { | |||
if (SQLConf.staticConfKeys.contains(key)) { | |||
throw new AnalysisException(s"Cannot modify the value of a static config: $key") | |||
} | |||
if (sqlConf.setCommandRejectsSparkConfs && | |||
ConfigEntry.findEntry(key) != null && !SQLConf.sqlConfEntries.containsKey(key)) { | |||
throw new AnalysisException(s"Cannot modify the value of a spark config: $key") |
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
docs/sql-migration-guide-upgrade.md
Outdated
@@ -17,6 +17,8 @@ displayTitle: Spark SQL Upgrading Guide | |||
|
|||
- The `ADD JAR` command previously returned a result set with the single value 0. It now returns an empty result set. | |||
|
|||
- In Spark version 2.4 and earlier, the `SET` command works without any warnings even if the specified key is for `SparkConf` entries and it has no effect because the command does not update `SparkConf`, but the behavior might confuse users. Since 3.0, the command fails if the key is for `SparkConf` as same as for static sql config keys. You can disable such a check by setting `spark.sql.execution.setCommandRejectsSparkConfs` to `false`. |
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.
...fails if a non-SQL or static SQL config key is used.
Test build #98896 has finished for PR 23031 at commit
|
@@ -154,5 +154,9 @@ class RuntimeConfig private[sql](sqlConf: SQLConf = new SQLConf) { | |||
if (SQLConf.staticConfKeys.contains(key)) { | |||
throw new AnalysisException(s"Cannot modify the value of a static config: $key") | |||
} | |||
if (sqlConf.setCommandRejectsSparkConfs && | |||
ConfigEntry.findEntry(key) != null && !SQLConf.sqlConfEntries.containsKey(key)) { |
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.
Actually, thinking of it, isn't ConfigEntry.findEntry(key) != null
redundant with the other check?
Removing that would also want by other settings that don't have constants defined.
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'm sorry for the delay.
As per the comment #22887 (comment), I'd leave it as is for now.
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 should only reject configs that are registered as SparkConf. Thinking about configs that are neither a SparkConf or SQLConf, we shouldn't reject it.
docs/sql-migration-guide-upgrade.md
Outdated
@@ -17,6 +17,8 @@ displayTitle: Spark SQL Upgrading Guide | |||
|
|||
- The `ADD JAR` command previously returned a result set with the single value 0. It now returns an empty result set. | |||
|
|||
- In Spark version 2.4 and earlier, the `SET` command works without any warnings even if the specified key is for `SparkConf` entries and it has no effect because the command does not update `SparkConf`, but the behavior might confuse users. Since 3.0, the command fails if a non-SQL or static SQL config key is used. You can disable such a check by setting `spark.sql.execution.setCommandRejectsSparkConfs` to `false`. |
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.
Now that I looked at that code again, the static config part already threw an error before, so probably can be removed here.
val conf = newConf() | ||
|
||
val ex = intercept[AnalysisException] { | ||
conf.set("spark.task.cpus", 4) |
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.
can we use config.CPUS_PER_TASK
instead of hardcoding it?
|
||
test("set command rejects SparkConf entries") { | ||
val ex = intercept[AnalysisException] { | ||
sql("SET spark.task.cpus = 4") |
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.
ditto
Test build #99373 has finished for PR 23031 at commit
|
Test build #99374 has finished for PR 23031 at commit
|
Test build #99388 has finished for PR 23031 at commit
|
Jenkins, retest this please. |
Test build #99422 has finished for PR 23031 at commit
|
@@ -1610,6 +1610,14 @@ object SQLConf { | |||
""" "... N more fields" placeholder.""") | |||
.intConf | |||
.createWithDefault(25) | |||
|
|||
val SET_COMMAND_REJECTS_SPARK_CONFS = | |||
buildConf("spark.sql.execution.setCommandRejectsSparkConfs") |
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.
shall we use the legacy prefix?
Test build #99434 has finished for PR 23031 at commit
|
Jenkins, retest this please. |
Test build #99444 has finished for PR 23031 at commit
|
Jenkins, retest this please. |
Test build #99455 has finished for PR 23031 at commit
|
Jenkins, retest this please. |
Test build #99463 has finished for PR 23031 at commit
|
thanks, merging to master! |
…t such entries. ## What changes were proposed in this pull request? Currently the `SET` command works without any warnings even if the specified key is for `SparkConf` entries and it has no effect because the command does not update `SparkConf`, but the behavior might confuse users. We should track `SparkConf` entries and make the command reject for such entries. ## How was this patch tested? Added a test and existing tests. Closes apache#23031 from ueshin/issues/SPARK-26060/set_command. Authored-by: Takuya UESHIN <ueshin@databricks.com> Signed-off-by: Wenchen Fan <wenchen@databricks.com>
## What changes were proposed in this pull request? This is a follow-up of apache#23031 to rename the config name to `spark.sql.legacy.setCommandRejectsSparkCoreConfs`. ## How was this patch tested? Existing tests. Closes apache#23245 from ueshin/issues/SPARK-26060/rename_config. Authored-by: Takuya UESHIN <ueshin@databricks.com> Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
What changes were proposed in this pull request?
Currently the
SET
command works without any warnings even if the specified key is forSparkConf
entries and it has no effect because the command does not updateSparkConf
, but the behavior might confuse users. We should trackSparkConf
entries and make the command reject for such entries.How was this patch tested?
Added a test and existing tests.