jackye1995 commented on a change in pull request #4082:
URL: https://github.com/apache/iceberg/pull/4082#discussion_r803311605
##########
File path: core/src/main/java/org/apache/iceberg/TableMetadata.java
##########
@@ -725,6 +728,21 @@ private static SortOrder freshSortOrder(int orderId,
Schema schema, SortOrder so
return builder.build();
}
+ private Map<String, SnapshotRef> validateRefs(Map<String, SnapshotRef>
inputRefs) {
+ for (Map.Entry<String, SnapshotRef> refEntry : inputRefs.entrySet()) {
+ String refName = refEntry.getKey();
+ SnapshotRef ref = refEntry.getValue();
+ if (ref.snapshotId() == -1) {
+ Preconditions.checkArgument(refName.equals(SnapshotRef.MAIN_BRANCH),
+ "Snapshot ref %s refers to snapshot id -1. Only main can refer to
-1", refName);
Review comment:
keeping `current-snapshot-id` has the advantage that an old reader can
continue to read the new metadata and get current snapshot id. In that sense,
we will likely not be able to retire the field `current-snapshot-id`. So we
should probably go with the logic of not having `main` in the map, and if
people do `table.ref("main")` it should return
`table.currentSnapshot().snapshotId()` or -1
--
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]