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

Method run

benchmarks/src/dict.rs:313–359  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

311}
312impl RunOpt {
313 pub async fn run(self) -> Result<()> {
314 println!(
315 "Running dictionary encoding benchmarks with the following options: {self:#?}\n"
316 );
317
318 let query_range = match self.query {
319 Some(query_id) => {
320 if query_id >= 1 && query_id <= DICTIONARY_QUERIES.len() {
321 query_id..=query_id
322 } else {
323 return exec_err!(
324 "Query {query_id} not found. Available queries: 1 to {}",
325 DICTIONARY_QUERIES.len()
326 );
327 }
328 }
329 None => 1..=DICTIONARY_QUERIES.len(),
330 };
331
332 let config = self.common.config()?;
333 let rt = self.common.build_runtime()?;
334 let ctx = SessionContext::new_with_config_rt(config, rt);
335 let mut benchmark_run = BenchmarkRun::new();
336
337 for query_id in query_range {
338 let query = &DICTIONARY_QUERIES[query_id - 1];
339 benchmark_run.start_new_case(query.name);
340
341 let query_run = self.benchmark_query(query, &ctx).await;
342 match query_run {
343 Ok(query_results) => {
344 for iter in query_results {
345 benchmark_run.write_iter(iter.elapsed, iter.row_count);
346 }
347 }
348 Err(e) => {
349 return Err(DataFusionError::Context(
350 format!("Dictionary benchmark '{}' failed:", query.name),
351 Box::new(e),
352 ));
353 }
354 }
355 }
356
357 benchmark_run.maybe_write_json(self.output_path.as_ref())?;
358 Ok(())
359 }
360
361 async fn benchmark_query(
362 &self,

Callers

nothing calls this directly

Calls 10

newFunction · 0.85
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
as_refMethod · 0.45

Tested by

no test coverage detected