(self)
| 152 | |
| 153 | impl RunOpt { |
| 154 | pub async fn run(self) -> Result<()> { |
| 155 | println!("Running benchmarks with the following options: {self:?}"); |
| 156 | let query_range = match self.query { |
| 157 | Some(query_id) => query_id..=query_id, |
| 158 | None => TPCDS_QUERY_START_ID..=TPCDS_QUERY_END_ID, |
| 159 | }; |
| 160 | |
| 161 | let mut benchmark_run = BenchmarkRun::new(); |
| 162 | let mut config = self |
| 163 | .common |
| 164 | .config()? |
| 165 | .with_collect_statistics(!self.disable_statistics); |
| 166 | config.options_mut().optimizer.prefer_hash_join = self.prefer_hash_join; |
| 167 | config.options_mut().optimizer.enable_piecewise_merge_join = |
| 168 | self.enable_piecewise_merge_join; |
| 169 | config.options_mut().execution.hash_join_buffering_capacity = |
| 170 | self.hash_join_buffering_capacity; |
| 171 | let rt = self.common.build_runtime()?; |
| 172 | let ctx = SessionContext::new_with_config_rt(config, rt); |
| 173 | // register tables |
| 174 | self.register_tables(&ctx).await?; |
| 175 | |
| 176 | for query_id in query_range { |
| 177 | benchmark_run.start_new_case(&format!("Query {query_id}")); |
| 178 | let query_run = self.benchmark_query(query_id, &ctx).await; |
| 179 | match query_run { |
| 180 | Ok(query_results) => { |
| 181 | for iter in query_results { |
| 182 | benchmark_run.write_iter(iter.elapsed, iter.row_count); |
| 183 | } |
| 184 | } |
| 185 | Err(e) => { |
| 186 | benchmark_run.mark_failed(); |
| 187 | eprintln!("Query {query_id} failed: {e}"); |
| 188 | } |
| 189 | } |
| 190 | } |
| 191 | benchmark_run.maybe_write_json(self.output_path.as_ref())?; |
| 192 | benchmark_run.maybe_print_failures(); |
| 193 | Ok(()) |
| 194 | } |
| 195 | |
| 196 | async fn benchmark_query( |
| 197 | &self, |
nothing calls this directly
no test coverage detected