diff --git a/native/core/src/execution/operators/scan.rs b/native/core/src/execution/operators/scan.rs index 4b9d76da28..409d064284 100644 --- a/native/core/src/execution/operators/scan.rs +++ b/native/core/src/execution/operators/scan.rs @@ -116,17 +116,16 @@ impl ScanExec { // This is a unit test. Input batches are seeded via `set_input_batch`. return Ok(()); } - let mut timer = self.baseline_metrics.elapsed_compute().timer(); let mut current_batch = self.batch.try_lock().unwrap(); if current_batch.is_none() { + let mut timer = self.baseline_metrics.elapsed_compute().timer(); let next_batch = ScanExec::pull_next(self.exec_context_id, self.input_source.as_ref().unwrap())?; *current_batch = Some(next_batch); + timer.stop(); } - timer.stop(); - Ok(()) }