-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Replace deprecated structopt with clap in datafusion-benchmarks #19492
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Replace deprecated structopt with clap in datafusion-benchmarks #19492
Conversation
|
@Jefffrey could u review this one !? |
|
I'll try take a look when I have time |
| #[structopt(name = "IMDB", about = "IMDB Dataset Processing.")] | ||
| #[derive(Debug, Parser)] | ||
| #[command(name = "IMDB", about = "IMDB Dataset Processing.")] | ||
| enum ImdbOpt { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is unconventional - #[derive(Parser)] + enum.
Let's keep it consistent with the other binaries, e.g.:
#[derive(Debug, Parser)]
struct Cli {
#[command(subcommand)]
command: ImdbOpt,
}
#[derive(Debug, Subcommand)]
enum ImdbOpt {
Benchmark(BenchmarkSubCommandOpt),
Convert(imdb::ConvertOpt),
}
...| /// Default value is the small files for join x table, small table, medium table, big table files in the h2o benchmark | ||
| /// This is the small csv file case | ||
| #[structopt( | ||
| short = "join-paths", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍🏻
This seems to have been a bug in the old impl. I guess structopt ignored it and used the first letter of the field name (j)
It is good that Clap uses a char for short!
| #[structopt(name = "Memory Profiling Utility")] | ||
| #[derive(Debug, Parser)] | ||
| #[command(name = "Memory Profiling Utility")] | ||
| struct MemProfileOpt { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Shall it rename it to Cli to make it consistent with the other binaries ?
Which issue does this PR close?
Closes - #19482
(Part of #19072 )
Rationale for this change
The structopt crate is deprecated and has been superseded by clap with its derive feature.
This migration:
What changes are included in this PR?
Updated Cargo.toml to use clap = { version = "4.5.53", features = ["derive"] } instead of structopt
Migrated all benchmark source files to use clap's derive macros:
#[derive(StructOpt)]→#[derive(Parser/Args/Subcommand)]#[structopt(...)]→#[arg(...)]for fields#[structopt(...)]→#[command(...)]for struct/enum-level attributesStructOpt::from_args()→Parser::parse()Removed
parse(from_os_str)as PathBuf works natively in clapChanged short flag strings to chars ('p' instead of "p")
Are these changes tested?
Yes
Are there any user-facing changes?
No. The CLI interface remains identical - this is a drop-in replacement of the underlying argument parsing library.