Repository: spark
Updated Branches:
  refs/heads/master 42d5077fd -> 7de4e50a0


[SQL] Initilize session state before creating CommandProcessor

With the old ordering it was possible for commands in the HiveDriver to NPE due 
to the lack of configuration in the threadlocal session state.

Author: Michael Armbrust <[email protected]>

Closes #2635 from marmbrus/initOrder and squashes the following commits:

9749850 [Michael Armbrust] Initilize session state before creating 
CommandProcessor


Project: http://git-wip-us.apache.org/repos/asf/spark/repo
Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/7de4e50a
Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/7de4e50a
Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/7de4e50a

Branch: refs/heads/master
Commit: 7de4e50a01e90bcf88e0b721b2b15a5162373d56
Parents: 42d5077
Author: Michael Armbrust <[email protected]>
Authored: Thu Oct 2 19:32:21 2014 -0700
Committer: Michael Armbrust <[email protected]>
Committed: Thu Oct 2 19:32:21 2014 -0700

----------------------------------------------------------------------
 .../src/main/scala/org/apache/spark/sql/hive/HiveContext.scala  | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/spark/blob/7de4e50a/sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveContext.scala
----------------------------------------------------------------------
diff --git 
a/sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveContext.scala 
b/sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveContext.scala
index fdb5690..8bcc098 100644
--- a/sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveContext.scala
+++ b/sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveContext.scala
@@ -281,13 +281,14 @@ class HiveContext(sc: SparkContext) extends 
SQLContext(sc) {
    */
   protected def runHive(cmd: String, maxRows: Int = 1000): Seq[String] = {
     try {
+      // Session state must be initilized before the CommandProcessor is 
created .
+      SessionState.start(sessionState)
+
       val cmd_trimmed: String = cmd.trim()
       val tokens: Array[String] = cmd_trimmed.split("\\s+")
       val cmd_1: String = cmd_trimmed.substring(tokens(0).length()).trim()
       val proc: CommandProcessor = CommandProcessorFactory.get(tokens(0), 
hiveconf)
 
-      SessionState.start(sessionState)
-
       proc match {
         case driver: Driver =>
           driver.init()


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to