Skip to content
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

Closed
wants to merge 13 commits into from

Conversation

ueshin
Copy link
Member

@ueshin ueshin commented Nov 14, 2018

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.

@SparkQA
Copy link

SparkQA commented Nov 14, 2018

Test build #98817 has finished for PR 23031 at commit e19b1e4.

  • This patch fails Scala style tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@SparkQA
Copy link

SparkQA commented Nov 14, 2018

Test build #98818 has finished for PR 23031 at commit 3f1841c.

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

@ueshin
Copy link
Member Author

ueshin commented Nov 14, 2018

Jenkins, retest this please.

@SparkQA
Copy link

SparkQA commented Nov 14, 2018

Test build #98827 has finished for PR 23031 at commit 3f1841c.

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

@vanzin
Copy link
Contributor

vanzin commented Nov 14, 2018

All entries are already captured in the ConfigEntry object, so are all these changes really needed?

You could warn if anybody tries to update something that's in there, but not in SQLConf.sqlConfEntries. Also, be warned that this doesn't cover all config options, since lots of old options do not have a constant.

@ueshin
Copy link
Member Author

ueshin commented Nov 15, 2018

@vanzin Thanks for letting me know it and that's really good to know.
I'll update this to use it.

@ueshin ueshin changed the title [SPARK-26060][CORE][SQL] Track SparkConf entries and make SET command reject such entries. [SPARK-26060][SQL] Track SparkConf entries and make SET command reject such entries. Nov 15, 2018
@SparkQA
Copy link

SparkQA commented Nov 15, 2018

Test build #98858 has finished for PR 23031 at commit 37ebae4.

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

@ueshin
Copy link
Member Author

ueshin commented Nov 15, 2018

Jenkins, retest this please.

@SparkQA
Copy link

SparkQA commented Nov 15, 2018

Test build #98862 has finished for PR 23031 at commit 37ebae4.

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

Copy link
Contributor

@vanzin vanzin left a 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")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Spark

@@ -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`.
Copy link
Contributor

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.

@SparkQA
Copy link

SparkQA commented Nov 16, 2018

Test build #98896 has finished for PR 23031 at commit 336a331.

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

@@ -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)) {
Copy link
Contributor

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.

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'm sorry for the delay.
As per the comment #22887 (comment), I'd leave it as is for now.

Copy link
Contributor

@cloud-fan cloud-fan Nov 28, 2018

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.

@@ -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`.
Copy link
Contributor

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)
Copy link
Contributor

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")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto

@SparkQA
Copy link

SparkQA commented Nov 28, 2018

Test build #99373 has finished for PR 23031 at commit 1f703aa.

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

@SparkQA
Copy link

SparkQA commented Nov 28, 2018

Test build #99374 has finished for PR 23031 at commit 4e7b6bb.

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

@SparkQA
Copy link

SparkQA commented Nov 28, 2018

Test build #99388 has finished for PR 23031 at commit 96b2280.

  • This patch fails Spark unit tests.
  • This patch merges cleanly.
  • This patch adds the following public classes (experimental):
  • class ArrayBasedMapBuilder(keyType: DataType, valueType: DataType) extends Serializable

@ueshin
Copy link
Member Author

ueshin commented Nov 29, 2018

Jenkins, retest this please.

@SparkQA
Copy link

SparkQA commented Nov 29, 2018

Test build #99422 has finished for PR 23031 at commit 96b2280.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds the following public classes (experimental):
  • class ArrayBasedMapBuilder(keyType: DataType, valueType: DataType) extends Serializable

@@ -1610,6 +1610,14 @@ object SQLConf {
""" "... N more fields" placeholder.""")
.intConf
.createWithDefault(25)

val SET_COMMAND_REJECTS_SPARK_CONFS =
buildConf("spark.sql.execution.setCommandRejectsSparkConfs")
Copy link
Contributor

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?

@SparkQA
Copy link

SparkQA commented Nov 29, 2018

Test build #99434 has finished for PR 23031 at commit dd49ea3.

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

@ueshin
Copy link
Member Author

ueshin commented Nov 29, 2018

Jenkins, retest this please.

@SparkQA
Copy link

SparkQA commented Nov 29, 2018

Test build #99444 has finished for PR 23031 at commit dd49ea3.

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

@ueshin
Copy link
Member Author

ueshin commented Nov 29, 2018

Jenkins, retest this please.

@SparkQA
Copy link

SparkQA commented Nov 29, 2018

Test build #99455 has finished for PR 23031 at commit dd49ea3.

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

@ueshin
Copy link
Member Author

ueshin commented Nov 29, 2018

Jenkins, retest this please.

@SparkQA
Copy link

SparkQA commented Nov 29, 2018

Test build #99463 has finished for PR 23031 at commit dd49ea3.

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

@cloud-fan
Copy link
Contributor

thanks, merging to master!

@asfgit asfgit closed this in 8edb64c Nov 30, 2018
jackylee-ch pushed a commit to jackylee-ch/spark that referenced this pull request Feb 18, 2019
…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>
jackylee-ch pushed a commit to jackylee-ch/spark that referenced this pull request Feb 18, 2019
## 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants