alamb commented on code in PR #24806:
URL: https://github.com/apache/datafusion/pull/24806#discussion_r3960392320
##########
benchmarks/benches/sql.rs:
##########
@@ -40,61 +38,21 @@ static ALLOC: snmalloc_rs::SnMalloc = snmalloc_rs::SnMalloc;
#[global_allocator]
static ALLOC: mimalloc::MiMalloc = mimalloc::MiMalloc;
-#[derive(Debug, Parser)]
-#[command(ignore_errors = true)]
-struct EnvParser {
- #[command(flatten)]
- options: CommonOpt,
-
- #[arg(
- env = "BENCH_PERSIST_RESULTS",
- long = "persist_results",
- default_value = "false",
- action = clap::ArgAction::SetTrue
- )]
- persist_results: bool,
-
- #[arg(
- env = "BENCH_VALIDATE",
- long = "validate_results",
- default_value = "false",
- action = clap::ArgAction::SetTrue
- )]
- validate: bool,
-
- #[arg(env = "BENCH_NAME")]
- name: Option<String>,
-
- #[arg(env = "BENCH_SUBGROUP")]
- subgroup: Option<String>,
-
- #[arg(env = "BENCH_QUERY")]
- query: Option<String>,
-}
-
pub fn sql(c: &mut Criterion) {
env_logger::init();
let start = Instant::now();
- let args = EnvParser::parse();
- let config = SqlRunConfig {
- common: args.options,
- filter: BenchmarkFilter {
- name: args.name,
- subgroup: args.subgroup,
- query: args.query,
- },
- replacements: default_criterion_replacements(),
- query_filename: None,
- persist_results: args.persist_results,
- validate_results: args.validate,
- output: None,
- };
+ let (config, criterion_namespace) = criterion_harness_config_from_env();
Review Comment:
👍 for extracting to a method
##########
benchmarks/src/bin/benchmark_runner.rs:
##########
@@ -70,10 +70,28 @@ enum CliAction {
Criterion {
config: SqlRunConfig,
save_baseline: Option<String>,
+ criterion_namespace: Option<String>,
},
DryRun(DryRunOutput),
}
+fn parse_criterion_namespace(value: &str) -> std::result::Result<String,
String> {
Review Comment:
This appears to duplicate [`validate_criterion_namespace` in
`sql_benchmark_runner.rs`](https://github.com/apache/datafusion/blob/d69046a2332ef85a95d00861bdda08f4556aacad/benchmarks/src/sql_benchmark_runner.rs#L171-L189)
and could drift apart.
The clap `value_parser` could delegate to a shared public validator in
`sql_benchmark_runner`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]