You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by "zhouyifan279 (via GitHub)" <gi...@apache.org> on 2023/03/03 13:27:09 UTC

[GitHub] [iceberg] zhouyifan279 commented on a diff in pull request #6955: Use UGI shortUserName as the default owner of Hive objects

zhouyifan279 commented on code in PR #6955:
URL: https://github.com/apache/iceberg/pull/6955#discussion_r1124452626


##########
hive-metastore/src/main/java/org/apache/iceberg/hive/HiveHadoopUtil.java:
##########
@@ -30,11 +30,12 @@ public class HiveHadoopUtil {
   private HiveHadoopUtil() {}
 
   public static String currentUser() {
+    String username = null;
     try {
-      return UserGroupInformation.getCurrentUser().getUserName();
+      username = UserGroupInformation.getCurrentUser().getShortUserName();
     } catch (IOException e) {
       LOG.warn("Failed to get Hadoop user", e);
-      return System.getProperty("user.name");
     }
+    return username != null ? username : System.getProperty("user.name");

Review Comment:
   > Not sure why we need to change this, i think this makes it harder to read, with another conditional operator
   
   UserGroupInformation#getShortUserName() may return null before hadoop 2.8.2. But it rarely happens in practice.
   Let me restore the original code struct.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org