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

    https://github.com/apache/spark/pull/21178#discussion_r185413718
  
    --- Diff: 
sql/hive-thriftserver/src/main/scala/org/apache/spark/sql/hive/thriftserver/SparkSQLCLIService.scala
 ---
    @@ -52,8 +52,22 @@ private[hive] class SparkSQLCLIService(hiveServer: 
HiveServer2, sqlContext: SQLC
     
         if (UserGroupInformation.isSecurityEnabled) {
           try {
    -        HiveAuthFactory.loginFromKeytab(hiveConf)
    -        sparkServiceUGI = Utils.getUGI()
    +        val principal = 
hiveConf.getVar(ConfVars.HIVE_SERVER2_KERBEROS_PRINCIPAL)
    +        val keyTabFile = 
hiveConf.getVar(ConfVars.HIVE_SERVER2_KERBEROS_KEYTAB)
    +        if (principal.isEmpty || keyTabFile.isEmpty) {
    +          throw new IOException(
    +            "HiveServer2 Kerberos principal or keytab is not correctly 
configured")
    +        }
    +
    +        val originalUgi = UserGroupInformation.getCurrentUser
    --- End diff --
    
    @mridulm thanks for your answer. Actually my question was a bit different, 
but @jerryshao answered me: which is the difference between 
`UserGroupInformation.getCurrentUser` and `Utils.getUGI()`? Since 
`Utils.getUGI()` does the same unless `HADOOP_USER_NAME` is set, my feeling was 
that using either one or the other function is the same here, so I just 
wondered why using one on one place and the other few lines after and not 
always the same one: I just wanted to make sure that they are actually the 
same. Thanks for you kind answers.


---

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

Reply via email to