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

Method run

benchmarks/src/smj.rs:528–579  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

526
527impl RunOpt {
528 pub async fn run(self) -> Result<()> {
529 println!("Running SMJ benchmarks with the following options: {self:#?}\n");
530
531 // Define query range
532 let query_range = match self.query {
533 Some(query_id) => {
534 if query_id >= 1 && query_id <= SMJ_QUERIES.len() {
535 query_id..=query_id
536 } else {
537 return exec_err!(
538 "Query {query_id} not found. Available queries: 1 to {}",
539 SMJ_QUERIES.len()
540 );
541 }
542 }
543 None => 1..=SMJ_QUERIES.len(),
544 };
545
546 let mut config = self.common.config()?;
547 // Disable hash joins to force SMJ
548 config = config.set_bool("datafusion.optimizer.prefer_hash_join", false);
549 let rt = self.common.build_runtime()?;
550 let ctx = SessionContext::new_with_config_rt(config, rt);
551
552 let mut benchmark_run = BenchmarkRun::new();
553 for query_id in query_range {
554 let query_index = query_id - 1; // Convert 1-based to 0-based index
555
556 let sql = SMJ_QUERIES[query_index];
557 benchmark_run.start_new_case(&format!("Query {query_id}"));
558 let expect_mark = query_id >= 24;
559 let query_run = self
560 .benchmark_query(sql, &query_id.to_string(), expect_mark, &ctx)
561 .await;
562 match query_run {
563 Ok(query_results) => {
564 for iter in query_results {
565 benchmark_run.write_iter(iter.elapsed, iter.row_count);
566 }
567 }
568 Err(e) => {
569 return Err(DataFusionError::Context(
570 format!("SMJ benchmark Q{query_id} failed with error:"),
571 Box::new(e),
572 ));
573 }
574 }
575 }
576
577 benchmark_run.maybe_write_json(self.output_path.as_ref())?;
578 Ok(())
579 }
580
581 async fn benchmark_query(
582 &self,

Callers

nothing calls this directly

Calls 12

newFunction · 0.85
set_boolMethod · 0.80
build_runtimeMethod · 0.80
start_new_caseMethod · 0.80
write_iterMethod · 0.80
maybe_write_jsonMethod · 0.80
ContextClass · 0.50
lenMethod · 0.45
configMethod · 0.45
benchmark_queryMethod · 0.45
to_stringMethod · 0.45
as_refMethod · 0.45

Tested by

no test coverage detected