Skip to content
Closed
Changes from all commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,18 @@ private[hive] class HiveClientImpl(
}

/** Returns the configuration for the current session. */
def conf: HiveConf = SessionState.get().getConf
def conf: HiveConf = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

var ss = SessionState.get()
// SessionState is lazy initialization, it can be null here
if (ss == null) {
val original = Thread.currentThread().getContextClassLoader
val conf = new HiveConf(classOf[SessionState])
conf.setClassLoader(original)
ss = new SessionState(conf)
SessionState.start(ss)
}
ss.getConf
}

override def getConf(key: String, defaultValue: String): String = {
conf.get(key, defaultValue)
Expand Down