Github user yaooqinn commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18648#discussion_r132195399
  
    --- Diff: 
sql/hive/src/main/scala/org/apache/spark/sql/hive/client/HiveClientImpl.scala 
---
    @@ -105,107 +105,69 @@ private[hive] class HiveClientImpl(
       // Create an internal session state for this HiveClientImpl.
       val state: SessionState = {
         val original = Thread.currentThread().getContextClassLoader
    -    // Switch to the initClassLoader.
    -    Thread.currentThread().setContextClassLoader(initClassLoader)
    -
    -    // Set up kerberos credentials for UserGroupInformation.loginUser 
within
    -    // current class loader
    -    if (sparkConf.contains("spark.yarn.principal") && 
sparkConf.contains("spark.yarn.keytab")) {
    -      val principalName = sparkConf.get("spark.yarn.principal")
    -      val keytabFileName = sparkConf.get("spark.yarn.keytab")
    -      if (!new File(keytabFileName).exists()) {
    -        throw new SparkException(s"Keytab file: ${keytabFileName}" +
    -          " specified in spark.yarn.keytab does not exist")
    -      } else {
    -        logInfo("Attempting to login to Kerberos" +
    -          s" using principal: ${principalName} and keytab: 
${keytabFileName}")
    -        UserGroupInformation.loginUserFromKeytab(principalName, 
keytabFileName)
    -      }
    -    }
    -
    -    def isCliSessionState(state: SessionState): Boolean = {
    -      var temp: Class[_] = if (state != null) state.getClass else null
    -      var found = false
    -      while (temp != null && !found) {
    -        found = temp.getName == 
"org.apache.hadoop.hive.cli.CliSessionState"
    -        temp = temp.getSuperclass
    +    if (clientLoader.isolationOn) {
    +      // Switch to the initClassLoader.
    +      Thread.currentThread().setContextClassLoader(initClassLoader)
    --- End diff --
    
    If `SessionState.get` be null, then the IsolateOn will be turned on always. 
Only if we call `SessionState.detachSession`, will this happens?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to