adriangb commented on code in PR #24524:
URL: https://github.com/apache/datafusion/pull/24524#discussion_r3823475177


##########
datafusion/datasource-parquet/src/opener/mod.rs:
##########
@@ -1497,6 +1506,34 @@ impl RowGroupsPrunedParquetOpen {
             (builder.build()?, rg_plan, has_row_selection)
         };
 
+        // Track how much of this file range the scan has finished with. Credit
+        // up front every row group it will not read: those pruning removed, 
and
+        // — for a file split into ranges for parallelism — those belonging to
+        // another range. Without this the metric would sit at zero until the
+        // first row group finishes decoding, reporting no progress for a scan
+        // that may have just proved most of its work unnecessary.
+        let mut byte_progress = ByteProgress::new(
+            prepared.partitioned_file.effective_size(),
+            prepared.file_metrics.bytes_processed.clone(),
+        );
+        let mut will_scan = vec![false; rg_metadata.len()];
+        for entry in &rg_plan {
+            will_scan[entry.rg_index] = true;
+        }
+        let skipped_bytes: u64 = rg_metadata
+            .iter()
+            .enumerate()
+            .filter(|(rg_index, rg_meta)| {
+                !will_scan[*rg_index]
+                    && prepared
+                        .file_range
+                        .as_ref()
+                        .is_none_or(|range| row_group_in_range(rg_meta, range))
+            })
+            .map(|(_, rg_meta)| row_group_bytes(rg_meta))
+            .sum();

Review Comment:
   Thanks addressed!



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