jerryshao opened a new issue, #11138:
URL: https://github.com/apache/gravitino/issues/11138

   ## Describe the subtask
   
   Federation logic in `CatalogWrapperForREST` is implemented as 5 scattered 
`instanceof RESTCatalog` short-circuits across the class. Adding a new 
federated operation requires remembering to add the corresponding check; 
nothing in the type system enforces it. The missing `registerTable` federation 
handling (tracked separately) is a direct example of a bug introduced by this 
pattern.
   
   **Files:**
   - 
`iceberg/iceberg-rest-server/src/main/java/org/apache/gravitino/iceberg/service/CatalogWrapperForREST.java`
 (lines 131, 148, 162, 236, 336)
   
   **Fix:** Refactor to a `FederatedCatalogWrapper extends 
CatalogWrapperForREST` subclass that overrides the operations needing 
federation-aware behavior (`createTable`, `loadTable`, `updateTable`, 
`registerTable`, `buildCatalogConfigToClients`). Use a factory method to return 
the appropriate subclass based on whether the underlying catalog is a 
`RESTCatalog`. The `instanceof` checks are replaced by polymorphic dispatch.
   
   ## Parent issue
   
   https://github.com/apache/gravitino/issues/11131


-- 
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