rdblue edited a comment on pull request #3258:
URL: https://github.com/apache/iceberg/pull/3258#issuecomment-939144452
@openinx, it looks like there is a test for a case that I don't think can
happen. Should we fix the test or should we look into calling
`validateFromSnapshot` with the last committed snapshot ID?
Here's the alternative that uses the last committed snapshot:
```java
Long lastCommittedSnapshotId = null;
for (Snapshot snap : SnapshotUtil.currentAncestors(table)) {
String snapshotCheckpointId =
snap.summary().get(MAX_COMMITTED_CHECKPOINT_ID);
if (snapshotCheckpointId != null &&
Long.parseLong(snapshotCheckpointId) == maxCommittedCheckpointId) {
lastCommittedSnapshotId = snap.snapshotId();
}
}
RowDelta rowDelta = table.newRowDelta()
.validateDataFilesExist(ImmutableList.copyOf(result.referencedDataFiles()))
.validateDeletedFiles();
if (lastCommittedSnapshotId != null) {
rowDelta.validateFromSnapshot(lastCommittedSnapshotId);
}
```
--
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]