From e197890c1d11f11bf2547ed18d28d46a3d758c82 Mon Sep 17 00:00:00 2001 From: Steve Vaughan Date: Thu, 2 May 2024 18:03:25 -0400 Subject: [PATCH] HIVE-28209: Allow the use of a proxy user (#5233) * HIVE-28209 Allow the use of a proxy user The log message indicates that `HADOOP_PROXY_USER` is set, but then doesn't allow its use by calling `getRealUser()` which will be `null`. This change allows delegation for HiveMetaStore connections. * Use getRealUserOrSelf from more recent Hadoop --------- Co-authored-by: Steve Vaughan Jr --- .../org/apache/hadoop/hive/metastore/HiveMetaStoreClient.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/standalone-metastore/metastore-common/src/main/java/org/apache/hadoop/hive/metastore/HiveMetaStoreClient.java b/standalone-metastore/metastore-common/src/main/java/org/apache/hadoop/hive/metastore/HiveMetaStoreClient.java index ec7d8bec37d9..9f62005d5f36 100644 --- a/standalone-metastore/metastore-common/src/main/java/org/apache/hadoop/hive/metastore/HiveMetaStoreClient.java +++ b/standalone-metastore/metastore-common/src/main/java/org/apache/hadoop/hive/metastore/HiveMetaStoreClient.java @@ -255,7 +255,7 @@ public HiveMetaStoreClient(Configuration conf, HiveMetaHookLoader hookLoader, Bo LOG.info(HADOOP_PROXY_USER + " is set. Using delegation " + "token for HiveMetaStore connection."); try { - UserGroupInformation.getLoginUser().getRealUser().doAs( + UserGroupInformation.getRealUserOrSelf(UserGroupInformation.getLoginUser()).doAs( new PrivilegedExceptionAction() { @Override public Void run() throws Exception {