You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by GitBox <gi...@apache.org> on 2022/08/04 05:48:12 UTC

[GitHub] [iceberg] wypoon commented on a diff in pull request #4588: Spark: Add custom metric for number of deletes applied by a SparkScan

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


##########
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:
   I ran `IcebergSourceParquetPosDeleteBenchmark` before and after this change, and the numbers for `readIceberg` show hardly any difference.



-- 
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-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org