Add support for running sql benchmarks with command line arguments - #23772
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #23772 +/- ##
==========================================
+ Coverage 80.89% 80.96% +0.06%
==========================================
Files 1102 1103 +1
Lines 376111 377722 +1611
Branches 376111 377722 +1611
==========================================
+ Hits 304251 305813 +1562
- Misses 53753 53776 +23
- Partials 18107 18133 +26 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
@alamb - this should be the last main PR for the cli. The remaining work is in the bench.sh script to use the benchmark_runner and updated documentation. |
|
This is on my list to review shortly -- I am traveling this week but hope to get it reviewed shortly |
| description = "Run all ClickBench queries against the single-file dataset." | ||
|
|
||
| [[examples]] | ||
| command = "cargo run --release --bin benchmark_runner -- clickbench --query 7" |
There was a problem hiding this comment.
I tried it like
cargo run -p datafusion-benchmarks --release --bin benchmark_runner -- clickbench --query 7(venv) andrewlamb@Andrews-MacBook-Pro-3:/tmp/runner$ cargo run -p datafusion-benchmarks --release --bin benchmark_runner -- clickbench --query 7
Finished `release` profile [optimized] target(s) in 0.24s
Running `target/release/benchmark_runner clickbench --query 7`
clickbench/Q07 iteration 0: 146.3 ms, 18 rows
clickbench/Q07 iteration 1: 28.0 ms, 18 rows
clickbench/Q07 iteration 2: 22.9 ms, 18 rowsIt was also sweet to be able to do
cargo run -p datafusion-benchmarks --release --bin benchmark_runner -- clickbench --query 7 --iterations=100And have it do
(venv) andrewlamb@Andrews-MacBook-Pro-3:/tmp/runner$ cargo run -p datafusion-benchmarks --release --bin benchmark_runner -- clickbench --query 7 --iterations=100
Finished `release` profile [optimized] target(s) in 0.21s
Running `target/release/benchmark_runner clickbench --query 7 --iterations=100`
clickbench/Q07 iteration 0: 37.4 ms, 18 rows
clickbench/Q07 iteration 1: 28.1 ms, 18 rows
...
clickbench/Q07 iteration 96: 29.0 ms, 18 rows
clickbench/Q07 iteration 97: 26.2 ms, 18 rows
clickbench/Q07 iteration 98: 29.2 ms, 18 rows
clickbench/Q07 iteration 99: 26.4 ms, 18 rows| DATA_DIR = "../../data" | ||
|
|
||
| [[options]] | ||
| name = "partitioning" |
There was a problem hiding this comment.
this is pretty neat -- so I can do
You can easily see the diiffernc
(venv) andrewlamb@Andrews-MacBook-Pro-3:/tmp/runner$ cargo run -p datafusion-benchmarks --release --bin benchmark_runner -- clickbench_extended --iterations=1
Finished `release` profile [optimized] target(s) in 0.40s
Running `target/release/benchmark_runner clickbench_extended --iterations=1`
clickbench_extended/Q00/single iteration 0: 616.4 ms, 1 rows
clickbench_extended/Q01/single iteration 0: 120.4 ms, 1 rows
clickbench_extended/Q02/single iteration 0: 263.7 ms, 10 rows
clickbench_extended/Q03/single iteration 0: 243.9 ms, 10 rows
clickbench_extended/Q04/single iteration 0: 1247.9 ms, 2 rows
clickbench_extended/Q05/single iteration 0: 9762.0 ms, 2 rows
clickbench_extended/Q06/single iteration 0: 11.7 ms, 1 rows
clickbench_extended/Q07/single iteration 0: 520.7 ms, 10 rows
clickbench_extended/Q08/single iteration 0: 294.6 ms, 10 rows
clickbench_extended/Q09/single iteration 0: 1907.5 ms, 1 rows
clickbench_extended/Q10/single iteration 0: 576.0 ms, 1 rows
clickbench_extended/Q11/single iteration 0: 1140.2 ms, 1 rows
clickbench_extended/Q12/single iteration 0: 129.8 ms, 1 rowsAnd
(venv) andrewlamb@Andrews-MacBook-Pro-3:/tmp/runner$ cargo run -p datafusion-benchmarks --release --bin benchmark_runner -- clickbench_extended --iterations=1 --partitioning partitioned
Finished `release` profile [optimized] target(s) in 0.40s
Running `target/release/benchmark_runner clickbench_extended --iterations=1 --partitioning partitioned`
clickbench_extended/Q00/partitioned iteration 0: 651.8 ms, 1 rows
clickbench_extended/Q01/partitioned iteration 0: 102.8 ms, 1 rows
clickbench_extended/Q02/partitioned iteration 0: 237.8 ms, 10 rows
clickbench_extended/Q03/partitioned iteration 0: 226.6 ms, 10 rows
clickbench_extended/Q04/partitioned iteration 0: 1289.1 ms, 2 rows
clickbench_extended/Q05/partitioned iteration 0: 10181.2 ms, 2 rows
clickbench_extended/Q06/partitioned iteration 0: 4.7 ms, 1 rows
clickbench_extended/Q07/partitioned iteration 0: 716.6 ms, 10 rows
clickbench_extended/Q08/partitioned iteration 0: 281.5 ms, 10 rows
clickbench_extended/Q09/partitioned iteration 0: 1800.9 ms, 1 rows
clickbench_extended/Q10/partitioned iteration 0: 457.3 ms, 1 rows
clickbench_extended/Q11/partitioned iteration 0: 892.2 ms, 1 rows
clickbench_extended/Q12/partitioned iteration 0: 117.3 ms, 1 rows
| cargo run -p datafusion-benchmarks --release --bin benchmark_runner -- tpch --query 15 --format csv | ||
| cargo run -p datafusion-benchmarks --release --bin benchmark_runner -- clickbench --partitioning partitioned --dry-run | ||
| cargo run -p datafusion-benchmarks --release --bin benchmark_runner -- tpch --query 1 --result-mode persist | ||
| cargo run -p datafusion-benchmarks --release --bin benchmark_runner -- tpch --query 1 --result-mode validate |
There was a problem hiding this comment.
it is really cool
(venv) andrewlamb@Andrews-MacBook-Pro-3:/tmp/runner$ cargo run -p datafusion-benchmarks --profile=profiling --bin benchmark_runner -- h2o --size=medium --subgroup=groupby
Finished profiling profile [optimized + debuginfo] target(s) in 0.16s
Running target/profiling/benchmark_runner h2o --size=medium --subgroup=groupby
Loading medium groupby csv h2o data
h2o/Q01/groupby iteration 0: 895.4 ms, 100 rows
h2o/Q01/groupby iteration 1: 886.0 ms, 100 rows
h2o/Q01/groupby iteration 2: 884.8 ms, 100 rows
Loading medium groupby csv h2o data
|
Since I think it is unlikely that anyone else is going to review this PR and it has already been outstanding for so long and it is a testing tool (not part of the library) I will merge it now |
|
Thanks @alamb, much appreciated. |
Which issue does this PR close?
Rationale for this change
SQL benchmark suites expose configuration through environment variables. Contributors must consult the source or documentation to discover suite-specific settings, and Cargo does not forward custom arguments to benchmark targets.
This change lets
benchmark_runnerexpose those settings as validated command-line arguments. It also adds suite-specific help and a dry-run mode for inspecting resolved configuration without executing a benchmark.What changes are included in this PR?
This PR adds TOML
.suitemetadata files that define each SQL benchmark suite’s:benchmark_runneruses this metadata to:--pathfor suites that declare aDATA_DIRreplacement.--result-modefor result persistence and validation.--dry-runJSON output containing the resolved options, paths, value sources, filters, and execution mode without loading benchmarkdefinitions or executing SQL.
The existing basic runner, Criterion mode, and suite-listing functionality remain in place.
Are these changes tested?
Yes. New tests cover:
Are there any user-facing changes?
Yes. Contributors can configure suite-specific settings through command-line arguments and inspect them through suite help:
Environment variables remain supported for compatibility with direct cargo bench invocations and existing benchmark definitions.
The SQL benchmark README documents the command-line options, resolution precedence, dry-run behaviour, and .suite metadata format.
I have a script that cover a large number of combinations to exercise the benchmark_runner as much as possible.