Docs: Fix tag-replacement example in Java API quickstart#17084
Open
thswlsqls wants to merge 1 commit into
Open
Docs: Fix tag-replacement example in Java API quickstart#17084thswlsqls wants to merge 1 commit into
thswlsqls wants to merge 1 commit into
Conversation
The "Replacing and fast forwarding" example called replaceBranch()
on a tag ("audit-tag"), which throws IllegalArgumentException at
runtime because UpdateSnapshotReferencesOperation.replaceBranch()
requires the target ref to be a branch. Use replaceTag() instead, the
API meant for this scenario.
Generated-by: Claude Code
ebyhr
reviewed
Jul 4, 2026
| // Replace "audit-tag" to point to snapshot 3 and update its retention | ||
| table.manageSnapshots() | ||
| .replaceBranch(tag, 4) | ||
| .replaceTag(tag, 4) |
Member
There was a problem hiding this comment.
Replace "audit-tag" to point to snapshot 3 and update its retention
I think we should replace 4 with 3:
Suggested change
| .replaceTag(tag, 4) | |
| .replaceTag(tag, 3) |
| table.manageSnapshots() | ||
| .replaceBranch(tag, 4) | ||
| .replaceTag(tag, 4) | ||
| .setMaxRefAgeMs(1000) |
Member
There was a problem hiding this comment.
The setMaxRefAgeMs requires two parameters:
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.
Closes #17081
Summary
replaceBranch(tag, 4)ontag = "audit-tag", a tag, which throwsIllegalArgumentExceptionat runtime (UpdateSnapshotReferencesOperation.replaceBranchrequires the target ref to be a branch).replaceTag(tag, 4), the APIManageSnapshotsprovides for replacing tags."audit-tag"as a tag two examples earlier (useRef("audit-tag")).Testing done
core/src/main/java/org/apache/iceberg/UpdateSnapshotReferencesOperation.java(replaceBranchguard) andapi/src/main/java/org/apache/iceberg/ManageSnapshots.java(replaceTagsignature).