stevenzwu commented on code in PR #18147:
URL: https://github.com/apache/iceberg/pull/18147#discussion_r4031423683
##########
core/src/main/java/org/apache/iceberg/V4ManifestReader.java:
##########
@@ -97,18 +101,30 @@ Schema readSchema() {
/** Returns copies of the tracked files that match this reader's configured
filters. */
@Override
public CloseableIterator<TrackedFile> iterator() {
- CloseableIterable<TrackedFile> entries =
CloseableIterable.transform(open(), this::prepare);
- if (!partitionFilters.isEmpty()) {
- // manifests have no partition, so the partition filter cannot apply to
them
- entries =
- CloseableIterable.filter(entries, entry -> isManifest(entry) ||
matchesPartition(entry));
- }
+ CloseableIterable<TrackedFile> files = CloseableIterable.transform(open(),
this::prepare);
if (!includeAll) {
- entries = CloseableIterable.filter(entries, entry ->
entry.tracking().isLive());
+ files = CloseableIterable.filter(files, file ->
file.tracking().isLive());
+ }
+
+ if (statsFilter != null) {
+ files =
+ CloseableIterable.filter(
+ this::incrementSkipCount,
+ files,
+ file -> statsFilter.eval(file.contentStats(),
file.recordCount()));
+ } else {
+ files =
+ CloseableIterable.filter(
+ this::incrementSkipCount, files, file -> file.recordCount() !=
0L);
Review Comment:
This always-on `recordCount != 0` path diverges from `ManifestReader`, which
only runs `InclusiveMetricsEvaluator` when there is a row/partition filter.
Empty files are still table entries: once this reader is used for rewrite,
expire, or `includeAll()` metadata listing, dropping them would lose files.
`InclusiveStatsEvaluator` already rejects `recordCount == 0` when `statsFilter
!= null`. I would gate this skip on scan planning (or drop the else branch) so
unfiltered reads still return empty files.
--
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]