rdblue commented on code in PR #11131:
URL: https://github.com/apache/iceberg/pull/11131#discussion_r1813956145


##########
core/src/main/java/org/apache/iceberg/ManifestFilterManager.java:
##########
@@ -341,43 +367,44 @@ private ManifestFile filterManifest(Schema tableSchema, 
ManifestFile manifest) {
   }
 
   private boolean canContainDeletedFiles(ManifestFile manifest) {
-    boolean canContainExpressionDeletes;
+    return canContainDropBySeq(manifest)
+        || canContainExpressionDeletes(manifest)
+        || canContainDroppedPartitions(manifest)
+        || canContainDroppedFiles(manifest);
+  }
+
+  private boolean canContainDropBySeq(ManifestFile manifest) {
+    return manifest.content() == ManifestContent.DELETES
+        && manifest.minSequenceNumber() < minSequenceNumber;
+  }
+
+  private boolean canContainExpressionDeletes(ManifestFile manifest) {
     if (deleteExpression != null && deleteExpression != 
Expressions.alwaysFalse()) {
       ManifestEvaluator manifestEvaluator =
           ManifestEvaluator.forRowFilter(
               deleteExpression, specsById.get(manifest.partitionSpecId()), 
caseSensitive);
-      canContainExpressionDeletes = manifestEvaluator.eval(manifest);
-    } else {
-      canContainExpressionDeletes = false;
+      return manifestEvaluator.eval(manifest);
     }
 
-    boolean canContainDroppedPartitions;
+    return false;
+  }
+
+  private boolean canContainDroppedPartitions(ManifestFile manifest) {
     if (!dropPartitions.isEmpty()) {
-      canContainDroppedPartitions =
-          ManifestFileUtil.canContainAny(manifest, dropPartitions, specsById);
-    } else {
-      canContainDroppedPartitions = false;
+      return ManifestFileUtil.canContainAny(manifest, dropPartitions, 
specsById);
     }
 
-    boolean canContainDroppedFiles;
-    if (!deletePaths.isEmpty()) {
-      canContainDroppedFiles = true;
-    } else if (!deleteFiles.isEmpty()) {
-      // because there were no path-only deletes, the set of deleted file 
partitions is valid
-      canContainDroppedFiles =
-          ManifestFileUtil.canContainAny(manifest, deleteFilePartitions, 
specsById);
+    return false;
+  }
+
+  private boolean canContainDroppedFiles(ManifestFile manifest) {
+    if (manifestsReferencedForDeletes.contains(manifest.path()) || 
!deletePaths.isEmpty()) {

Review Comment:
   Nit: check `isEmpty` first rather than doing a set lookup.



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