singhpk234 commented on code in PR #12861:
URL: https://github.com/apache/iceberg/pull/12861#discussion_r2054449713


##########
core/src/main/java/org/apache/iceberg/BaseRowDelta.java:
##########
@@ -140,6 +149,11 @@ protected void validate(TableMetadata base, Snapshot 
parent) {
         validateNoNewDeleteFiles(base, startingSnapshotId, 
conflictDetectionFilter, parent);
       }
 
+      if (!deletedDataFiles.isEmpty()) {
+        validateNoNewDeletesForDataFiles(
+            base, startingSnapshotId, conflictDetectionFilter, 
deletedDataFiles, parent);
+      }

Review Comment:
   [doubt] Should we add the deletedDataFiles for existence checks implicitly ? 
as if these files which are deleted need to be in table or are we expecting the 
caller of this API to re-use `validateDataFilesExist` to catch this case ? 
   
   ```java 
     @TestTemplate
     public void testValidateFileDeleteAndRowDeleteWithNonExistentFileRemoved() 
{
       commit(table, table.newAppend().appendFile(FILE_A).appendFile(FILE_B), 
branch);
       long initialCommit = latestSnapshot(table, branch).snapshotId();
       // compaction re-wrote this file.
       commit(table, table.newRewrite().addFile(FILE_C).deleteFile(FILE_B), 
branch);
   
       commit(
               table,
               table
                       .newRowDelta()
                       .addDeletes(fileADeletes())
                       .deleteFile(FILE_B)
                       .validateFromSnapshot(initialCommit)
                       // Note: we are not explicitly checking the FILE_B 
existence 
                       // so this pass, so we should do implicit existence 
check then ? 
                       
.validateDataFilesExist(ImmutableList.of(FILE_A.location())),
               branch);
     }
     ```
     
     OR 
     
     ```java
      @TestTemplate
     public void testValidateFileDeleteAndRowDeleteWithNonExistentFileRemoved() 
{
       commit(table, table.newAppend().appendFile(FILE_A).appendFile(FILE_B), 
branch);
       long initialCommit = latestSnapshot(table, branch).snapshotId();
       // compaction re-wrote this file.
       commit(table, table.newRewrite().addFile(FILE_C).deleteFile(FILE_B), 
branch);
   
       assertThatThrownBy(
               () -> {
                 commit(
                         table,
                         table
                                 .newRowDelta()
                                 .addDeletes(fileADeletes())
                                 .deleteFile(FILE_B)
                                 .validateFromSnapshot(initialCommit)
                                 // Note: we are explicitly checking the FILE_B 
existence
                                 // so this pass as it expected to throw.
                                 
.validateDataFilesExist(ImmutableList.of(FILE_A.location(), FILE_B.location())),
                         branch);
               })
               .isInstanceOf(ValidationException.class)
               .hasMessageContaining("Cannot commit, missing data files: [" + 
FILE_B.location() + "]");
     }
     ```
   
   



-- 
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-unsubscr...@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org
For additional commands, e-mail: issues-h...@iceberg.apache.org

Reply via email to