Skip to content

Commit 3c5f03e

Browse files
committed
Add unsetConf(SQLConfEntry) and fix the code style
1 parent a2f4add commit 3c5f03e

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

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

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -529,8 +529,8 @@ private[sql] class SQLConf extends Serializable with CatalystConf {
529529
def getConfString(key: String): String = {
530530
Option(settings.get(key)).
531531
orElse {
532-
// Try to use the default value
533-
Option(sqlConfEntries.get(key)).map(_.defaultValueString)
532+
// Try to use the default value
533+
Option(sqlConfEntries.get(key)).map(_.defaultValueString)
534534
}.
535535
getOrElse(throw new NoSuchElementException(key))
536536
}
@@ -584,11 +584,15 @@ private[sql] class SQLConf extends Serializable with CatalystConf {
584584
}.toSeq
585585
}
586586

587-
private[spark] def unsetConf(key: String) {
587+
private[spark] def unsetConf(key: String): Unit = {
588588
settings -= key
589589
}
590590

591-
private[spark] def clear() {
591+
private[spark] def unsetConf(entry: SQLConfEntry[_]): Unit = {
592+
settings -= entry.key
593+
}
594+
595+
private[spark] def clear(): Unit = {
592596
settings.clear()
593597
}
594598
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ class SQLContext(@transient val sparkContext: SparkContext)
155155
// SET spark.sql.dialect=sql; Let's reset as default dialect automatically.
156156
val dialect = conf.dialect
157157
// reset the sql dialect
158-
conf.unsetConf(SQLConf.DIALECT.key)
158+
conf.unsetConf(SQLConf.DIALECT)
159159
// throw out the exception, and the default sql dialect will take effect for next query.
160160
throw new DialectException(
161161
s"""Instantiating dialect '$dialect' failed.

0 commit comments

Comments
 (0)