wecharyu commented on code in PR #5766:
URL: https://github.com/apache/hive/pull/5766#discussion_r2164371907


##########
ql/src/java/org/apache/hadoop/hive/ql/security/authorization/plugin/metastore/events/AlterPartitionEvent.java:
##########
@@ -76,10 +76,15 @@ private List<HivePrivilegeObject> getOutputHObjs() {
     ret.add(getHivePrivilegeObject(event.getTable()));
 
     Partition newPartition = event.getNewPartition();
+    Partition oldPartition = event.getOldPart();
+
     String    newUri       = (newPartition != null) ? 
getSdLocation(newPartition.getSd()) : "";
+    String    oldUri       = (oldPartition != null) ? 
getSdLocation(oldPartition.getSd()) : "";
 
-    if (StringUtils.isNotEmpty(newUri)) {
-        ret.add(getHivePrivilegeObjectDfsUri(newUri));
+    // Skip DFS_URI auth if old and new partition uri are empty or same
+    if (StringUtils.isNotEmpty(newUri) && StringUtils.isNotEmpty(oldUri) && 
!StringUtils.equalsIgnoreCase(oldUri,

Review Comment:
   Not quite understand why not need check the newUri auth when oldUri is empty 
but newUri is not.
   
   > But I see your point this condition would be anyways covered by 
!StringUtils.equalsIgnoreCase(oldUri, newUri).
   
   But the check would fail-fast by `StringUtils.isNotEmpty(oldUri)` in your 
current implementation.



-- 
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: gitbox-unsubscr...@hive.apache.org

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


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

Reply via email to