Skip to content

Commit 1da261a

Browse files
committed
reload the conf after reset
1 parent 375b692 commit 1da261a

File tree

3 files changed

+11
-6
lines changed

3 files changed

+11
-6
lines changed

sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveSessionState.scala

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,8 @@ private[hive] class HiveSessionState(sparkSession: SparkSession)
6161
* set in the SQLConf *as well as* in the HiveConf.
6262
*/
6363
lazy val hiveconf: HiveConf = {
64-
val c = executionHive.conf
65-
conf.setConf(c.getAllProperties)
66-
// scalastyle:off println
67-
println("conf.hiveMetastoreWarehouse: " + conf.hiveMetastoreWarehouse)
68-
// scalastyle:on println
69-
c
64+
loadHiveConfToSQLConf()
65+
executionHive.conf
7066
}
7167

7268
setDefaultOverrideConfs()
@@ -147,6 +143,13 @@ private[hive] class HiveSessionState(sparkSession: SparkSession)
147143
setConf(ConfVars.HIVE_SUPPORT_SQL11_RESERVED_KEYWORDS.varname, "false")
148144
}
149145

146+
/**
147+
* Load all the params in HiveConf into SQLConf.
148+
*/
149+
def loadHiveConfToSQLConf(): Unit = {
150+
conf.setConf(executionHive.conf.getAllProperties)
151+
}
152+
150153
override def setConf(key: String, value: String): Unit = {
151154
super.setConf(key, value)
152155
executionHive.runSqlHive(s"SET $key=$value")

sql/hive/src/main/scala/org/apache/spark/sql/hive/test/TestHive.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -450,6 +450,7 @@ private[hive] class TestHiveSparkSession(
450450
TestHiveContext.hiveClientConfigurations(
451451
sessionState.hiveconf, warehousePath, scratchDirPath, metastoreTemporaryConf)
452452
.foreach { case (k, v) => sessionState.metadataHive.runSqlHive(s"SET $k=$v") }
453+
sessionState.loadHiveConfToSQLConf()
453454
sessionState.setDefaultOverrideConfs()
454455

455456
sessionState.catalog.setCurrentDatabase("default")

sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/HiveQuerySuite.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1177,6 +1177,7 @@ class HiveQuerySuite extends HiveComparisonTest with BeforeAndAfter {
11771177
}
11781178

11791179
conf.clear()
1180+
TestHive.reset()
11801181
}
11811182

11821183
test("current_database with multiple sessions") {

0 commit comments

Comments
 (0)