Skip to content

Commit

Permalink
[SPARK-34454][SQL] Mark legacy SQL configs as internal
Browse files Browse the repository at this point in the history
### What changes were proposed in this pull request?
1. Make the following SQL configs as internal:
    - spark.sql.legacy.allowHashOnMapType
    - spark.sql.legacy.sessionInitWithConfigDefaults
2. Add a test to check that all SQL configs from the `legacy` namespace are marked as internal configs.

### Why are the changes needed?
Assuming that legacy SQL configs shouldn't be set by users in common cases. The purpose of such configs is to allow switching to old behavior in corner cases. So, the configs should be marked as internals.

### Does this PR introduce _any_ user-facing change?
Should not.

### How was this patch tested?
By running new test:
```
$ build/sbt "test:testOnly *SQLConfSuite"
```

Closes apache#31577 from MaxGekk/mark-legacy-configs-as-internal.

Authored-by: Max Gekk <[email protected]>
Signed-off-by: Dongjoon Hyun <[email protected]>
  • Loading branch information
MaxGekk authored and dongjoon-hyun committed Feb 18, 2021
1 parent 2787328 commit 8f7ec4b
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2850,6 +2850,7 @@ object SQLConf {
.createWithDefault(100)

val LEGACY_ALLOW_HASH_ON_MAPTYPE = buildConf("spark.sql.legacy.allowHashOnMapType")
.internal()
.doc("When set to true, hash expressions can be applied on elements of MapType. Otherwise, " +
"an analysis exception will be thrown.")
.version("3.0.0")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ object StaticSQLConf {

val SQL_LEGACY_SESSION_INIT_WITH_DEFAULTS =
buildStaticConf("spark.sql.legacy.sessionInitWithConfigDefaults")
.internal()
.doc("Flag to revert to legacy behavior where a cloned SparkSession receives SparkConf " +
"defaults, dropping any overrides in its parent SparkSession.")
.version("3.0.0")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -451,4 +451,14 @@ class SQLConfSuite extends QueryTest with SharedSparkSession {
val e2 = intercept[ParseException](sql("set time zone interval 19 hours"))
assert(e2.getMessage contains "The interval value must be in the range of [-18, +18] hours")
}

test("SPARK-34454: configs from the legacy namespace should be internal") {
val nonInternalLegacyConfigs = spark.sessionState.conf.getAllDefinedConfs
.filter { case (key, _, _, _) => key.contains("spark.sql.legacy.") }
assert(nonInternalLegacyConfigs.isEmpty,
s"""
|Non internal legacy SQL configs:
|${nonInternalLegacyConfigs.map(_._1).mkString("\n")}
|""".stripMargin)
}
}

0 comments on commit 8f7ec4b

Please sign in to comment.