Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Fix Hive setConf issue
  • Loading branch information
gvramana committed Apr 13, 2015
commit 8553125f6f6649e7e5760e05a043f60fc4e2da23
11 changes: 9 additions & 2 deletions sql/core/src/main/scala/org/apache/spark/sql/SQLConf.scala
Original file line number Diff line number Diff line change
Expand Up @@ -199,8 +199,15 @@ private[sql] class SQLConf extends Serializable {
/** ********************** SQLConf functionality methods ************ */

/** Set Spark SQL configuration properties. */
def setConf(props: Properties): Unit = settings.synchronized {
props.foreach { case (k, v) => settings.put(k, v) }
def setConf(props: Properties, overwrite: Boolean = true): Unit = settings.synchronized {
if (overwrite) {
props.foreach { case (k, v) => settings.put(k, v) }
} else {
props
.filter(p => !settings.containsKey(p._1))
.foreach { case (k, v) => settings.put(k, v) }
}

}

/** Set the given Spark SQL configuration property. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ class SQLContext(@transient val sparkContext: SparkContext)
*
* @group config
*/
def setConf(props: Properties): Unit = conf.setConf(props)
def setConf(props: Properties, overwrite: Boolean = true): Unit = conf.setConf(props, overwrite)

/**
* Set the given Spark SQL configuration property.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ class HiveContext(sc: SparkContext) extends SQLContext(sc) {
}

protected[hive] lazy val hiveconf: HiveConf = {
setConf(sessionState.getConf.getAllProperties)
setConf(sessionState.getConf.getAllProperties, false)
sessionState.getConf
}

Expand Down