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

Method run

benchmarks/src/bin/external_aggr.rs:128–182  ·  view source on GitHub ↗

If `--query` and `--memory-limit` is not specified, run all queries with pre-configured memory limits If only `--query` is specified, run the query with all memory limits for this query If both `--query` and `--memory-limit` are specified, run the query with the specified memory limit

(&self)

Source from the content-addressed store, hash-verified

126 /// If both `--query` and `--memory-limit` are specified, run the query
127 /// with the specified memory limit
128 pub async fn run(&self) -> Result<()> {
129 let mut benchmark_run = BenchmarkRun::new();
130
131 let memory_limit = self.common.memory_limit.map(|limit| limit as u64);
132 let mem_pool_type = self.common.mem_pool_type.as_str();
133
134 let query_range = match self.query {
135 Some(query_id) => query_id..=query_id,
136 None => 1..=Self::AGGR_QUERIES.len(),
137 };
138
139 // Each element is (query_id, memory_limit)
140 // e.g. [(1, 64_000), (1, 32_000)...] means first run Q1 with 64KiB
141 // memory limit, next run Q1 with 32KiB memory limit, etc.
142 let mut query_executions = vec![];
143 // Setup `query_executions`
144 for query_id in query_range {
145 if query_id > Self::AGGR_QUERIES.len() {
146 return exec_err!(
147 "Invalid '--query'(query number) {} for external aggregation benchmark.",
148 query_id
149 );
150 }
151
152 match memory_limit {
153 Some(limit) => {
154 query_executions.push((query_id, limit));
155 }
156 None => {
157 let memory_limits = QUERY_MEMORY_LIMITS.get(&query_id).unwrap();
158 for limit in memory_limits {
159 query_executions.push((query_id, *limit));
160 }
161 }
162 }
163 }
164
165 for (query_id, mem_limit) in query_executions {
166 benchmark_run.start_new_case(&format!(
167 "{query_id}({})",
168 human_readable_size(mem_limit as usize)
169 ));
170
171 let query_results = self
172 .benchmark_query(query_id, mem_limit, mem_pool_type)
173 .await?;
174 for iter in query_results {
175 benchmark_run.write_iter(iter.elapsed, iter.row_count);
176 }
177 }
178
179 benchmark_run.maybe_write_json(self.output_path.as_ref())?;
180
181 Ok(())
182 }
183
184 /// Benchmark query `query_id` in `AGGR_QUERIES`
185 async fn benchmark_query(

Callers 3

mainFunction · 0.45
mainFunction · 0.45
mainFunction · 0.45

Calls 11

newFunction · 0.85
start_new_caseMethod · 0.80
write_iterMethod · 0.80
maybe_write_jsonMethod · 0.80
mapMethod · 0.45
as_strMethod · 0.45
lenMethod · 0.45
pushMethod · 0.45
getMethod · 0.45
benchmark_queryMethod · 0.45
as_refMethod · 0.45

Tested by

no test coverage detected