MCPcopy Create free account
hub / github.com/apache/datafusion / run

Method run

benchmarks/src/sort_tpch.rs:179–207  ·  view source on GitHub ↗

If query is specified from command line, run only that query. Otherwise, run all queries.

(&self)

Source from the content-addressed store, hash-verified

177 /// If query is specified from command line, run only that query.
178 /// Otherwise, run all queries.
179 pub async fn run(&self) -> Result<()> {
180 let mut benchmark_run: BenchmarkRun = BenchmarkRun::new();
181
182 let query_range = match self.query {
183 Some(query_id) => query_id..=query_id,
184 None => SORT_TPCH_QUERY_START_ID..=SORT_TPCH_QUERY_END_ID,
185 };
186
187 for query_id in query_range {
188 benchmark_run.start_new_case(&format!("{query_id}"));
189
190 let query_results = self.benchmark_query(query_id).await;
191 match query_results {
192 Ok(query_results) => {
193 for iter in query_results {
194 benchmark_run.write_iter(iter.elapsed, iter.row_count);
195 }
196 }
197 Err(e) => {
198 benchmark_run.mark_failed();
199 eprintln!("Query {query_id} failed: {e}");
200 }
201 }
202 }
203
204 benchmark_run.maybe_write_json(self.output_path.as_ref())?;
205 benchmark_run.maybe_print_failures();
206 Ok(())
207 }
208
209 /// Benchmark query `query_id` in `SORT_QUERIES`
210 async fn benchmark_query(&self, query_id: usize) -> Result<Vec<QueryResult>> {

Callers

nothing calls this directly

Calls 8

newFunction · 0.85
start_new_caseMethod · 0.80
write_iterMethod · 0.80
mark_failedMethod · 0.80
maybe_write_jsonMethod · 0.80
maybe_print_failuresMethod · 0.80
benchmark_queryMethod · 0.45
as_refMethod · 0.45

Tested by

no test coverage detected