sezruby commented on code in PR #18603:
URL: https://github.com/apache/iceberg/pull/18603#discussion_r4381284968


##########
core/src/main/java/org/apache/iceberg/MergingSnapshotProducer.java:
##########
@@ -605,11 +605,71 @@ protected void validateNoNewDeleteFiles(
         locations);
   }
 
+  /**
+   * Validates that no delete files that may apply to the given data files, 
among those matching a
+   * filter, have been added to the table since a starting snapshot.
+   *
+   * <p>Position deletes and deletion vectors that apply to a single data file 
not in {@code
+   * dataFiles} are ignored. Equality deletes and position deletes that may 
apply to more than one
+   * data file are always considered conflicting.
+   *
+   * @param base table metadata to validate
+   * @param startingSnapshotId id of the snapshot current at the start of the 
operation
+   * @param dataFilter an expression used to find new conflicting delete files
+   * @param dataFiles locations of the data files to validate have no new row 
deletes
+   * @param parent ending snapshot on the branch being validated
+   */
+  @SuppressWarnings("CollectionUndefinedEquality")
+  protected void validateNoNewDeleteFiles(
+      TableMetadata base,
+      Long startingSnapshotId,
+      Expression dataFilter,
+      CharSequenceSet dataFiles,
+      Snapshot parent) {
+    Set<String> locations =
+        referencedDeleteFileLocations(
+            addedDeleteFilesIndexedPerSnapshot(base, startingSnapshotId, 
dataFilter, null, parent),
+            deleteFile -> {
+              CharSequence referencedDataFile = 
ContentFileUtil.referencedDataFile(deleteFile);
+              return referencedDataFile == null || 
dataFiles.contains(referencedDataFile);
+            });
+    ValidationException.check(
+        locations.isEmpty(),
+        "Found new conflicting delete files that can apply to records matching 
%s: %s",
+        dataFilter,
+        locations);
+  }
+
+  /**
+   * Returns the locations of the data files that the delete files added by 
this operation apply to,
+   * or null if one of them may apply to more than one data file.
+   */
+  protected CharSequenceSet referencedDataFilesOfAddedDeletes() {

Review Comment:
   Made both package-private. Thanks!



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