You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by GitBox <gi...@apache.org> on 2021/06/08 14:46:20 UTC

[GitHub] [iceberg] RussellSpitzer commented on a change in pull request #2660: Spark3 structured streaming micro_batch read support

RussellSpitzer commented on a change in pull request #2660:
URL: https://github.com/apache/iceberg/pull/2660#discussion_r647515425



##########
File path: core/src/main/java/org/apache/iceberg/util/SnapshotUtil.java
##########
@@ -63,6 +63,20 @@ public static boolean ancestorOf(Table table, long snapshotId, long ancestorSnap
     return ancestorIds(table.currentSnapshot(), table::snapshot);
   }
 
+  /**
+   * Find the oldest Snapshot of a table.
+   * @param table the table to find the oldest snapshot on.
+   * @return null if the table is empty, else the oldest Snapshot.
+   */
+  public static Snapshot oldestSnapshot(Table table) {
+    Snapshot current = table.currentSnapshot();
+    while (current.parentId() != null) {

Review comment:
       NPE? If currentSnapshot() is null then we would npe here calling parentID




-- 
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:
users@infra.apache.org



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