thswlsqls opened a new issue, #17081:
URL: https://github.com/apache/iceberg/issues/17081

   **Apache Iceberg version**
   main @ 49b89a8c5
   
   **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.
   
   


-- 
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]

Reply via email to