linyanghao commented on code in PR #7249:
URL: https://github.com/apache/iceberg/pull/7249#discussion_r1155546151


##########
core/src/main/java/org/apache/iceberg/MergingSnapshotProducer.java:
##########
@@ -453,20 +459,47 @@ private void validateNoNewDeletesForDataFiles(
       // fail
       DeleteFile[] deleteFiles = deletes.forDataFile(startingSequenceNumber, 
dataFile);
       if (ignoreEqualityDeletes) {
-        ValidationException.check(
-            Arrays.stream(deleteFiles)
-                .noneMatch(deleteFile -> deleteFile.content() == 
FileContent.POSITION_DELETES),
-            "Cannot commit, found new position delete for replaced data file: 
%s",
-            dataFile);
+        if (!ignorePositionDeletes) {
+          ValidationException.check(
+              Arrays.stream(deleteFiles)
+                  .noneMatch(deleteFile -> deleteFile.content() == 
FileContent.POSITION_DELETES),
+              "Cannot commit, found new position delete for replaced data 
file: %s",
+              dataFile);
+        }
       } else {
-        ValidationException.check(
-            deleteFiles.length == 0,
-            "Cannot commit, found new delete for replaced data file: %s",
-            dataFile);
+        if (ignorePositionDeletes) {
+          ValidationException.check(
+              Arrays.stream(deleteFiles)
+                  .noneMatch(deleteFile -> deleteFile.content() == 
FileContent.EQUALITY_DELETES),
+              "Cannot commit, found new equality delete for replaced data 
file: %s",
+              dataFile);
+        } else {
+          ValidationException.check(
+              deleteFiles.length == 0,
+              "Cannot commit, found new delete for replaced data file: %s",
+              dataFile);
+        }

Review Comment:
   That's a good point!



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

Reply via email to