prodeezy commented on a change in pull request #695: [WIP] Cherrypick snapshot
feature
URL: https://github.com/apache/incubator-iceberg/pull/695#discussion_r368156637
##########
File path: core/src/main/java/org/apache/iceberg/util/SnapshotUtil.java
##########
@@ -55,4 +56,28 @@ private SnapshotUtil() {
}
return ancestorIds;
}
+
+ public static boolean isCurrentAncestor(TableMetadata tableMeta, long
snapshotId) {
+ List<Long> currentAncestors =
SnapshotUtil.ancestorIds(tableMeta.currentSnapshot(), tableMeta::snapshot);
+ return currentAncestors.contains(snapshotId);
+ }
+
+ /**
+ * Return the latest snapshot whose timestamp is before the provided
timestamp.
+ * @param tableMeta TableMetadata representing the table state on which the
snapshot is being looked up
+ * @param timestampMillis lookup snapshots before this timestamp
+ * @return
+ */
+ public static Snapshot findLatestSnapshotOlderThan(TableMetadata tableMeta,
long timestampMillis) {
+ long snapshotTimestamp = 0;
+ Snapshot result = null;
+ for (Snapshot snapshot : tableMeta.snapshots()) {
Review comment:
makes sense.. otherwise `rollbackToTime()` behaviour seems inconsistent
from `rollbackTo()`
----------------------------------------------------------------
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]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]