ysung opened a new pull request, #17401: URL: https://github.com/apache/iceberg/pull/17401
## Stacked PR This is a draft follow-up to #17388. Until #17388 merges, GitHub shows both commits in this PR; the incremental diff is the specialized-table and REST support described below. ## Summary - let specialized `Table` implementations opt in to `CachingCatalog` commit tracking without mutating delegate-owned instances - preserve the concrete table type and validate that operations replacement returns an independent, correctly wired copy - opt `RESTTable` in while preserving REST state and server-side scan planning - return unsupported or contract-violating table implementations normally, but leave them uncached so they cannot retain stale entries - emit one actionable warning per unsupported concrete table class ## Change size relative to #17388 - production/business logic: 212 changed lines (`+189/-23`, net `+166`) across 3 files - tests: 261 changed lines (`+261/-0`) across 2 files - approximately 55% of the incremental changed lines are regression coverage ## Design #17388 installs commit-tracking operations on exact `BaseTable` instances. Specialized subclasses cannot be reconstructed as `BaseTable` without losing subtype behavior. This follow-up adds `SupportsOperationsReplacement`. An implementation receives replacement operations and returns an independent copy of the same concrete class. Before caching that copy, `CachingCatalog` verifies that: - it is non-null and distinct from the delegate-owned table - it has the exact same concrete class - it exposes the supplied operations - the original table's operations were not mutated `RESTTable` implements the contract by copying all REST-specific state along with the replacement operations. The REST regression test verifies that a commit overlapping a reload observes the committed snapshot and that `planFiles()` still uses server-side planning. Implementations that do not opt in, or violate the replacement contract, remain usable but are not cached. This prioritizes correctness over cache hit rate for unknown downstream table types. ## Open API question for maintainers The current draft uses a public `SupportsOperationsReplacement` interface, following the existing `SupportsDistributedScanPlanning` pattern. Despite its internal-use documentation, this still permanently adds a public Java type. An alternative is a protected `BaseTable` copy-with-operations hook. The implementation and tests do not otherwise depend on which API shape maintainers prefer. Feedback on this choice is requested before this PR is marked ready for review. ## Runtime behavior and tradeoffs - supported specialized tables retain their concrete runtime type and remain cacheable - `RESTTable` retains server-side scan planning - `operations()` returns the commit-tracking wrapper rather than the delegate operations' concrete runtime class - unsupported or contract-violating table implementations are returned normally but have a 100% cache-miss rate through `CachingCatalog` ## Validation - `./gradlew :iceberg-core:test --tests org.apache.iceberg.hadoop.TestCachingCatalog --tests org.apache.iceberg.rest.TestRESTScanPlanning.testCachingCatalogObservesCommitAfterConcurrentReloadWithServerSidePlanning` - `./gradlew :iceberg-core:spotlessApply` - `./gradlew :iceberg-core:revapi` - supported, unsupported, and contract-violating replacement implementations - REST server-side `planFiles()` execution after wrapping and commit reconciliation Part of #17338 --- **AI Disclosure** - Model: GPT-5 - Platform/Tool: Codex - Human Oversight: partially reviewed - Prompt Summary: Split specialized-table and REST commit tracking from the core CachingCatalog race fix, preserve subtype behavior, and validate the operations-replacement contract. -- 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]
