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

Method run

benchmarks/src/tpcds/run.rs:154–194  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

152
153impl 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,

Callers

nothing calls this directly

Calls 13

newFunction · 0.85
options_mutMethod · 0.80
build_runtimeMethod · 0.80
start_new_caseMethod · 0.80
write_iterMethod · 0.80
mark_failedMethod · 0.80
maybe_write_jsonMethod · 0.80
maybe_print_failuresMethod · 0.80
configMethod · 0.45
register_tablesMethod · 0.45
benchmark_queryMethod · 0.45

Tested by

no test coverage detected