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


##########
core/src/main/java/org/apache/iceberg/deletes/Deletes.java:
##########
@@ -227,6 +251,37 @@ public void close() {
     }
   }
 
+  private static class PositionStreamDeleteMarker<T> extends 
PositionStreamDeleteFilter<T> {
+    private final Consumer<T> markDeleted;
+
+    private PositionStreamDeleteMarker(CloseableIterable<T> rows, Function<T, 
Long> extractPos,
+                                       CloseableIterable<Long> 
deletePositions, Consumer<T> markDeleted) {
+      super(rows, extractPos, deletePositions);
+      this.markDeleted = markDeleted;
+    }
+
+    @Override
+    protected PositionFilterIterator 
createPosDeleteIterator(CloseableIterator<T> items,
+                                                             
CloseableIterator<Long> deletePosIterator) {
+      return new PositionDeleteMarkerIterator(items, deletePosIterator);
+    }
+
+    private class PositionDeleteMarkerIterator extends PositionFilterIterator {
+      private PositionDeleteMarkerIterator(CloseableIterator<T> items, 
CloseableIterator<Long> deletePositions) {
+        super(items, deletePositions);
+      }
+
+      @Override
+      protected boolean shouldKeep(T row) {
+        boolean isDeleted = !super.shouldKeep(row);
+        if (isDeleted) {
+          markDeleted.accept(row);
+        }
+        return true;

Review Comment:
   Makes sense to add a comment. This part of implementation is where I'm not 
quite satisfied, but not sure how to make it better. I will try to refactor a 
bit. 



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