You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by "nastra (via GitHub)" <gi...@apache.org> on 2023/05/16 13:19:16 UTC

[GitHub] [iceberg] nastra commented on a diff in pull request #7621: Core: Include all reachable snapshots with v1 format and REF snapshot mode

nastra commented on code in PR #7621:
URL: https://github.com/apache/iceberg/pull/7621#discussion_r1195154004


##########
core/src/main/java/org/apache/iceberg/util/SnapshotUtil.java:
##########
@@ -144,12 +144,25 @@ public static Snapshot oldestAncestorOf(long snapshotId, Function<Long, Snapshot
     return lastSnapshot;
   }
 
+  /**
+   * Returns the ancestors of the given snapshot id or throws an exception if the given snapshot id
+   * cannot be found.
+   */
   public static Iterable<Snapshot> ancestorsOf(long snapshotId, Function<Long, Snapshot> lookup) {
     Snapshot start = lookup.apply(snapshotId);
     Preconditions.checkArgument(start != null, "Cannot find snapshot: %s", snapshotId);
     return ancestorsOf(start, lookup);
   }
 
+  /**
+   * Returns the ancestors of the given snapshot id. If there are no ancestors or the given snapshot
+   * id cannot be found, an empty iterable is returned.
+   */
+  public static Iterable<Snapshot> maybeAncestorsOf(

Review Comment:
   this method only exists so that we have consistent error reporting in https://github.com/apache/iceberg/blob/1521296dd253c829dedc3e83ffda4cd2622667e2/core/src/test/java/org/apache/iceberg/TestSnapshotLoading.java#L169 for V1 and V2 tables.
   Alternatively we could have a `ancestorsOf()` with a boolean flag to skip the `snapshotId` validation.



-- 
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: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org