If query is specified from command line, run only that query. Otherwise, run all queries.
(&self)
| 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>> { |
nothing calls this directly
no test coverage detected