(self)
| 307 | |
| 308 | impl RunOpt { |
| 309 | pub async fn run(self) -> Result<()> { |
| 310 | println!("Running Hash Join benchmarks with the following options: {self:#?}\n"); |
| 311 | |
| 312 | let query_range = match self.query { |
| 313 | Some(query_id) => { |
| 314 | if query_id >= 1 && query_id <= HASH_QUERIES.len() { |
| 315 | query_id..=query_id |
| 316 | } else { |
| 317 | return exec_err!( |
| 318 | "Query {query_id} not found. Available queries: 1 to {}", |
| 319 | HASH_QUERIES.len() |
| 320 | ); |
| 321 | } |
| 322 | } |
| 323 | None => 1..=HASH_QUERIES.len(), |
| 324 | }; |
| 325 | |
| 326 | let config = self.common.config()?; |
| 327 | let rt = self.common.build_runtime()?; |
| 328 | let ctx = SessionContext::new_with_config_rt(config, rt); |
| 329 | |
| 330 | if let Some(path) = &self.path { |
| 331 | for table in &["lineitem", "supplier", "nation", "customer"] { |
| 332 | let table_path = path.join(table); |
| 333 | if !table_path.exists() { |
| 334 | return exec_err!( |
| 335 | "TPC-H table {} not found at {:?}", |
| 336 | table, |
| 337 | table_path |
| 338 | ); |
| 339 | } |
| 340 | ctx.register_parquet( |
| 341 | *table, |
| 342 | table_path.to_str().unwrap(), |
| 343 | Default::default(), |
| 344 | ) |
| 345 | .await?; |
| 346 | } |
| 347 | } |
| 348 | |
| 349 | let mut benchmark_run = BenchmarkRun::new(); |
| 350 | |
| 351 | for query_id in query_range { |
| 352 | let query_index = query_id - 1; |
| 353 | let query = &HASH_QUERIES[query_index]; |
| 354 | |
| 355 | let case_name = format!( |
| 356 | "Query {}_density={}_prob_hit={}_{}*{}", |
| 357 | query_id, |
| 358 | query.density, |
| 359 | query.prob_hit, |
| 360 | query.build_size, |
| 361 | query.probe_size |
| 362 | ); |
| 363 | benchmark_run.start_new_case(&case_name); |
| 364 | |
| 365 | let query_run = self |
| 366 | .benchmark_query(query.sql, &query_id.to_string(), &ctx) |
no test coverage detected