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/08/23 07:12:13 UTC

[GitHub] [iceberg] amogh-jahagirdar commented on a diff in pull request #5234: Core, API: BaseRowDelta to branch Impl

amogh-jahagirdar commented on code in PR #5234:
URL: https://github.com/apache/iceberg/pull/5234#discussion_r952232778


##########
core/src/main/java/org/apache/iceberg/BaseRowDelta.java:
##########
@@ -95,24 +97,46 @@ public RowDelta validateNoConflictingDeleteFiles() {
     return this;
   }
 
+  @Override
+  public RowDelta toBranch(String branch) {
+    targetBranch(branch);
+    return this;
+  }
+
+  private void checkIfSnapshotIsAnAncestor(Snapshot snapshot, TableMetadata base) {
+    if (this.startingSnapshotId == null || snapshot == null) {
+      return;
+    }
+
+    for (Snapshot ancestor : SnapshotUtil.ancestorsOf(snapshot.snapshotId(), base::snapshot)) {
+      if (ancestor.snapshotId() == this.startingSnapshotId) {
+        return;
+      }
+    }
+    throw new ValidationException(
+        "Snapshot %s is not an ancestor of %s", startingSnapshotId, snapshot.snapshotId());
+  }

Review Comment:
   We can use SnapshotUtil.isAncestorOf for this.



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