rdblue commented on code in PR #5268:
URL: https://github.com/apache/iceberg/pull/5268#discussion_r922376822
##########
core/src/main/java/org/apache/iceberg/ManifestGroup.java:
##########
@@ -234,7 +255,13 @@ private <T> Iterable<CloseableIterable<T>> entries(
manifest -> manifest.hasAddedFiles() || manifest.hasDeletedFiles());
}
- matchingManifests = Iterables.filter(matchingManifests,
manifestPredicate::test);
+ matchingManifests = Iterables.filter(matchingManifests, manifest -> {
Review Comment:
Rather than changing the filtering, why not make a new Iterable that updates
a counter? Then you'd have less custom code:
```java
class <T> Iterable<T> count(Counter counter, Iterable<T> iterable) {
return () -> new Iterator<T> {
Iterator<T> iter = iterable.iterator();
public boolean hasNext() {
return iter.hasNext();
}
public T next() {
T next = iter.next();
counter.increment();
return next;
}
}
}
...
matchingManifests = count(scanMetrics.matchingDataManifests(),
Iterables.filter(...));
```
--
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]