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

Method run

benchmarks/src/cancellation.rs:89–115  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

87
88impl RunOpt {
89 pub async fn run(self) -> Result<()> {
90 let files_on_disk =
91 find_or_generate_files(&self.path, self.num_files, self.num_rows_per_file)
92 .await?;
93
94 // Using an in-memory object store is important for this benchmark to ensure `datafusion`
95 // is yielding often enough regardless of whether the file reading happens to be yielding.
96 let store =
97 Arc::new(object_store::memory::InMemory::new()) as Arc<dyn ObjectStore>;
98 println!("Starting to load data into in-memory object store");
99 load_data(Arc::clone(&store), &files_on_disk).await?;
100 println!("Done loading data into in-memory object store");
101
102 let mut rundata = BenchmarkRun::new();
103 rundata.start_new_case("Cancellation");
104
105 for i in 0..self.common.iterations {
106 let elapsed = run_test(self.wait_time, Arc::clone(&store))?;
107 let ms = elapsed.as_secs_f64() * 1000.0;
108 println!("Iteration {i} cancelled in {ms} ms");
109 rundata.write_iter(elapsed, 0);
110 }
111
112 rundata.maybe_write_json(self.output_path.as_ref())?;
113
114 Ok(())
115 }
116}
117
118fn run_test(wait_time: u64, store: Arc<dyn ObjectStore>) -> Result<Duration> {

Callers

nothing calls this directly

Calls 8

find_or_generate_filesFunction · 0.85
newFunction · 0.85
load_dataFunction · 0.85
start_new_caseMethod · 0.80
write_iterMethod · 0.80
maybe_write_jsonMethod · 0.80
run_testFunction · 0.70
as_refMethod · 0.45

Tested by

no test coverage detected