Skip to content

Commit 93dad8e

Browse files
committed
Fix the unit tests
1 parent cf950c1 commit 93dad8e

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

sql/core/src/main/scala/org/apache/spark/sql/SQLConf.scala

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -150,11 +150,12 @@ private[spark] object SQLConf {
150150
doc: String = "",
151151
isPublic: Boolean = true): SQLConfEntry[T] =
152152
SQLConfEntry(key, defaultValue, v => {
153-
if (!validValues.contains(v)) {
153+
val _v = valueConverter(v)
154+
if (!validValues.contains(_v)) {
154155
throw new IllegalArgumentException(
155156
s"The value of $key should be one of ${validValues.mkString(", ")}, but was $v")
156157
}
157-
valueConverter(v)
158+
_v
158159
}, _.toString, doc, isPublic)
159160
}
160161

@@ -225,7 +226,7 @@ private[spark] object SQLConf {
225226
doc = "Turns on caching of Parquet schema metadata. Can speed up querying of static data.")
226227

227228
val PARQUET_COMPRESSION = enumConf("spark.sql.parquet.compression.codec",
228-
valueConverter = v => v,
229+
valueConverter = v => v.toLowerCase,
229230
validValues = Set("uncompressed", "snappy", "gzip", "lzo"),
230231
defaultValue = Some("gzip"),
231232
doc = "Sets the compression codec use when writing Parquet files. Acceptable values include: " +

sql/core/src/test/scala/org/apache/spark/sql/SQLQuerySuite.scala

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -910,25 +910,25 @@ class SQLQuerySuite extends QueryTest with BeforeAndAfterAll with SQLTestUtils {
910910
sql(s"SET $testKey=$testVal")
911911
checkAnswer(
912912
sql("SET"),
913-
Row(s"$testKey=$testVal")
913+
Row(testKey, testVal)
914914
)
915915

916916
sql(s"SET ${testKey + testKey}=${testVal + testVal}")
917917
checkAnswer(
918918
sql("set"),
919919
Seq(
920-
Row(s"$testKey=$testVal"),
921-
Row(s"${testKey + testKey}=${testVal + testVal}"))
920+
Row(testKey, testVal),
921+
Row(testKey + testKey, testVal + testVal))
922922
)
923923

924924
// "set key"
925925
checkAnswer(
926926
sql(s"SET $testKey"),
927-
Row(s"$testKey=$testVal")
927+
Row(testKey, testVal)
928928
)
929929
checkAnswer(
930930
sql(s"SET $nonexistentKey"),
931-
Row(s"$nonexistentKey=<undefined>")
931+
Row(nonexistentKey, "<undefined>")
932932
)
933933
sqlContext.conf.clear()
934934
}

0 commit comments

Comments
 (0)