Skip to content

Commit

Permalink
start UT STS without Impersonation and
Browse files Browse the repository at this point in the history
  • Loading branch information
AngersZhuuuu committed Aug 12, 2019
1 parent ac87ffc commit 3f273a6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
Expand Up @@ -118,18 +118,22 @@ private[hive] class SparkSQLSessionManager(hiveServer: HiveServer2, sqlContext:
}
handleToSession.put(session.getSessionHandle, session)

val sparkSession = sparkSessionManager.getOrCreteSparkSession(
session,
sessionUGI,
withImpersonation)
val sqlContext = if(withImpersonation) {
sparkSessionManager.getOrCreteSparkSession(
session,
sessionUGI,
withImpersonation).sqlContext
} else {
SparkSQLEnv.sqlContext.newSession()
}
val sessionHandle = session.getSessionHandle
HiveThriftServer2.listener.onSessionCreated(
session.getIpAddress, sessionHandle.getSessionId.toString, session.getUsername)
sparkSession.sqlContext.setConf(HiveUtils.FAKE_HIVE_VERSION.key, HiveUtils.builtinHiveVersion)
sqlContext.setConf(HiveUtils.FAKE_HIVE_VERSION.key, HiveUtils.builtinHiveVersion)
if (sessionConf != null && sessionConf.containsKey("use:database")) {
sparkSession.sql(s"use ${sessionConf.get("use:database")}")
sqlContext.sql(s"use ${sessionConf.get("use:database")}")
}
sparkSqlOperationManager.sessionToContexts.put(sessionHandle, sparkSession.sqlContext)
sparkSqlOperationManager.sessionToContexts.put(sessionHandle, sqlContext)
sessionHandle
}

Expand Down
Expand Up @@ -910,6 +910,7 @@ abstract class HiveThriftServer2Test extends SparkFunSuite with BeforeAndAfterAl

s"""$startScript
| --master local
| --hiveconf ${ConfVars.HIVE_SERVER2_ENABLE_DOAS}=false
| --hiveconf ${ConfVars.METASTORECONNECTURLKEY}=$metastoreJdbcUri
| --hiveconf ${ConfVars.METASTOREWAREHOUSE}=$warehousePath
| --hiveconf ${ConfVars.HIVE_SERVER2_THRIFT_BIND_HOST}=localhost
Expand Down

0 comments on commit 3f273a6

Please sign in to comment.