diff options
author | Yin Huai <yhuai@databricks.com> | 2015-02-08 14:55:07 -0800 |
---|---|---|
committer | Michael Armbrust <michael@databricks.com> | 2015-02-08 14:55:07 -0800 |
commit | 804949d519e2caa293a409d84b4e6190c1105444 (patch) | |
tree | dd941424cc1b57edf07f3b6327727aa0ca467bcf /sql | |
parent | 75fdccca32972f86a975033d7c4ce576dd79290f (diff) | |
download | spark-804949d519e2caa293a409d84b4e6190c1105444.tar.gz spark-804949d519e2caa293a409d84b4e6190c1105444.tar.bz2 spark-804949d519e2caa293a409d84b4e6190c1105444.zip |
[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 <yhuai@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.
Diffstat (limited to 'sql')
-rw-r--r-- | sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveContext.scala | 5 |
1 files changed, 5 insertions, 0 deletions
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 ad37b7d0e6..2c00659496 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 |