XN137 commented on code in PR #2370:
URL: https://github.com/apache/polaris/pull/2370#discussion_r2292772396


##########
runtime/service/src/main/java/org/apache/polaris/service/catalog/policy/PolicyCatalog.java:
##########
@@ -153,24 +157,46 @@ public Policy createPolicy(
     return constructPolicy(resultEntity);
   }
 
-  public List<PolicyIdentifier> listPolicies(Namespace namespace, PolicyType 
policyType) {
+  public List<PolicyIdentifier> listPolicies(Namespace namespace, @Nullable 
PolicyType policyType) {
     PolarisResolvedPathWrapper resolvedEntities = 
resolvedEntityView.getResolvedPath(namespace);
     if (resolvedEntities == null) {
       throw new IllegalStateException(
           String.format("Failed to fetch resolved namespace '%s'", namespace));
     }
 
-    List<PolarisEntity> catalogPath = resolvedEntities.getRawFullPath();
-    // TODO: when the "policyType" filter is null we should only call 
"listEntities" instead
+    List<PolarisEntityCore> catalogPath =
+        PolarisEntity.toCoreList(resolvedEntities.getRawFullPath());
+    if (policyType == null) {
+      // without a policyType filter we can call listEntities to acquire the 
entity names
+      ListEntitiesResult listEntitiesResult =
+          metaStoreManager.listEntities(

Review Comment:
   i did not mention this but i had checked before that both call paths are 
already covered by tests 
[here](https://github.com/apache/polaris/blob/bc5d0c49f788e3520761ba4aae1c19288a60452f/runtime/service/src/test/java/org/apache/polaris/service/catalog/AbstractPolicyCatalogTest.java#L312-L356)
 afaict
   



-- 
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-unsubscr...@polaris.apache.org

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

Reply via email to