You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by GitBox <gi...@apache.org> on 2022/12/19 00:04:58 UTC

[GitHub] [iceberg] rdblue commented on a diff in pull request #6324: Make UGI current user the default owner of Hive db&tbl

rdblue commented on code in PR #6324:
URL: https://github.com/apache/iceberg/pull/6324#discussion_r1051690244


##########
hive-metastore/src/main/java/org/apache/iceberg/hive/HiveCatalog.java:
##########
@@ -567,8 +570,13 @@ Database convertToDatabase(Namespace namespace, Map<String, String> meta) {
         });
 
     if (database.getOwnerName() == null) {
-      database.setOwnerName(System.getProperty("user.name"));
-      database.setOwnerType(PrincipalType.USER);
+      try {
+        database.setOwnerName(UserGroupInformation.getCurrentUser().getUserName());
+        database.setOwnerType(PrincipalType.USER);
+      } catch (IOException e) {
+        throw new UncheckedIOException(
+            String.format("Fail to obtain default (UGI) user for database %s", database), e);

Review Comment:
   I think this should fall back to the previous behavior. This should be a warning, not an exception.
   
   Also, I think the message could be more clear: "Failed to fetch Hadoop user". No need to log the database, it's unrelated to what failed.



-- 
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