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/05 20:21:22 UTC

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

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


##########
hive-metastore/src/main/java/org/apache/iceberg/hive/HiveCatalog.java:
##########
@@ -567,8 +569,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 RuntimeException(

Review Comment:
   Looking through the `UGI` path, it looks like the only likely failure is that security (e.g. kerberos) is enabled, but something is misconfigured or the user isn't logged in.  It probably makes sense to just throw here, but we should use the java built-in `UncheckedIOException` since we have an IO cause (Iceberg's `RuntimeIOException` is probably best for when we don't have an IO cause).



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