(self)
| 119 | |
| 120 | impl RunOpt { |
| 121 | pub async fn run(self) -> Result<()> { |
| 122 | println!("Running benchmarks with the following options: {self:?}"); |
| 123 | let query_range = match self.query { |
| 124 | Some(query_id) => query_id..=query_id, |
| 125 | None => TPCH_QUERY_START_ID..=TPCH_QUERY_END_ID, |
| 126 | }; |
| 127 | |
| 128 | let mut benchmark_run = BenchmarkRun::new(); |
| 129 | let mut config = self |
| 130 | .common |
| 131 | .config()? |
| 132 | .with_collect_statistics(!self.disable_statistics); |
| 133 | config.options_mut().optimizer.prefer_hash_join = self.prefer_hash_join; |
| 134 | config.options_mut().optimizer.enable_piecewise_merge_join = |
| 135 | self.enable_piecewise_merge_join; |
| 136 | config.options_mut().execution.hash_join_buffering_capacity = |
| 137 | self.hash_join_buffering_capacity; |
| 138 | let rt = self.common.build_runtime()?; |
| 139 | let ctx = SessionContext::new_with_config_rt(config, rt); |
| 140 | // register tables |
| 141 | self.register_tables(&ctx).await?; |
| 142 | let scale_factor = self.scale_factor()?; |
| 143 | |
| 144 | for query_id in query_range { |
| 145 | benchmark_run.start_new_case(&format!("Query {query_id}")); |
| 146 | let query_run = self.benchmark_query(query_id, scale_factor, &ctx).await; |
| 147 | match query_run { |
| 148 | Ok(query_results) => { |
| 149 | for iter in query_results { |
| 150 | benchmark_run.write_iter(iter.elapsed, iter.row_count); |
| 151 | } |
| 152 | } |
| 153 | Err(e) => { |
| 154 | benchmark_run.mark_failed(); |
| 155 | eprintln!("Query {query_id} failed: {e}"); |
| 156 | } |
| 157 | } |
| 158 | } |
| 159 | benchmark_run.maybe_write_json(self.output_path.as_ref())?; |
| 160 | benchmark_run.maybe_print_failures(); |
| 161 | Ok(()) |
| 162 | } |
| 163 | |
| 164 | async fn benchmark_query( |
| 165 | &self, |
nothing calls this directly
no test coverage detected