[#11138][#11137] refactor(iceberg-rest): federation handling via FederatedCatalogWrapper subclass#11367
Draft
roryqi wants to merge 3 commits into
Draft
[#11138][#11137] refactor(iceberg-rest): federation handling via FederatedCatalogWrapper subclass#11367roryqi wants to merge 3 commits into
roryqi wants to merge 3 commits into
Conversation
…tedCatalogWrapper subclass Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Code Coverage Report
Files
|
…ods into FederatedCatalogWrapper The *Internal methods (createTable/loadTable/registerTable/updateTable and their staged-create helpers) are only invoked from the federated path, so keep the base CatalogWrapperForREST free of federation-specific code by relocating them into FederatedCatalogWrapper as private members. Extract a shared buildLoadTableResponseFromFileIo helper to dedup the identical FileIO-extraction blocks, and expose catalogPropertiesToClientKeys as protected since the base filter helper still needs it. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…atalog-wrapper-11138 # Conflicts: # iceberg/iceberg-rest-server/src/main/java/org/apache/gravitino/iceberg/service/CatalogWrapperForREST.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes were proposed in this pull request?
Federation logic in
CatalogWrapperForRESTwas implemented as scatteredinstanceof RESTCatalog/isRESTCatalog()short-circuits across the class.This PR refactors them into polymorphic dispatch and fixes the missing
registerTablefederation path:FederatedCatalogWrapper extends CatalogWrapperForRESTthat overrides theoperations needing federation-aware behavior:
createTable,loadTable,updateTable,registerTable, andbuildCatalogConfigToClients.CatalogWrapperForREST.create(...)factory that returns the federatedsubclass when the backend is
rest, and wireIcebergCatalogWrapperManagerto it.
registerTableInternal, mirroringloadTableInternal, so federatedregisterTableextracts FileIO-derived client config and credential fieldsfrom the remote catalog's
table.io()(previously dropped). ([Subtask] Add federation FileIO-property-extraction to registerTable #11137)instanceof/isRESTCatalog()branches from the baseclass (
createTable,loadTable,updateTable,shouldGenerateCredential),and make
buildCatalogConfigToClientsan overridable instance method backed bya shared
filterCatalogConfigForClientshelper.Why are the changes needed?
Adding a new federated operation required remembering to add a corresponding
instanceofcheck; nothing in the type system enforced it. The missingregisterTablefederation handling was a direct bug from this pattern: afederated
registerTablereturned aLoadTableResponsewithout theFileIO-derived properties and credential fields that
createTable/loadTableinclude. Polymorphic dispatch removes the foot-gun and fixes the bug.
Fix: #11138
Fix: #11137
Does this PR introduce any user-facing change?
No. Federated
registerTableresponses now include the FileIO/credential clientconfig they should have included before; no API or property-key changes.
How was this patch tested?
./gradlew :iceberg:iceberg-rest-server:test -PskipITs(full module unit suitegreen), plus new unit tests:
testCreateReturnsFederatedWrapperForRestBackendtestCreateReturnsBaseWrapperForNonRestBackendtestFederatedRegisterTableIncludesFileIoExisting
buildCatalogConfigToClientstests were updated to exercise thepolymorphic source selection and the shared filter helper.
🤖 Generated with Claude Code