You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by "sririshindra (via GitHub)" <gi...@apache.org> on 2026/03/06 19:01:03 UTC
[PR] API, Core: Add overwrite-aware table registration [iceberg]
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: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
Re: [PR] API, Core: Add overwrite-aware table registration [iceberg]
Posted by "sririshindra (via GitHub)" <gi...@apache.org>.
sririshindra commented on PR #15525:
URL: https://github.com/apache/iceberg/pull/15525#issuecomment-4033519824
> Useful 'bridge'. A positive test would be nice (assuming overwrite can be 'easily' implemented as drop-if-exist/register).
Thanks @henrib , I have added a positive test as well as you 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: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
Re: [PR] API, Core: Add overwrite-aware table registration [iceberg]
Posted by "flyrain (via GitHub)" <gi...@apache.org>.
flyrain merged PR #15525:
URL: https://github.com/apache/iceberg/pull/15525
--
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-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
Re: [PR] API, Core: Add overwrite-aware table registration [iceberg]
Posted by "sririshindra (via GitHub)" <gi...@apache.org>.
sririshindra commented on PR #15525:
URL: https://github.com/apache/iceberg/pull/15525#issuecomment-4013927356
cc: @nandorKollar , @flyrain , @adutra
--
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-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
Re: [PR] API, Core: Add overwrite-aware table registration [iceberg]
Posted by "flyrain (via GitHub)" <gi...@apache.org>.
flyrain commented on code in PR #15525:
URL: https://github.com/apache/iceberg/pull/15525#discussion_r2990893272
##########
api/src/main/java/org/apache/iceberg/catalog/Catalog.java:
##########
@@ -347,6 +349,25 @@ default Table registerTable(TableIdentifier identifier, String metadataFileLocat
throw new UnsupportedOperationException("Registering tables is not supported");
}
+ /**
+ * Register a table with the catalog.
+ *
+ * @param identifier a table identifier
+ * @param metadataFileLocation the location of a metadata file
+ * @param overwrite whether to overwrite an existing table registration
+ * @return a Table instance
+ * @throws AlreadyExistsException if {@code overwrite} is false and the table already exists in
+ * the catalog
+ */
+ default Table registerTable(
Review Comment:
`CachingCatalog` should override the new `registerTable(identifier, metadataFileLocation, overwrite)` overload as well. Right now it only overrides the 2-arg variant, so calls with `overwrite=true` fall back to the default method on `Catalog`, which throws `UnsupportedOperationException` instead of delegating to the wrapped catalog. That means any catalog that supports overwrite registration loses that capability once it is wrapped by `CachingCatalog`. This wrapper should forward the 3-arg call and invalidate the cache just like the existing 2-arg implementation.
--
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-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
Re: [PR] API, Core: Add overwrite-aware table registration [iceberg]
Posted by "sririshindra (via GitHub)" <gi...@apache.org>.
sririshindra commented on PR #15525:
URL: https://github.com/apache/iceberg/pull/15525#issuecomment-4042303345
Thanks @adutra and @henrib for your reviews.
@flyrain could you please review this as well if you get a chance.
--
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-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
Re: [PR] API, Core: Add overwrite-aware table registration [iceberg]
Posted by "flyrain (via GitHub)" <gi...@apache.org>.
flyrain commented on PR #15525:
URL: https://github.com/apache/iceberg/pull/15525#issuecomment-4144332217
I will merge it by EOD if there is no more new comment.
--
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-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org