You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spark.apache.org by do...@apache.org on 2024/01/02 16:13:41 UTC
(spark) branch master updated: [SPARK-46562][SQL] Remove retrieval of `keytabFile` from `UserGroupInformation` in `HiveAuthFactory`
This is an automated email from the ASF dual-hosted git repository.
dongjoon pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/spark.git
The following commit(s) were added to refs/heads/master by this push:
new bc7e949cf993 [SPARK-46562][SQL] Remove retrieval of `keytabFile` from `UserGroupInformation` in `HiveAuthFactory`
bc7e949cf993 is described below
commit bc7e949cf99382ecf70d5b59fca9e7e415fbbb48
Author: yangjie01 <ya...@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 <ya...@baidu.com>
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-unsubscribe@spark.apache.org
For additional commands, e-mail: commits-help@spark.apache.org