amogh-jahagirdar commented on code in PR #8525:
URL: https://github.com/apache/iceberg/pull/8525#discussion_r1333474797
##########
core/src/test/java/org/apache/iceberg/TestDeleteFiles.java:
##########
@@ -412,6 +412,37 @@ public void testDeleteWithCollision() {
afterDeletePartitions);
}
+ @Test
+ public void testDeleteValidateFileExistence() {
+ commit(table, table.newFastAppend().appendFile(FILE_B), branch);
+ Snapshot delete =
+ commit(table,
table.newDelete().deleteFile(FILE_B).validateFilesExist(), branch);
+ validateManifestEntries(
+ Iterables.getOnlyElement(delete.allManifests(FILE_IO)),
+ ids(delete.snapshotId()),
+ files(FILE_B),
+ statuses(Status.DELETED));
+
+ Assertions.assertThatThrownBy(
+ () -> commit(table,
table.newDelete().deleteFile(FILE_B).validateFilesExist(), branch))
+ .isInstanceOf(ValidationException.class);
+ }
+
+ @Test
+ public void testDeleteFilesNoValidation() {
+ commit(table, table.newFastAppend().appendFile(FILE_B), branch);
+ Snapshot delete1 = commit(table, table.newDelete().deleteFile(FILE_B),
branch);
+ validateManifestEntries(
+ Iterables.getOnlyElement(delete1.allManifests(FILE_IO)),
+ ids(delete1.snapshotId()),
+ files(FILE_B),
+ statuses(Status.DELETED));
+
+ Snapshot delete2 = commit(table, table.newDelete().deleteFile(FILE_B),
branch);
+ Assertions.assertThat(delete2.allManifests(FILE_IO).isEmpty()).isTrue();
+
Assertions.assertThat(delete2.removedDataFiles(FILE_IO).iterator().hasNext()).isFalse();
Review Comment:
Technically this assertion is implied based on the assertion already done on
442 because the manifests are no longer referenced in the latest snapshot, but
i wanted to validate from an `removedDataFiles` API perspective, we're not
returning on the second delete snapshot that FILE_B was removed again (in other
words truly verify idempotency when validation doesn't exist). Lmk if that
makes sense @RussellSpitzer
--
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]