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


##########
hive-metastore/src/test/java/org/apache/iceberg/hive/TestHiveCatalog.java:
##########
@@ -426,6 +508,167 @@ public void testSetNamespaceProperties() throws 
TException {
         });
   }
 
+  @Test
+  public void testSetNamespaceOwnership() throws TException {
+    setNamespaceOwnershipAndVerify(
+        "set_individual_ownership_with_no_ownership_on_create",
+        ImmutableMap.of(),
+        ImmutableMap.of(HiveCatalog.HMS_DB_OWNER, "some_individual_owner"),
+        System.getProperty("user.name"),
+        PrincipalType.USER,
+        "some_individual_owner",
+        PrincipalType.USER);
+
+    setNamespaceOwnershipAndVerify(
+        "change_individual_ownership",
+        ImmutableMap.of(HiveCatalog.HMS_DB_OWNER, "some_individual_owner"),
+        ImmutableMap.of(HiveCatalog.HMS_DB_OWNER, 
"some_other_individual_owner"),
+        "some_individual_owner",
+        PrincipalType.USER,
+        "some_other_individual_owner",
+        PrincipalType.USER);
+
+    setNamespaceOwnershipAndVerify(
+        "change_individual_to_group_ownership_1",
+        ImmutableMap.of(HiveCatalog.HMS_DB_OWNER, "some_owner"),
+        ImmutableMap.of(HiveCatalog.HMS_DB_OWNER_TYPE, 
PrincipalType.GROUP.name()),

Review Comment:
   Taken. Indeed, and this works with what you later suggested: have separate 
precondition check at each public API, not at the convertToDatabaseLevel



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