Apache Iceberg version
main @ 49b89a8
Query engine
None (Java API)
Please describe the bug
The "Replacing and fast forwarding branches and tags" example in docs/docs/java-api-quickstart.md (line 255) calls table.manageSnapshots().replaceBranch(tag, 4) on tag = "audit-tag", a tag (already used as a tag two examples earlier via useRef("audit-tag")). UpdateSnapshotReferencesOperation.replaceBranch(String, long) (core/src/main/java/org/apache/iceberg/UpdateSnapshotReferencesOperation.java line 99-104) requires the target ref to be a branch (Preconditions.checkArgument(ref.isBranch(), "Ref %s is a tag not a branch", name)), so calling it on a tag throws IllegalArgumentException at runtime. ManageSnapshots already exposes replaceTag(String, long) (api/src/main/java/org/apache/iceberg/ManageSnapshots.java line 154) for exactly this case.
Steps to reproduce
Copy the quickstart example as written and run it against a table with an audit-tag tag: the call to replaceBranch(tag, 4) throws IllegalArgumentException: Ref audit-tag is a tag not a branch.
Additional context
N/A.
Apache Iceberg version
main @ 49b89a8
Query engine
None (Java API)
Please describe the bug
The "Replacing and fast forwarding branches and tags" example in
docs/docs/java-api-quickstart.md(line 255) callstable.manageSnapshots().replaceBranch(tag, 4)ontag = "audit-tag", a tag (already used as a tag two examples earlier viauseRef("audit-tag")).UpdateSnapshotReferencesOperation.replaceBranch(String, long)(core/src/main/java/org/apache/iceberg/UpdateSnapshotReferencesOperation.javaline 99-104) requires the target ref to be a branch (Preconditions.checkArgument(ref.isBranch(), "Ref %s is a tag not a branch", name)), so calling it on a tag throwsIllegalArgumentExceptionat runtime.ManageSnapshotsalready exposesreplaceTag(String, long)(api/src/main/java/org/apache/iceberg/ManageSnapshots.javaline 154) for exactly this case.Steps to reproduce
Copy the quickstart example as written and run it against a table with an
audit-tagtag: the call toreplaceBranch(tag, 4)throwsIllegalArgumentException: Ref audit-tag is a tag not a branch.Additional context
N/A.