eric-maynard commented on code in PR #1314:
URL: https://github.com/apache/polaris/pull/1314#discussion_r2032103658


##########
service/common/src/main/java/org/apache/polaris/service/catalog/policy/PolicyCatalog.java:
##########
@@ -249,27 +246,246 @@ public Policy updatePolicy(
     return constructPolicy(newPolicyEntity);
   }
 
-  public boolean dropPolicy(PolicyIdentifier policyIdentifier, boolean 
detachAll) {
+  public void dropPolicy(PolicyIdentifier policyIdentifier, boolean detachAll) 
{
     // TODO: Implement detachAll when we support attach/detach policy
-    PolarisResolvedPathWrapper resolvedEntities =
-        resolvedEntityView.getPassthroughResolvedPath(
-            policyIdentifier, PolarisEntityType.POLICY, 
PolarisEntitySubType.NULL_SUBTYPE);
-    if (resolvedEntities == null) {
-      throw new NoSuchPolicyException(String.format("Policy does not exist: 
%s", policyIdentifier));
-    }
+    var resolvedPolicyPath = getResolvedPathWrapper(policyIdentifier);
+    var catalogPath = resolvedPolicyPath.getRawParentPath();
+    var policyEntity = resolvedPolicyPath.getRawLeafEntity();
 
-    List<PolarisEntity> catalogPath = resolvedEntities.getRawParentPath();
-    PolarisEntity leafEntity = resolvedEntities.getRawLeafEntity();
-
-    DropEntityResult dropEntityResult =
+    var result =
         metaStoreManager.dropEntityIfExists(
             callContext.getPolarisCallContext(),
             PolarisEntity.toCoreList(catalogPath),
-            leafEntity,
+            policyEntity,
             Map.of(),
             false);
 
-    return dropEntityResult.isSuccess();
+    if (!result.isSuccess()) {

Review Comment:
   > Not sure I understand completely. The http return code is controlled by 
the exception mapper, like IcebergExceptionMapper and PolarisExceptionMapper.
   
   This is true, but this method is not the final touchpoint between the 
business logic and the REST logic. From what I understand, there will be 
another layer on top of this like `IcebergCatalogAdapter`, right?
   
   > I didn't see any reason we need a boolean return. Or am I missing 
something?
   
   We fundamentally have a boolean outcome here -- the drop either succeeds or 
it does not. We could use an exception for flow control here, but if we can 
achieve the same outcome with a boolean shouldn't we prefer that?



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