Skip to content

Docs: Fix tag-replacement example in Java API quickstart #17081

Description

@thswlsqls

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions