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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to