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 2022/10/18 09:08:06 UTC

[GitHub] [iceberg] hililiwei commented on a diff in pull request #6005: Core: Fix NPE for parent snapshot does not exist

hililiwei commented on code in PR #6005:
URL: https://github.com/apache/iceberg/pull/6005#discussion_r997934218


##########
core/src/main/java/org/apache/iceberg/util/SnapshotUtil.java:
##########
@@ -72,7 +72,7 @@ public static boolean isAncestorOf(Table table, long ancestorSnapshotId) {
   public static boolean isParentAncestorOf(
       Table table, long snapshotId, long ancestorParentSnapshotId) {
     for (Snapshot snapshot : ancestorsOf(snapshotId, table::snapshot)) {
-      if (snapshot.parentId() == ancestorParentSnapshotId) {
+      if (snapshot.parentId() != null && snapshot.parentId() == ancestorParentSnapshotId) {

Review Comment:
   SnapshotUtil doesn't have a test case class for it. So I created one, adding some additional test cases.



-- 
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