vigneshio commented on code in PR #5145:
URL: https://github.com/apache/polaris/pull/5145#discussion_r3647038213


##########
runtime/service/src/main/java/org/apache/polaris/service/exception/IcebergExceptionMapper.java:
##########
@@ -177,7 +177,7 @@ static int mapExceptionToResponseCode(RuntimeException rex) 
{
       case CommitFailedException e -> Status.CONFLICT.getStatusCode();
       case UnprocessableEntityException e -> 422;
       case CherrypickAncestorCommitException e -> 
Status.BAD_REQUEST.getStatusCode();
-      case CommitStateUnknownException e -> Status.BAD_REQUEST.getStatusCode();
+      case CommitStateUnknownException e -> 
Status.INTERNAL_SERVER_ERROR.getStatusCode();

Review Comment:
   Good point - Polaris itself doesn't throw `CommitStateUnknownException`, so 
the mapping looks unused for native catalogs. It is reached through federation:
   
   - Iceberg REST federation: `ErrorHandlers` maps upstream 500/502/503/504 -> 
CommitStateUnknownException, so a 5xx from a federated Iceberg REST catalog 
surfaces through our REST layer.
   
   - Hive federation: `HiveFederatedCatalogFactory` embeds Iceberg's 
HiveCatalog, and `HiveTableOperations/HiveViewOperations` throw it on ambiguous 
commit outcomes. Today that path returns 400, so the downstream client gets 
`BadRequestException` instead of commit-state-unknown. This change fixes that 
mapping.
   
   On collapsing 504 to 500: the spec lists both for this commit error and 
clients handle them the same way, so semantics are preserved. Threading the 
original upstream status through the exception would need extra plumbing; happy 
to do that as a follow-up.
   
   I'll start a [DISCUSS] thread on `dev` as suggested. 👀 



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to