Skip to content

Commit 3aeb7be

Browse files
committed
Update
1 parent af1a60a commit 3aeb7be

File tree

2 files changed

+8
-11
lines changed

2 files changed

+8
-11
lines changed

sql/hive-thriftserver/src/main/scala/org/apache/spark/sql/hive/thriftserver/SparkSQLCLIDriver.scala

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,8 +156,13 @@ private[hive] object SparkSQLCLIDriver extends Logging {
156156
// Execute -i init files (always in silent mode)
157157
cli.processInitFiles(sessionState)
158158

159-
// Respect the configurations from the command line and .hiverc for backward-compatible
160-
SparkSQLEnv.applyOverridedConf(sessionState)
159+
// Respect the configurations set by --hiveconf from the command line
160+
// (based on Hive's CliDriver).
161+
val it = sessionState.getOverriddenConfigurations.entrySet().iterator()
162+
while (it.hasNext) {
163+
val kv = it.next()
164+
SparkSQLEnv.sqlContext.setConf(kv.getKey, kv.getValue)
165+
}
161166

162167
if (sessionState.execString != null) {
163168
System.exit(cli.processLine(sessionState.execString))

sql/hive-thriftserver/src/main/scala/org/apache/spark/sql/hive/thriftserver/SparkSQLEnv.scala

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ package org.apache.spark.sql.hive.thriftserver
1919

2020
import java.io.PrintStream
2121

22-
import org.apache.hadoop.hive.ql.session.SessionState
22+
import scala.collection.JavaConverters._
2323

2424
import org.apache.spark.{SparkConf, SparkContext}
2525
import org.apache.spark.internal.Logging
@@ -66,14 +66,6 @@ private[hive] object SparkSQLEnv extends Logging {
6666
}
6767
}
6868

69-
def applyOverridedConf(ss: SessionState): Unit = {
70-
val it = ss.getOverriddenConfigurations.entrySet().iterator()
71-
while (it.hasNext) {
72-
val kv = it.next()
73-
SparkSQLEnv.sqlContext.setConf(kv.getKey, kv.getValue)
74-
}
75-
}
76-
7769
/** Cleans up and shuts down the Spark SQL environments. */
7870
def stop() {
7971
logDebug("Shutting down Spark SQL Environment")

0 commit comments

Comments
 (0)