rdblue commented on code in PR #4744:
URL: https://github.com/apache/iceberg/pull/4744#discussion_r878391857
##########
core/src/main/java/org/apache/iceberg/util/SnapshotUtil.java:
##########
@@ -107,6 +107,19 @@ public static Snapshot oldestAncestor(Table table) {
return lastSnapshot;
}
+ /**
+ * Traverses the history and finds the oldest ancestor of snapshotId.
+ * @return null if there is no current snapshot in the table, else the
oldest Snapshot.
+ */
+ public static Snapshot oldestAncestor(long snapshotId, Function<Long,
Snapshot> lookup) {
+ Snapshot lastSnapshot = null;
+ for (Snapshot snapshot : ancestorsOf(snapshotId, lookup)) {
Review Comment:
Be aware that this includes the snapshot for `snapshotId`.
--
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]