Refactor: Move ETag computation from adaptor into IcebergCatalogHandler#4238
Open
Wency42601 wants to merge 1 commit intoapache:mainfrom
Open
Refactor: Move ETag computation from adaptor into IcebergCatalogHandler#4238Wency42601 wants to merge 1 commit intoapache:mainfrom
Wency42601 wants to merge 1 commit intoapache:mainfrom
Conversation
904fd30 to
8739900
Compare
tm0nk
reviewed
Apr 21, 2026
There was a problem hiding this comment.
The Gradle Build Checks indicate there are format violations in this file that can be fixed with ./gradlew spotlessApply
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.
Summary
Push the ETag computation out of
IcebergCatalogAdapter(a JAX-RStransport layer) and into
IcebergCatalogHandler, where the semanticsof "a load-table response's etag" actually live. The adapter now only
copies the handler-provided etag onto the HTTP
ETagheader.This also addresses the existing TODO in
IcebergCatalogHandler.loadTableabout creating a canonical interface for associating etags with entities.
Changes
ETaggedLoadTableResponserecord pairing aLoadTableResponsewith an
Optional<String>etag.IcebergCatalogHandlerwithETag(LoadTableResponse, TableIdentifier)helperthat centralizes the "metadata location -> etag" rule and the
previously-adapter-side warning when
metadataLocationis null.createTableDirect(ns, req, delegationModes, refreshEndpoint)registerTable(ns, req)loadTable(id, snapshots, IfNoneMatch, delegationModes, refreshEndpoint)(returns
Optional<ETaggedLoadTableResponse>).loadTable(id, snapshots),loadTableIfStale,createTableDirect(ns, req), etc.) keep theirexisting
LoadTableResponse-shaped contracts by unwrapping via.response()/.map(ETaggedLoadTableResponse::response).IcebergCatalogAdaptertryInsertETagHeader.toResponseBuilder(ETaggedLoadTableResponse); only setsHttpHeaders.ETAGwhen the handler supplied one.createTable,loadTable(still 304s onOptional.empty()),and
registerTablecall sites.Test plan
IcebergCatalogAdapterETagTestcovering thefull adapter -> handler path end-to-end (6 tests, all pass):
createTableDirectsetsETagtoIcebergHttpUtil.generateETagForMetadataFileLocation(metadataLocation).ETag(no metadata location yet).loadTablereturns the sameETagascreateTable.loadTablewith matchingIf-None-Match->304 Not Modified.loadTablewith mismatchedIf-None-Match->200plus currentETag.registerTableresponse carries the expectedETag.IcebergCatalogHandlerAuthzTest(6005 tests),
IcebergCatalogAdapterTest(17),IfNoneMatchTest(16).:polaris-runtime-service:compileJavaandcompileTestJavasucceed with no new warnings.
Checklist
CHANGELOG.md(if needed)site/content/in-dev/unreleased(if needed)