dramaticlly commented on code in PR #17118:
URL: https://github.com/apache/iceberg/pull/17118#discussion_r3538420251


##########
api/src/main/java/org/apache/iceberg/io/CloseableIterable.java:
##########
@@ -175,18 +199,7 @@ protected boolean shouldKeep(E item) {
    */
   static <T> CloseableIterable<T> count(Counter counter, CloseableIterable<T> 
iterable) {
     Preconditions.checkArgument(null != counter, "Invalid counter: null");
-    Preconditions.checkArgument(null != iterable, "Invalid iterable: null");
-    return new CloseableIterable<T>() {
-      @Override
-      public CloseableIterator<T> iterator() {
-        return CloseableIterator.count(counter, iterable.iterator());
-      }
-
-      @Override
-      public void close() throws IOException {
-        iterable.close();
-      }
-    };
+    return filter(iterable, item -> true, item -> counter.increment(), item -> 
{});

Review Comment:
   Thanks @wombatu-kun for the review. I updated to change FilterIterator 
directly so that we keep exactly once semantics for skip on hasNext() and kept 
on next(), same as before.



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