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

Function load_benchmarks

benchmarks/benches/sql.rs:264–295  ·  view source on GitHub ↗

Loads all benchmark files in the `sql_benchmarks` directory. For each file ending with `.benchmark` it creates a new `SqlBenchmark` instance.

(
    args: &EnvParser,
    ctx: &SessionContext,
    path: &str,
)

Source from the content-addressed store, hash-verified

262/// For each file ending with `.benchmark` it creates a new
263/// `SqlBenchmark` instance.
264async fn load_benchmarks(
265 args: &EnvParser,
266 ctx: &SessionContext,
267 path: &str,
268) -> Result<BTreeMap<String, Vec<SqlBenchmark>>> {
269 let mut benches = BTreeMap::new();
270 let mut paths = Vec::new();
271
272 list_files(path, &mut |path: &str| {
273 if path.ends_with(".benchmark") {
274 paths.push(path.to_string());
275 }
276 });
277
278 for path in paths {
279 debug!("Loading benchmark from {path}");
280
281 let benchmark = SqlBenchmark::new(ctx, &path, &*SQL_BENCHMARK_DIRECTORY).await?;
282 let entries = benches
283 .entry(benchmark.group().to_string())
284 .or_insert(vec![]);
285
286 entries.push(benchmark);
287 }
288
289 benches = filter_benchmarks(args, benches);
290 benches.iter_mut().for_each(|(_, benchmarks)| {
291 benchmarks.sort_by(|b1, b2| b1.name().cmp(b2.name()))
292 });
293
294 Ok(benches)
295}
296
297fn filter_benchmarks(
298 args: &EnvParser,

Callers 1

sqlFunction · 0.85

Calls 9

newFunction · 0.85
list_filesFunction · 0.85
filter_benchmarksFunction · 0.85
groupMethod · 0.80
pushMethod · 0.45
to_stringMethod · 0.45
sort_byMethod · 0.45
cmpMethod · 0.45
nameMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…