Skip to content

Apache DataFusion SQL Query Engine

Improve file scan time opening metric to include start_next_file (#5900)

Andrew Lambf8e2cc04c2b7
diff --git a/datafusion/core/src/physical_plan/file_format/file_stream.rs b/datafusion/core/src/physical_plan/file_format/file_stream.rs
index bb00170535..7890223457 100644
--- a/datafusion/core/src/physical_plan/file_format/file_stream.rs
+++ b/datafusion/core/src/physical_plan/file_format/file_stream.rs
@@ -264,9 +264,9 @@ impl<F: FileOpener> FileStream<F> {
Ok(reader) => {
let partition_values = mem::take(partition_values);
- let next = self.start_next_file().transpose();
-
+ // include time needed to start opening in `start_next_file`
self.file_stream_metrics.time_opening.stop();
+ let next = self.start_next_file().transpose();
self.file_stream_metrics.time_scanning_until_data.start();
self.file_stream_metrics.time_scanning_total.start();