rdblue commented on a change in pull request #4082:
URL: https://github.com/apache/iceberg/pull/4082#discussion_r803263738
##########
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:
I think this should be `if (ref.snapshotId() == -1 &&
refName.equals(MAIN_BRANCH))` then ignore it. Otherwise, check the other
precondition. No need to have a special error message for -1 that states main
can be -1.
Also, for @jackye1995, do we want to just allow main to be dropped? If you
remove main then current-snapshot-id is -1 but we don't actually have -1 in
this map?
--
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]