hililiwei commented on code in PR #5475:
URL: https://github.com/apache/iceberg/pull/5475#discussion_r940806751
##########
core/src/main/java/org/apache/iceberg/DataTableScan.java:
##########
@@ -68,6 +68,14 @@ public TableScan useSnapshot(long scanSnapshotId) {
tableOps(), table(), snapshotSchema,
context().useSnapshotId(scanSnapshotId));
}
+ @Override
+ public TableScan useTag(String tag) {
+ Preconditions.checkArgument(table().snapshot(tag) != null, "Cannot find
tag with name %s", tag);
+ Preconditions.checkArgument(
+ table().refs().get(tag).isTag(), "Ref %s is a branch, not a tag", tag);
+ return useSnapshot(table().snapshot(tag).snapshotId());
Review Comment:
````
SnapshotRef ref = tableOps().current().ref(tag);
Preconditions.checkArgument(ref != null, "Tag does not exist: %s", name);
Preconditions.checkArgument(ref.isTag(), "Ref %s is a tag not a branch",
tag);
```
The error message is modified to be consistent with that in
UpdateSnapshotReferencesOperations.
https://github.com/apache/iceberg/blob/f76e9cb2b72f3ce242a50258ff27be23f6d5aea3/core/src/main/java/org/apache/iceberg/UpdateSnapshotReferencesOperation.java#L78-L96
--
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]