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

    https://github.com/apache/spark/pull/9232#discussion_r43478370
  
    --- Diff: yarn/src/main/scala/org/apache/spark/deploy/yarn/Client.scala ---
    @@ -1337,55 +1337,9 @@ object Client extends Logging {
           conf: Configuration,
           credentials: Credentials) {
         if (shouldGetTokens(sparkConf, "hive") && 
UserGroupInformation.isSecurityEnabled) {
    -      val mirror = universe.runtimeMirror(getClass.getClassLoader)
    -
    -      try {
    -        val hiveConfClass = 
mirror.classLoader.loadClass("org.apache.hadoop.hive.conf.HiveConf")
    -        val hiveConf = hiveConfClass.newInstance()
    -
    -        val hiveConfGet = (param: String) => Option(hiveConfClass
    -          .getMethod("get", classOf[java.lang.String])
    -          .invoke(hiveConf, param))
    -
    -        val metastore_uri = hiveConfGet("hive.metastore.uris")
    -
    -        // Check for local metastore
    -        if (metastore_uri != None && metastore_uri.get.toString.size > 0) {
    -          val hiveClass = 
mirror.classLoader.loadClass("org.apache.hadoop.hive.ql.metadata.Hive")
    -          val hive = hiveClass.getMethod("get").invoke(null, 
hiveConf.asInstanceOf[Object])
    -
    -          val metastore_kerberos_principal_conf_var = mirror.classLoader
    -            .loadClass("org.apache.hadoop.hive.conf.HiveConf$ConfVars")
    -            
.getField("METASTORE_KERBEROS_PRINCIPAL").get("varname").toString
    -
    -          val principal = 
hiveConfGet(metastore_kerberos_principal_conf_var)
    -
    -          val username = 
Option(UserGroupInformation.getCurrentUser().getUserName)
    -          if (principal != None && username != None) {
    -            val tokenStr = hiveClass.getMethod("getDelegationToken",
    -              classOf[java.lang.String], classOf[java.lang.String])
    -              .invoke(hive, username.get, 
principal.get).asInstanceOf[java.lang.String]
    -
    -            val hive2Token = new Token[DelegationTokenIdentifier]()
    -            hive2Token.decodeFromUrlString(tokenStr)
    -            credentials.addToken(new 
Text("hive.server2.delegation.token"), hive2Token)
    -            logDebug("Added hive.Server2.delegation.token to conf.")
    -            hiveClass.getMethod("closeCurrent").invoke(null)
    -          } else {
    -            logError("Username or principal == NULL")
    -            logError(s"""username=${username.getOrElse("(NULL)")}""")
    -            logError(s"""principal=${principal.getOrElse("(NULL)")}""")
    -            throw new IllegalArgumentException("username and/or principal 
is equal to null!")
    -          }
    -        } else {
    -          logDebug("HiveMetaStore configured in localmode")
    -        }
    -      } catch {
    -        case e: java.lang.NoSuchMethodException => { logInfo("Hive Method 
not found " + e); return }
    -        case e: java.lang.ClassNotFoundException => { logInfo("Hive Class 
not found " + e); return }
    -        case e: Exception => { logError("Unexpected Exception " + e)
    -          throw new RuntimeException("Unexpected exception", e)
    -        }
    +      val util = new YarnSparkHadoopUtil()
    --- End diff --
    
    This should be `YarnSparkHadoopUtil.get`; you could also avoid the `val` 
altogether.


---
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