amogh-jahagirdar commented on code in PR #5234:
URL: https://github.com/apache/iceberg/pull/5234#discussion_r952679192
##########
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, and I think we can extract the helper
to a protected method on the SnapshotProducer class because it would be used
for every operation.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]