This is an automated email from the ASF dual-hosted git repository.

xudong963 pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/datafusion.git


The following commit(s) were added to refs/heads/main by this push:
     new 3f538f882b Minor: add average time for clickbench benchmark query 
(#15381)
3f538f882b is described below

commit 3f538f882b7766918f17033e481f4056810f2cba
Author: Qi Zhu <[email protected]>
AuthorDate: Mon Mar 24 22:19:57 2025 +0800

    Minor: add average time for clickbench benchmark query (#15381)
---
 benchmarks/src/clickbench.rs | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/benchmarks/src/clickbench.rs b/benchmarks/src/clickbench.rs
index a9750d9b4b..e07cb4779c 100644
--- a/benchmarks/src/clickbench.rs
+++ b/benchmarks/src/clickbench.rs
@@ -129,6 +129,7 @@ impl RunOpt {
         self.register_hits(&ctx).await?;
 
         let iterations = self.common.iterations;
+        let mut millis = Vec::with_capacity(iterations);
         let mut benchmark_run = BenchmarkRun::new();
         for query_id in query_range {
             benchmark_run.start_new_case(&format!("Query {query_id}"));
@@ -140,6 +141,7 @@ impl RunOpt {
                 let results = ctx.sql(sql).await?.collect().await?;
                 let elapsed = start.elapsed();
                 let ms = elapsed.as_secs_f64() * 1000.0;
+                millis.push(ms);
                 let row_count: usize = results.iter().map(|b| 
b.num_rows()).sum();
                 println!(
                     "Query {query_id} iteration {i} took {ms:.1} ms and 
returned {row_count} rows"
@@ -149,6 +151,8 @@ impl RunOpt {
             if self.common.debug {
                 ctx.sql(sql).await?.explain(false, false)?.show().await?;
             }
+            let avg = millis.iter().sum::<f64>() / millis.len() as f64;
+            println!("Query {query_id} avg time: {avg:.2} ms");
         }
         benchmark_run.maybe_write_json(self.output_path.as_ref())?;
         Ok(())


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to