Repository: spark
Updated Branches:
  refs/heads/branch-1.3 bc55e20fd -> 42c56b6f1


[SQL] Set sessionState in QueryExecution.

This PR sets the SessionState in HiveContext's QueryExecution. So, we can make 
sure that SessionState.get can return the SessionState every time.

Author: Yin Huai <yh...@databricks.com>

Closes #4445 from yhuai/setSessionState and squashes the following commits:

769c9f1 [Yin Huai] Remove unused import.
439f329 [Yin Huai] Try again.
427a0c9 [Yin Huai] Set SessionState everytime when we create a QueryExecution 
in HiveContext.
a3b7793 [Yin Huai] Set sessionState when dealing with CreateTableAsSelect.

(cherry picked from commit 804949d519e2caa293a409d84b4e6190c1105444)
Signed-off-by: Michael Armbrust <mich...@databricks.com>


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

Branch: refs/heads/branch-1.3
Commit: 42c56b6f1820f258c85d799e1acd8ae51fe5196a
Parents: bc55e20
Author: Yin Huai <yh...@databricks.com>
Authored: Sun Feb 8 14:55:07 2015 -0800
Committer: Michael Armbrust <mich...@databricks.com>
Committed: Sun Feb 8 14:55:16 2015 -0800

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


http://git-wip-us.apache.org/repos/asf/spark/blob/42c56b6f/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 ad37b7d..2c00659 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
@@ -424,6 +424,11 @@ class HiveContext(sc: SparkContext) extends SQLContext(sc) 
{
   /** Extends QueryExecution with hive specific features. */
   protected[sql] class QueryExecution(logicalPlan: LogicalPlan)
     extends super.QueryExecution(logicalPlan) {
+    // Like what we do in runHive, makes sure the session represented by the
+    // `sessionState` field is activated.
+    if (SessionState.get() != sessionState) {
+      SessionState.start(sessionState)
+    }
 
     /**
      * Returns the result as a hive compatible sequence of strings.  For 
native commands, the


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@spark.apache.org
For additional commands, e-mail: commits-h...@spark.apache.org

Reply via email to