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


##########
hive-metastore/src/test/java/org/apache/iceberg/hive/TestHiveCatalog.java:
##########
@@ -426,6 +484,40 @@ public void testSetNamespaceProperties() throws TException 
{
         });
   }
 
+  @Test
+  public void testSetNamespaceOwnership() throws TException {
+    Map<String, String> prop =
+        ImmutableMap.of(TableProperties.HMS_DB_OWNER, "some_individual_owner");
+    String expectedOwner = "some_individual_owner";
+    PrincipalType expectedType = PrincipalType.USER;
+
+    setNamespaceOwnershipAndVerify("set_individual_ownership", prop, 
expectedOwner, expectedType);
+
+    prop =
+        ImmutableMap.of(
+            TableProperties.HMS_DB_OWNER,
+            "some_group_owner",
+            TableProperties.HMS_DB_OWNER_TYPE,
+            PrincipalType.GROUP.name());
+    expectedOwner = "some_group_owner";
+    expectedType = PrincipalType.GROUP;
+
+    setNamespaceOwnershipAndVerify("set_group_ownership", prop, expectedOwner, 
expectedType);
+  }
+
+  private void setNamespaceOwnershipAndVerify(
+      String name, Map<String, String> prop, String expectedOwner, 
PrincipalType expectedType)
+      throws TException {
+    Namespace namespace = Namespace.of(name);
+    catalog.createNamespace(namespace);
+    catalog.setProperties(namespace, prop);
+    Database database = metastoreClient.getDatabase(namespace.level(0));
+
+    // Once ownership is removed, expect the ownership and type to fall back 
to the default value

Review Comment:
   Yes, nice catch. I have perhaps made some copy paste error.



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