Skip to content

Commit

Permalink
[SQL] Set sessionState in QueryExecution.
Browse files Browse the repository at this point in the history
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.

(cherry picked from commit 804949d)
Signed-off-by: Michael Armbrust <michael@databricks.com>
  • Loading branch information
yhuai authored and marmbrus committed Feb 8, 2015
1 parent bc55e20 commit 42c56b6
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 42c56b6

Please sign in to comment.