haizhou-zhao commented on code in PR #6621:
URL: https://github.com/apache/iceberg/pull/6621#discussion_r1084710334


##########
hive-metastore/src/main/java/org/apache/iceberg/hive/HiveTableOperations.java:
##########
@@ -494,6 +494,17 @@ private void setHmsTableParameters(
     // remove any props from HMS that are no longer present in Iceberg table 
props
     obsoleteProps.forEach(parameters::remove);
 
+    // altering owner
+    if (metadata.properties().get(HiveCatalog.HMS_TABLE_OWNER) != null) {
+      tbl.setOwner(metadata.properties().get(HiveCatalog.HMS_TABLE_OWNER));
+    }
+
+    // dropping owner: instead of leaving the owner blank/null, the owner will 
be
+    // default to whoever is making the current drop operation
+    if (obsoleteProps.contains(HiveCatalog.HMS_TABLE_OWNER)) {

Review Comment:
   @gaborkaszab @szehon-ho I realized something: if we created table with 
default owner, then we won't be able to drop the table owner (flip from the 
default owner/current user to null). Reason is when creating a table without 
owner specified, the owner property is not tracked by Iceberg Metadata file 
(even though there is an owner - the default owner). The later drop will just 
be a noop instead of setting owner to null since it cannot detect this owner 
property disappeared.
   
   So I guess we have two way forward:
   1. We can totally ignore drop owner, so dropping owner of all table becomes 
a noop
   2. We can force creating table to always write the owner name to Iceberg 
Metadata file, whether with owner specified or not (when not specified then the 
default owner)
   
   In anyway, the current implementation even after switched to set null is 
wrong, it causes inconsistent behavior:
   1. When invoking drop owner on a table created with owner specified, it will 
set null
   2. When invoking drop owner on a table created without owner specified, it 
will be a noop



-- 
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-unsubscr...@iceberg.apache.org

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


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

Reply via email to