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


##########
runtime/service/src/main/java/org/apache/polaris/service/catalog/policy/PolicyCatalog.java:
##########
@@ -162,34 +161,15 @@ public List<PolicyIdentifier> listPolicies(Namespace 
namespace, PolicyType polic
     }
 
     List<PolarisEntity> catalogPath = resolvedEntities.getRawFullPath();
-    List<PolicyEntity> policyEntities =
-        metaStoreManager
-            .listEntities(
-                callContext.getPolarisCallContext(),
-                PolarisEntity.toCoreList(catalogPath),
-                PolarisEntityType.POLICY,
-                PolarisEntitySubType.NULL_SUBTYPE,
-                PageToken.readEverything())
-            .getEntities()
-            .stream()
-            .map(
-                polarisEntityActiveRecord ->
-                    PolicyEntity.of(
-                        metaStoreManager
-                            .loadEntity(
-                                callContext.getPolarisCallContext(),
-                                polarisEntityActiveRecord.getCatalogId(),
-                                polarisEntityActiveRecord.getId(),
-                                polarisEntityActiveRecord.getType())
-                            .getEntity()))
-            .filter(
-                policyEntity -> policyType == null || 
policyEntity.getPolicyType() == policyType)
-            .toList();
-
-    List<PolarisEntity.NameAndId> entities =
-        policyEntities.stream().map(PolarisEntity::nameAndId).toList();
-
-    return entities.stream()
+    return metaStoreManager
+        .loadEntitiesAll(
+            callContext.getPolarisCallContext(),
+            PolarisEntity.toCoreList(catalogPath),
+            PolarisEntityType.POLICY,
+            PolarisEntitySubType.NULL_SUBTYPE,
+            PolicyEntity::of)
+        .stream()
+        .filter(policyEntity -> policyType == null || 
policyEntity.getPolicyType() == policyType)

Review Comment:
   i've added a TODO and pushed a follow-up to 
https://github.com/apache/polaris/pull/2370



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