File tree Expand file tree Collapse file tree 3 files changed +24
-45
lines changed
sql/hive/src/main/scala/org/apache/spark/sql/hive Expand file tree Collapse file tree 3 files changed +24
-45
lines changed Original file line number Diff line number Diff line change @@ -168,7 +168,18 @@ private[hive] class HiveQl(conf: ParserConf) extends SparkQl(conf) with Logging
168168 /**
169169 * Returns the HiveConf
170170 */
171- private [this ] def hiveConf : HiveConf = HiveConfUtil .conf
171+ private [this ] def hiveConf : HiveConf = {
172+ var ss = SessionState .get()
173+ // SessionState is lazy initialization, it can be null here
174+ if (ss == null ) {
175+ val original = Thread .currentThread().getContextClassLoader
176+ val conf = new HiveConf (classOf [SessionState ])
177+ conf.setClassLoader(original)
178+ ss = new SessionState (conf)
179+ SessionState .start(ss)
180+ }
181+ ss.getConf
182+ }
172183
173184 protected def getProperties (node : ASTNode ): Seq [(String , String )] = node match {
174185 case Token (" TOK_TABLEPROPLIST" , list) =>
Original file line number Diff line number Diff line change @@ -134,7 +134,18 @@ private[hive] class HiveClientImpl(
134134 }
135135
136136 /** Returns the configuration for the current session. */
137- def conf : HiveConf = HiveConfUtil .conf
137+ def conf : HiveConf = {
138+ var ss = SessionState .get()
139+ // SessionState is lazy initialization, it can be null here
140+ if (ss == null ) {
141+ val original = Thread .currentThread().getContextClassLoader
142+ val conf = new HiveConf (classOf [SessionState ])
143+ conf.setClassLoader(original)
144+ ss = new SessionState (conf)
145+ SessionState .start(ss)
146+ }
147+ ss.getConf
148+ }
138149
139150 override def getConf (key : String , defaultValue : String ): String = {
140151 conf.get(key, defaultValue)
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments