Skip to content

Commit e16737c

Browse files
author
Davies Liu
committed
address comments
1 parent b70720f commit e16737c

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

sql/core/src/main/scala/org/apache/spark/sql/SQLContext.scala

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1208,7 +1208,10 @@ object SQLContext {
12081208
* This function can be used to create a singleton SQLContext object that can be shared across
12091209
* the JVM.
12101210
*
1211-
* If there an active SQLContext for current thread, it will returned instead of the global one.
1211+
* If there is an active SQLContext for current thread, it will returned instead of the global
1212+
* one.
1213+
*
1214+
* @since 1.5.0
12121215
*/
12131216
def getOrCreate(sparkContext: SparkContext): SQLContext = {
12141217
val ctx = activeContext.get()
@@ -1248,6 +1251,8 @@ object SQLContext {
12481251
* Changes the SQLContext that will be returned in this thread and its children when
12491252
* SQLContext.getOrCreate() is called. This can be used to ensure that a given thread receives
12501253
* a SQLContext with an isolated session, instead of the global (first created) context.
1254+
*
1255+
* @since 1.6.0
12511256
*/
12521257
def setActive(ctx: SQLContext): Unit = {
12531258
activeContext.set(ctx)
@@ -1256,6 +1261,8 @@ object SQLContext {
12561261
/**
12571262
* Clears the active SQLContext for current thread. Subsequent calls to getOrCreate will
12581263
* return the first created context instead of a thread-local override.
1264+
*
1265+
* @since 1.6.0
12591266
*/
12601267
def clearActive(): Unit = {
12611268
activeContext.remove()

sql/hive-thriftserver/src/main/scala/org/apache/spark/sql/hive/thriftserver/SparkExecuteStatementOperation.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,9 +190,11 @@ private[hive] class SparkExecuteStatementOperation(
190190
statementId = UUID.randomUUID().toString
191191
logInfo(s"Running query '$statement' with $statementId")
192192
setState(OperationState.RUNNING)
193+
// Always use the latest class loader provided by executionHive's state.
193194
val executionHiveClassLoader =
194195
hiveContext.executionHive.state.getConf.getClassLoader
195196
Thread.currentThread().setContextClassLoader(executionHiveClassLoader)
197+
196198
HiveThriftServer2.listener.onStatementStart(
197199
statementId,
198200
parentSession.getSessionHandle.getSessionId.toString,

0 commit comments

Comments
 (0)