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/02 19:16:58 UTC

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

szehon-ho commented on code in PR #6324:
URL: https://github.com/apache/iceberg/pull/6324#discussion_r1038443524


##########
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:
   I think this was also discussed in https://github.com/apache/iceberg/pull/6045#discussion_r1004158438.  Should we just warn and fallback?  @gaborkaszab @danielcweeks 
   
   by the way, if we throw we have our own UnchekcedIOException



##########
hive-metastore/src/main/java/org/apache/iceberg/hive/HiveTableOperations.java:
##########
@@ -470,6 +481,22 @@ private void setHmsTableParameters(
     // remove any props from HMS that are no longer present in Iceberg table props
     obsoleteProps.forEach(parameters::remove);
 
+    if (metadata.property(HiveCatalog.HMS_TABLE_OWNER, null) != null) {

Review Comment:
   Looks like this code is for the update case and is going a bit beyond original behavior (which was for create case).  
   
   cc @gaborkaszab for thoughts
   
   And does it align with database/namespace update?



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