diff --git a/Cargo.lock b/Cargo.lock index ee258cc267..f0d7180f49 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -468,6 +468,7 @@ dependencies = [ "arrow-select", "bytes", "bzip2", + "clap", "criterion", "csv", "datafusion", @@ -704,6 +705,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c937d4061031a6d0c8da4b9a4f98a172fc2976dfb1c19213a9cf7d0d3c837e36" dependencies = [ "clap_builder", + "clap_derive", ] [[package]] @@ -719,6 +721,18 @@ dependencies = [ "terminal_size", ] +[[package]] +name = "clap_derive" +version = "4.5.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "501d359d5f3dcaf6ecdeee48833ae73ec6e42723a1e52419c79abf9507eec0a0" +dependencies = [ + "heck 0.5.0", + "proc-macro2", + "quote", + "syn 2.0.72", +] + [[package]] name = "clap_lex" version = "0.7.2" diff --git a/bench-vortex/Cargo.toml b/bench-vortex/Cargo.toml index 175ae0623b..ad1fdc34b2 100644 --- a/bench-vortex/Cargo.toml +++ b/bench-vortex/Cargo.toml @@ -23,6 +23,7 @@ arrow-select = { workspace = true } bytes = { workspace = true } bzip2 = { workspace = true } csv = { workspace = true } +clap = { workspace = true, features = ["derive"] } datafusion = { workspace = true } enum-iterator = { workspace = true } flexbuffers = { workspace = true } @@ -57,7 +58,12 @@ vortex-fastlanes = { workspace = true } vortex-roaring = { workspace = true } vortex-runend = { workspace = true } vortex-sampling-compressor = { workspace = true } -vortex-serde = { workspace = true, features = ["futures", "monoio", "tokio", "object_store"] } +vortex-serde = { workspace = true, features = [ + "futures", + "monoio", + "tokio", + "object_store", +] } xshell = { workspace = true } [dev-dependencies] diff --git a/bench-vortex/src/bin/tpch_benchmark.rs b/bench-vortex/src/bin/tpch_benchmark.rs index d089e65f2c..b27c128f9b 100644 --- a/bench-vortex/src/bin/tpch_benchmark.rs +++ b/bench-vortex/src/bin/tpch_benchmark.rs @@ -3,15 +3,25 @@ use std::time::SystemTime; use bench_vortex::tpch::dbgen::{DBGen, DBGenOptions}; use bench_vortex::tpch::{load_datasets, tpch_queries, Format}; +use clap::Parser; use futures::future::try_join_all; use indicatif::ProgressBar; use prettytable::{Cell, Row, Table}; +#[derive(Parser, Debug)] +#[command(version, about, long_about = None)] +struct Args { + #[arg(short, long, value_delimiter = ',')] + queries: Option>, +} + #[tokio::main(flavor = "multi_thread", worker_threads = 8)] async fn main() { // uncomment the below to enable trace logging of datafusion execution // setup_logger(LevelFilter::Trace); + let args = Args::parse(); + // Run TPC-H data gen. let data_dir = DBGen::new(DBGenOptions::default()).generate().unwrap(); @@ -43,12 +53,19 @@ async fn main() { table.add_row(Row::new(cells)); } + let query_count = args.queries.as_ref().map_or(21, |c| c.len()); + // Setup a progress bar - let progress = ProgressBar::new(21 * formats.len() as u64); + let progress = ProgressBar::new((query_count * formats.len()) as u64); // Send back a channel with the results of Row. let (rows_tx, rows_rx) = sync::mpsc::channel(); for (q, query) in tpch_queries() { + if let Some(queries) = args.queries.as_ref() { + if !queries.contains(&q) { + continue; + } + } let ctxs = ctxs.clone(); let tx = rows_tx.clone(); let progress = progress.clone();