rdblue commented on a change in pull request #2660:
URL: https://github.com/apache/iceberg/pull/2660#discussion_r655772747
##########
File path: core/src/main/java/org/apache/iceberg/util/SnapshotUtil.java
##########
@@ -107,4 +121,26 @@ public static boolean ancestorOf(Table table, long
snapshotId, long ancestorSnap
return newFiles;
}
+
+ /**
+ * Traverses the history of the table's current snapshot and finds the
snapshot with the given snapshot id as its
+ * parent.
+ * @return null if the passed in snapshot is not present in the table, else
the snapshot for which the given snapshot
+ * is the parent
+ * @throws IllegalArgumentException when the given SnapshotId is not found
in the table
+ * @throws IllegalStateException when the given snapshot ID is not an
ancestor of the current table state
+ */
+ public static Snapshot snapshotAfter(Table table, long snapshotId) {
+ Snapshot previousSnapshot = table.snapshot(snapshotId);
+ Preconditions.checkArgument(previousSnapshot != null,
+ "Invalid snapshotId: %s, snapshot not found in the table.",
snapshotId);
Review comment:
The ID isn't invalid, the problem is that the snapshot is not present. I
think it should be `"Cannot find parent snapshot: %s"`
--
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.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]