Skip to content
Snippets Groups Projects
Commit 804949d5 authored by Yin Huai's avatar Yin Huai Committed by Michael Armbrust
Browse files

[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.
parent 75fdccca
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment