This is an automated email from the ASF dual-hosted git repository.

dongjoon pushed a commit to branch branch-3.5
in repository https://gitbox.apache.org/repos/asf/spark.git


The following commit(s) were added to refs/heads/branch-3.5 by this push:
     new f0e5fc973c1c [SPARK-46562][SQL] Remove retrieval of `keytabFile` from 
`UserGroupInformation` in `HiveAuthFactory`
f0e5fc973c1c is described below

commit f0e5fc973c1c87dbe1b0574e5d14e97b55abfa03
Author: yangjie01 <yangji...@baidu.com>
AuthorDate: Tue Jan 2 08:13:29 2024 -0800

    [SPARK-46562][SQL] Remove retrieval of `keytabFile` from 
`UserGroupInformation` in `HiveAuthFactory`
    
    ### What changes were proposed in this pull request?
    This pr removed the retrieval of `keytabFile` from `UserGroupInformation` 
in `HiveAuthFactory` because `keytabFile` no longer exists in 
`UserGroupInformation` after Hadoop 3.0.3. Therefore, in `HiveAuthFactory`, 
`keytabFile` will always be null and in `HiveAuthFactory`, `keytabFile` will 
only be used when it is not null.
    
    For the specific changes in Hadoop, please refer to 
https://issues.apache.org/jira/browse/HADOOP-9747 | 
https://github.com/apache/hadoop/commit/59cf7588779145ad5850ad63426743dfe03d8347.
    
    ### Why are the changes needed?
    Clean up the invalid code.
    
    ### Does this PR introduce _any_ user-facing change?
    No
    
    ### How was this patch tested?
    Pass GitHub Actions
    
    ### Was this patch authored or co-authored using generative AI tooling?
    No
    
    Closes #44557 from LuciferYang/remove-keytabFile.
    
    Authored-by: yangjie01 <yangji...@baidu.com>
    Signed-off-by: Dongjoon Hyun <dh...@apple.com>
    (cherry picked from commit bc7e949cf99382ecf70d5b59fca9e7e415fbbb48)
    Signed-off-by: Dongjoon Hyun <dh...@apple.com>
---
 .../java/org/apache/hive/service/auth/HiveAuthFactory.java | 14 +-------------
 1 file changed, 1 insertion(+), 13 deletions(-)

diff --git 
a/sql/hive-thriftserver/src/main/java/org/apache/hive/service/auth/HiveAuthFactory.java
 
b/sql/hive-thriftserver/src/main/java/org/apache/hive/service/auth/HiveAuthFactory.java
index 8d77b238ff41..e3316cef241c 100644
--- 
a/sql/hive-thriftserver/src/main/java/org/apache/hive/service/auth/HiveAuthFactory.java
+++ 
b/sql/hive-thriftserver/src/main/java/org/apache/hive/service/auth/HiveAuthFactory.java
@@ -17,7 +17,6 @@
 package org.apache.hive.service.auth;
 
 import java.io.IOException;
-import java.lang.reflect.Field;
 import java.lang.reflect.Method;
 import java.util.HashMap;
 import java.util.Map;
@@ -85,18 +84,9 @@ public class HiveAuthFactory {
   public static final String HS2_PROXY_USER = "hive.server2.proxy.user";
   public static final String HS2_CLIENT_TOKEN = "hiveserver2ClientToken";
 
-  private static Field keytabFile = null;
   private static Method getKeytab = null;
   static {
     Class<?> clz = UserGroupInformation.class;
-    try {
-      keytabFile = clz.getDeclaredField("keytabFile");
-      keytabFile.setAccessible(true);
-    } catch (NoSuchFieldException nfe) {
-      LOG.debug("Cannot find private field \"keytabFile\" in class: " +
-        UserGroupInformation.class.getCanonicalName(), nfe);
-      keytabFile = null;
-    }
 
     try {
       getKeytab = clz.getDeclaredMethod("getKeytab");
@@ -347,9 +337,7 @@ public class HiveAuthFactory {
   private static String getKeytabFromUgi() {
     synchronized (UserGroupInformation.class) {
       try {
-        if (keytabFile != null) {
-          return (String) keytabFile.get(null);
-        } else if (getKeytab != null) {
+        if (getKeytab != null) {
           return (String) 
getKeytab.invoke(UserGroupInformation.getCurrentUser());
         } else {
           return null;


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

Reply via email to