File tree Expand file tree Collapse file tree 2 files changed +12
-4
lines changed
catalyst/src/main/scala/org/apache/spark/sql/internal
core/src/test/scala/org/apache/spark/sql/internal Expand file tree Collapse file tree 2 files changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -1228,10 +1228,12 @@ class SQLConf extends Serializable with Logging {
12281228 * not set yet, return `defaultValue`.
12291229 */
12301230 def getConfString (key : String , defaultValue : String ): String = {
1231- val entry = sqlConfEntries.get(key)
1232- if (entry != null && defaultValue != " <undefined>" ) {
1233- // Only verify configs in the SQLConf object
1234- entry.valueConverter(defaultValue)
1231+ if (defaultValue != null && defaultValue != " <undefined>" ) {
1232+ val entry = sqlConfEntries.get(key)
1233+ if (entry != null ) {
1234+ // Only verify configs in the SQLConf object
1235+ entry.valueConverter(defaultValue)
1236+ }
12351237 }
12361238 Option (settings.get(key)).getOrElse(defaultValue)
12371239 }
Original file line number Diff line number Diff line change @@ -270,4 +270,10 @@ class SQLConfSuite extends QueryTest with SharedSQLContext {
270270 val e2 = intercept[AnalysisException ](spark.conf.unset(SCHEMA_STRING_LENGTH_THRESHOLD .key))
271271 assert(e2.message.contains(" Cannot modify the value of a static config" ))
272272 }
273+
274+ test(" SPARK-21588 SQLContext.getConf(key, null) should return null" ) {
275+ assert(null == spark.conf.get(" spark.sql.thriftServer.incrementalCollect" , null ))
276+ assert(" <undefined>" == spark.conf.get(
277+ " spark.sql.thriftServer.incrementalCollect" , " <undefined>" ))
278+ }
273279}
You can’t perform that action at this time.
0 commit comments