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


##########
core/src/main/java/org/apache/iceberg/deletes/Deletes.java:
##########
@@ -202,17 +233,24 @@ boolean isDeleted(T row) {
   }
 
   private static class PositionStreamDeleteFilter<T> extends 
PositionStreamDeleteIterable<T> {
-    private PositionStreamDeleteFilter(CloseableIterable<T> rows, Function<T, 
Long> rowToPosition,
-                                       CloseableIterable<Long> 
deletePositions) {
+    private final DeleteCounter counter;
+
+    PositionStreamDeleteFilter(CloseableIterable<T> rows, Function<T, Long> 
rowToPosition,
+                               CloseableIterable<Long> deletePositions, 
DeleteCounter counter) {
       super(rows, rowToPosition, deletePositions);
+      this.counter = counter;
     }
 
     @Override
     protected CloseableIterator<T> applyDelete(CloseableIterator<T> items) {
       return new FilterIterator<T>(items) {
         @Override
         protected boolean shouldKeep(T item) {
-          return !isDeleted(item);
+          boolean deleted = isDeleted(item);
+          if (deleted) {
+            counter.increment();
+          }
+          return !deleted;

Review Comment:
   This may have perf impact since it is per-row basis. I don't think it is big 
though, but would recommend to use jmh to micro benchmark it.



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