yuqi1129 commented on code in PR #6821:
URL: https://github.com/apache/gravitino/pull/6821#discussion_r2033141955


##########
authorizations/authorization-ranger/src/main/java/org/apache/gravitino/authorization/ranger/RangerAuthorizationHDFSPlugin.java:
##########
@@ -740,4 +776,39 @@ protected Map<String, String> 
getServiceConfigs(Map<String, String> config) {
                 RangerAuthorizationProperties.FS_DEFAULT_VALUE))
         .build();
   }
+
+  private interface PathExtractor {
+    String getPath(Entity.EntityType type, String location);
+  }
+
+  private static class TableOrFilesetPathExtractor implements PathExtractor {
+    @Override
+    public String getPath(Entity.EntityType type, String location) {
+      if (type == Entity.EntityType.CATALOG) {
+        return String.format("%s/*/*/", location);
+      } else if (type == Entity.EntityType.SCHEMA) {
+        return String.format("%s/*/", location);
+      }
+      if (type == Entity.EntityType.TABLE || type == 
Entity.EntityType.FILESET) {
+        return location;
+      } else {
+        throw new AuthorizationPluginException(
+            "Don't support %s to get table or fileset location", type);
+      }
+    }
+  }
+
+  private static class SchemaPathExtractor implements PathExtractor {
+    @Override
+    public String getPath(Entity.EntityType type, String location) {
+      if (type == Entity.EntityType.CATALOG) {
+        return String.format("%s/*/", location);
+      } else if (type == Entity.EntityType.SCHEMA) {
+        return location;
+      } else {
+        throw new AuthorizationPluginException(
+            "Don't support %s to get table or fileset location", type);

Review Comment:
   It's not allowed/supported to extract table or fileset path from entity %s



##########
authorizations/authorization-ranger/src/main/java/org/apache/gravitino/authorization/ranger/RangerAuthorizationHDFSPlugin.java:
##########
@@ -740,4 +776,39 @@ protected Map<String, String> 
getServiceConfigs(Map<String, String> config) {
                 RangerAuthorizationProperties.FS_DEFAULT_VALUE))
         .build();
   }
+
+  private interface PathExtractor {
+    String getPath(Entity.EntityType type, String location);

Review Comment:
   Please add some comments regarding the method and its corresponding 
parameters.
   
     
   



##########
authorizations/authorization-common/src/main/java/org/apache/gravitino/authorization/common/PathBasedMetadataObject.java:
##########
@@ -92,15 +92,26 @@ public String toString() {
   private final String name;
   private final String parent;
   private final String path;
+  private final boolean isRecursive;

Review Comment:
   I do like the name `isRecursive`, you may use `recursive` instead as there 
exists a method name `isRecursive()`



-- 
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: commits-unsubscr...@gravitino.apache.org

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

Reply via email to