lasdf1234 opened a new pull request, #14628:
URL: https://github.com/apache/gravitino/pull/14628
### What changes were proposed in this pull request?
Map Iceberg `NotFoundException` to `BadRequestException` (HTTP 400) in
`IcebergCatalogWrapper.loadTableMetadataFromLocation`.
### Why are the changes needed?
#14433 converted a missing metadata file to 400 inside
`IcebergCatalogWrapper.registerTable`,
but the REST path reads the metadata file earlier:
- `IcebergNamespaceOperationExecutor.registerTable` pre-reads it for schema
validation.
- `RegisterTableAuthzHandler` reads it to resolve source tables when
authorization is enabled.
Both call `loadTableMetadataFromLocation`, so `registerTable` with a
non-existent
`metadata-location` still returned HTTP 500 `NotFoundException` end to end.
Fixes #14302
### Does this PR introduce _any_ user-facing change?
`POST /v1/{prefix}/namespaces/{namespace}/register` with a
`metadata-location` that does not
exist now returns 400 `BadRequestException` instead of 500
`NotFoundException`.
### How was this patch tested?
- New unit test
`TestIcebergCatalogWrapper#testLoadTableMetadataFromMissingLocationIsBadRequest`.
- E2E against a standalone Iceberg REST server (memory catalog), following
the issue's steps:
- Before: registerTable overwrite with missing metadata -> 500;
createTable v2 + variant -> 400.
- After: both -> 400.
Made with [Cursor](https://cursor.com)
--
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]