aokolnychyi commented on code in PR #8432:
URL: https://github.com/apache/iceberg/pull/8432#discussion_r1310698115


##########
core/src/main/java/org/apache/iceberg/ManifestReader.java:
##########
@@ -203,32 +203,46 @@ ManifestReader<F> scanMetrics(ScanMetrics newScanMetrics) 
{
   }
 
   CloseableIterable<ManifestEntry<F>> entries() {
-    if ((rowFilter != null && rowFilter != Expressions.alwaysTrue())
-        || (partFilter != null && partFilter != Expressions.alwaysTrue())
-        || (partitionSet != null)) {
+    return entries(false /* all entries */);
+  }
+
+  private CloseableIterable<ManifestEntry<F>> entries(boolean onlyLive) {
+    if (hasRowFilter() || hasPartitionFilter() || partitionSet != null) {
       Evaluator evaluator = evaluator();
       InclusiveMetricsEvaluator metricsEvaluator = metricsEvaluator();
 
       // ensure stats columns are present for metrics evaluation
       boolean requireStatsProjection = requireStatsProjection(rowFilter, 
columns);
       Collection<String> projectColumns =
           requireStatsProjection ? withStatsColumns(columns) : columns;
+      CloseableIterable<ManifestEntry<F>> entries =
+          open(projection(fileSchema, fileProjection, projectColumns, 
caseSensitive));
 
       return CloseableIterable.filter(
           content == FileType.DATA_FILES
               ? scanMetrics.skippedDataFiles()
               : scanMetrics.skippedDeleteFiles(),
-          open(projection(fileSchema, fileProjection, projectColumns, 
caseSensitive)),
+          onlyLive ? filterLiveEntries(entries) : entries,

Review Comment:
   The deleted entries must be discarded prior to evaluating stats primarily to 
have correct skipped counts. It should also help the performance.



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