ayushtkn commented on code in PR #5689:
URL: https://github.com/apache/hive/pull/5689#discussion_r2021794312


##########
ql/src/java/org/apache/hadoop/hive/ql/security/authorization/plugin/metastore/events/CreateTableEvent.java:
##########
@@ -76,20 +96,31 @@ private List<HivePrivilegeObject> getOutputHObjs() {
     List<HivePrivilegeObject> ret   = new ArrayList<>();
     PreCreateTableEvent       event = (PreCreateTableEvent) preEventContext;
     Table                     table = event.getTable();
-    Database                  database = event.getDatabase();
-    String                    uri   = getSdLocation(table.getSd());
+    Database               database = event.getDatabase();
+    String                      uri = getSdLocation(table.getSd());
 
     ret.add(getHivePrivilegeObject(database));
     ret.add(getHivePrivilegeObject(table));
 
-    if (StringUtils.isNotEmpty(uri) && 
!TableType.EXTERNAL_TABLE.toString().equalsIgnoreCase(table.getTableType())) {
-      ret.add(new HivePrivilegeObject(HivePrivilegeObjectType.DFS_URI, null, 
uri));
+    if (StringUtils.isNotEmpty(uri)) {
+      boolean isExternalTable = 
table.getTableType().equalsIgnoreCase(TableType.EXTERNAL_TABLE.toString());
+      String expectedTablePath = null;
+      try {
+        expectedTablePath = wh.getDefaultTablePath(database, 
table.getTableName(), isExternalTable).toString();
+      } catch (MetaException e) {
+        LOG.warn("Got exception fetching Default table location for table " + 
table.getTableName(), e);
+      }
+
+      // Skip DFS_URI for external tables and if managed table location is 
under default db path
+      if (!isExternalTable) {

Review Comment:
   curious, trying to understand: In getInputObj you didn't had this 
`!isExternalTable`, but here you have it, why?



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