flyrain commented on code in PR #4683:
URL: https://github.com/apache/iceberg/pull/4683#discussion_r868213381


##########
data/src/main/java/org/apache/iceberg/data/DeleteFilter.java:
##########
@@ -169,32 +176,23 @@ public CloseableIterable<T> 
findEqualityDeleteRows(CloseableIterable<T> records)
         .reduce(Predicate::or)
         .orElse(t -> false);
 
-    Filter<T> deletedRowsFilter = new Filter<T>() {
-      @Override
-      protected boolean shouldKeep(T item) {
-        return deletedRows.test(item);
-      }
-    };
-    return deletedRowsFilter.filter(records);
+    return Deletes.filter(records, deletedRows);
   }
 
   private CloseableIterable<T> applyEqDeletes(CloseableIterable<T> records) {
-    // Predicate to test whether a row should be visible to user after 
applying equality deletions.
-    Predicate<T> remainingRows = applyEqDeletes().stream()
-        .map(Predicate::negate)
-        .reduce(Predicate::and)
-        .orElse(t -> true);
-
-    Filter<T> remainingRowsFilter = new Filter<T>() {
-      @Override
-      protected boolean shouldKeep(T item) {
-        return remainingRows.test(item);
-      }
-    };
+    Predicate<T> isEqDeleted = applyEqDeletes().stream()
+        .reduce(Predicate::or)
+        .orElse(t -> false);
 
-    return remainingRowsFilter.filter(records);
+    if (hasColumnIsDeleted) {
+      return Deletes.markDeleted(records, isEqDeleted, this::markRowDeleted);
+    } else {
+      return Deletes.filter(records, isEqDeleted.negate());
+    }
   }
 
+  protected abstract void markRowDeleted(T item);

Review Comment:
   yeah, that's my original implementation, but you and @Reo-LEI suggested an 
abstract method in this comment, 
https://github.com/apache/iceberg/pull/4539#discussion_r854748246. I'm OK with 
either one. We can save some code with the default implementation, and an 
abstract method can enforce the implementation of the subclass, which doesn't 
have much benefit, since the default implementation also throws the same 
exception (UnsupportedOperationException). What do you think?



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