aboutsummaryrefslogtreecommitdiff
path: root/sql/hive
diff options
context:
space:
mode:
authorYin Huai <yhuai@databricks.com>2015-02-08 14:55:07 -0800
committerMichael Armbrust <michael@databricks.com>2015-02-08 14:55:07 -0800
commit804949d519e2caa293a409d84b4e6190c1105444 (patch)
treedd941424cc1b57edf07f3b6327727aa0ca467bcf /sql/hive
parent75fdccca32972f86a975033d7c4ce576dd79290f (diff)
downloadspark-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/hive')
-rw-r--r--sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveContext.scala5
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