spark-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From marmb...@apache.org
Subject git commit: [SQL] Initilize session state before creating CommandProcessor
Date Fri, 03 Oct 2014 02:32:37 GMT
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 <michael@databricks.com>

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 <michael@databricks.com>
Authored: Thu Oct 2 19:32:21 2014 -0700
Committer: Michael Armbrust <michael@databricks.com>
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: commits-unsubscribe@spark.apache.org
For additional commands, e-mail: commits-help@spark.apache.org


Mime
View raw message