Github user marmbrus commented on a diff in the pull request:
https://github.com/apache/spark/pull/4628#discussion_r24773167
--- Diff:
sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveContext.scala ---
@@ -204,22 +204,25 @@ class HiveContext(sc: SparkContext) extends
SQLContext(sc) {
* SQLConf. Additionally, any properties set by set() or a SET
command inside sql() will be
* set in the SQLConf *as well as* in the HiveConf.
*/
- @transient protected[hive] lazy val (hiveconf, sessionState) =
- Option(SessionState.get())
- .orElse {
- val newState = new SessionState(new
HiveConf(classOf[SessionState]))
- // Only starts newly created `SessionState` instance. Any
existing `SessionState` instance
- // returned by `SessionState.get()` must be the most recently
started one.
- SessionState.start(newState)
- Some(newState)
- }
- .map { state =>
- setConf(state.getConf.getAllProperties)
- if (state.out == null) state.out = new PrintStream(outputBuffer,
true, "UTF-8")
- if (state.err == null) state.err = new PrintStream(outputBuffer,
true, "UTF-8")
- (state.getConf, state)
- }
- .get
+ @transient protected[hive] lazy val sessionState: SessionState = {
+ var state = SessionState.get()
+ if (state == null) {
+ state = new SessionState(new HiveConf(classOf[SessionState]))
+ SessionState.start(state)
+ }
+ state
+ }
+
+ @transient protected[hive] lazy val hiveconf: HiveConf = {
+ setConf(sessionState.getConf.getAllProperties)
+ if (sessionState.out == null) {
+ sessionState.out = new PrintStream(outputBuffer, true, "UTF-8")
--- End diff --
why is this here and not with the initialization of session state?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]