sririshindra opened a new pull request, #15525:
URL: https://github.com/apache/iceberg/pull/15525
## Summary
This PR exposes overwrite-aware table registration through the catalog API
and wires it through the REST catalog implementation.
Support for `overwrite` was added to REST `RegisterTableRequest`, but it was
not available through the core `Catalog` API. This change closes that gap and
preserves backward compatibility for existing callers.
## What changed
- Added a new overload to `Catalog`:
- `registerTable(TableIdentifier identifier, String metadataFileLocation,
boolean overwrite)`
- Added a matching overload to `SessionCatalog`:
- `registerTable(SessionContext context, TableIdentifier ident, String
metadataFileLocation, boolean overwrite)`
Default behavior is backward-compatible:
- `overwrite=false` delegates to existing `registerTable(...)`
- `overwrite=true` throws `UnsupportedOperationException` unless an
implementation overrides it
Core/REST wiring:
- `BaseSessionCatalog.AsCatalog` now delegates the new overload to
`SessionCatalog`
- `RESTCatalog` overrides and delegates the new overload
- `RESTSessionCatalog` overrides the new overload and sends:
- `RegisterTableRequest.builder().overwrite(overwrite)`
- `CatalogHandlers.registerTable` now passes `request.overwrite()` to the
catalog call
Tests:
- Added REST catalog tests to verify request propagation for:
- `overwrite=false`
- `overwrite=true`
- `overwrite=true` test validates that the request flag is propagated even
when backend catalog does not support overwrite (expected unsupported behavior)
## Compatibility
- Existing call sites using `registerTable(identifier,
metadataFileLocation)` are unchanged.
- New overwrite behavior is opt-in via the new overload.
## Testing
- Added/updated unit tests in:
- `core/src/test/java/org/apache/iceberg/rest/TestRESTCatalog.java`
- Verified targeted REST catalog tests pass for these changes.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]