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/11/01 00:31:15 UTC

[GitHub] [iceberg] szehon-ho commented on a diff in pull request #6045: [iceberg-hive-metastore] Add support for individual and group ownership for Namespace

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


##########
hive-metastore/src/test/java/org/apache/iceberg/hive/TestHiveCatalog.java:
##########
@@ -257,21 +259,42 @@ public void testReplaceTxnBuilder() throws Exception {
   public void testCreateTableWithOwner() throws Exception {
     Schema schema = getTestSchema();
     PartitionSpec spec = PartitionSpec.builderFor(schema).bucket("data", 16).build();
-    TableIdentifier tableIdent = TableIdentifier.of(DB_NAME, "tbl");
-    String location = temp.newFolder("tbl").toString();
     String owner = "some_owner";
-    ImmutableMap<String, String> properties =
-        ImmutableMap.of(TableProperties.HMS_TABLE_OWNER, owner);
-
+    Map<String, String> prop = ImmutableMap.of(TableProperties.HMS_TABLE_OWNER, owner);

Review Comment:
   Curiuos, this is no longer related to the change, is it?  (This is for createTable?)



##########
hive-metastore/src/main/java/org/apache/iceberg/hive/HiveCatalog.java:
##########
@@ -539,12 +541,26 @@ Database convertToDatabase(Namespace namespace, Map<String, String> meta) {
             database.setDescription(value);
           } else if (key.equals("location")) {
             database.setLocationUri(value);
+          } else if (key.equals(TableProperties.HMS_DB_OWNER)) {
+            database.setOwnerName(value);
+          } else if (key.equals(TableProperties.HMS_DB_OWNER_TYPE)) {
+            database.setOwnerType(PrincipalType.valueOf(value));
           } else {
             if (value != null) {
               parameter.put(key, value);
             }
           }
         });
+
+    // default ownership on db level kept uniform with table level, see  HiveTableOperations#

Review Comment:
   I think the code comment is unnecessary (like, example, why not comment the other method and say its kept uniform with this one..), I would say remove comment entirely.



##########
hive-metastore/src/test/java/org/apache/iceberg/hive/TestHiveCatalog.java:
##########
@@ -257,21 +259,42 @@ public void testReplaceTxnBuilder() throws Exception {
   public void testCreateTableWithOwner() throws Exception {
     Schema schema = getTestSchema();
     PartitionSpec spec = PartitionSpec.builderFor(schema).bucket("data", 16).build();
-    TableIdentifier tableIdent = TableIdentifier.of(DB_NAME, "tbl");
-    String location = temp.newFolder("tbl").toString();
     String owner = "some_owner";
-    ImmutableMap<String, String> properties =
-        ImmutableMap.of(TableProperties.HMS_TABLE_OWNER, owner);
-
+    Map<String, String> prop = ImmutableMap.of(TableProperties.HMS_TABLE_OWNER, owner);
+
+    createTableAndVerifyOwnership(DB_NAME, "tbl", schema, spec, prop, owner);
+
+    prop = ImmutableMap.of();
+
+    // a table without an owner explicitly specified should have a default owner
+    createTableAndVerifyOwnership(
+        DB_NAME,
+        "no_explicit_owner_specified_tbl",
+        schema,
+        spec,
+        prop,

Review Comment:
   NIt, can we just pass ImmutableMap.of() here?



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