DanielZhu58 commented on code in PR #5343:
URL: https://github.com/apache/hive/pull/5343#discussion_r1767600673


##########
ql/src/java/org/apache/hadoop/hive/ql/security/authorization/plugin/metastore/events/CreateTableEvent.java:
##########
@@ -79,6 +83,24 @@ private List<HivePrivilegeObject> getOutputHObjs() {
     Database                  database = event.getDatabase();
     String                    uri   = getSdLocation(table.getSd());
 
+    // if the table is an iceberg storagehandler based table , need storageuri 
as hive privilege objects
+    // format: storagehandler type + cluster + location
+    LOG.debug("<== CreateTableEvent.getOutputHObjs(): ret={}", ret);
+    if 
(table.getParameters().containsKey(hive_metastoreConstants.META_TABLE_STORAGE)) 
{
+      Configuration conf = new Configuration();
+      try {
+        HiveStorageHandler hiveStorageHandler = (HiveStorageHandler) 
ReflectionUtils.newInstance(
+                
conf.getClassByName(table.getParameters().get(hive_metastoreConstants.META_TABLE_STORAGE)),
 event.getHandler().getConf());
+        String storageUri = hiveStorageHandler.getURIForAuth(table).toString();
+        if (storageUri.contains("iceberg")) {

Review Comment:
   The reason we checked for iceberg is that a user using iceberg storage 
handler to create a new table is the only case this code patch would handle.
   Yes, it looks similar to AlterTableEvent#getOutputHObjs because we need to 
do the same process for both create and alter iceberg storage handler based 
table.



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