Apache DataFusion SQL Query Engine
Add `clickbench_pushdown` benchmark (#16731)
Andrew Lamb18a30ceac590
diff --git a/benchmarks/bench.sh b/benchmarks/bench.shindex 4890012fe5..7339aba78f 100755--- a/benchmarks/bench.sh+++ b/benchmarks/bench.sh@@ -95,7 +95,8 @@ external_aggr: External aggregation benchmark on TPC-H dataset (SF=1)# ClickBench Benchmarksclickbench_1: ClickBench queries against a single parquet file-clickbench_partitioned: ClickBench queries against a partitioned (100 files) parquet+clickbench_partitioned: ClickBench queries against partitioned (100 files) parquet+clickbench_pushdown: ClickBench queries against partitioned (100 files) parquet w/ filter_pushdown enabledclickbench_extended: ClickBench \"inspired\" queries against a single parquet (DataFusion specific)# H2O.ai Benchmarks (Group By, Join, Window)@@ -207,6 +208,9 @@ main() {clickbench_partitioned)data_clickbench_partitioned;;+ clickbench_pushdown)+ data_clickbench_partitioned # same data as clickbench_partitioned+ ;;clickbench_extended)data_clickbench_1;;@@ -303,6 +307,7 @@ main() {run_cancellationrun_clickbench_1run_clickbench_partitioned+ run_clickbench_pushdownrun_clickbench_extendedrun_h2o "SMALL" "PARQUET" "groupby"run_h2o "MEDIUM" "PARQUET" "groupby"@@ -340,6 +345,9 @@ main() {clickbench_partitioned)run_clickbench_partitioned;;+ clickbench_pushdown)+ run_clickbench_pushdown+ ;;clickbench_extended)run_clickbench_extended;;@@ -572,7 +580,7 @@ run_clickbench_1() {debug_run $CARGO_COMMAND --bin dfbench -- clickbench --iterations 5 --path "${DATA_DIR}/hits.parquet" --queries-path "${SCRIPT_DIR}/queries/clickbench/queries" -o "${RESULTS_FILE}" ${QUERY_ARG}}- # Runs the clickbench benchmark with the partitioned parquet files+ # Runs the clickbench benchmark with the partitioned parquet dataset (100 files)run_clickbench_partitioned() {RESULTS_FILE="${RESULTS_DIR}/clickbench_partitioned.json"echo "RESULTS_FILE: ${RESULTS_FILE}"@@ -580,6 +588,16 @@ run_clickbench_partitioned() {debug_run $CARGO_COMMAND --bin dfbench -- clickbench --iterations 5 --path "${DATA_DIR}/hits_partitioned" --queries-path "${SCRIPT_DIR}/queries/clickbench/queries" -o "${RESULTS_FILE}" ${QUERY_ARG}}++ # Runs the clickbench benchmark with the partitioned parquet files and filter_pushdown enabled+run_clickbench_pushdown() {+ RESULTS_FILE="${RESULTS_DIR}/clickbench_pushdown.json"+ echo "RESULTS_FILE: ${RESULTS_FILE}"+ echo "Running clickbench (partitioned, 100 files) benchmark with pushdown_filters=true, reorder_filters=true..."+ debug_run $CARGO_COMMAND --bin dfbench -- clickbench --pushdown --iterations 5 --path "${DATA_DIR}/hits_partitioned" --queries-path "${SCRIPT_DIR}/queries/clickbench/queries" -o "${RESULTS_FILE}" ${QUERY_ARG}+}++# Runs the clickbench "extended" benchmark with a single large parquet filerun_clickbench_extended() {RESULTS_FILE="${RESULTS_DIR}/clickbench_extended.json"diff --git a/benchmarks/src/clickbench.rs b/benchmarks/src/clickbench.rsindex 1fa2304f2c..d5f6052d9e 100644--- a/benchmarks/src/clickbench.rs+++ b/benchmarks/src/clickbench.rs@@ -29,7 +29,7 @@ use datafusion_common::exec_datafusion_err;use datafusion_common::instant::Instant;use structopt::StructOpt;-/// Run the clickbench benchmark+/// Driver program to run the ClickBench benchmark////// The ClickBench[1] benchmarks are widely cited in the industry and/// focus on grouping / aggregation / filtering. This runner uses the@@ -44,6 +44,14 @@ pub struct RunOpt {#[structopt(short, long)]query: Option<usize>,+ /// If specified, enables Parquet Filter Pushdown.+ ///+ /// Specifically, it enables:+ /// * `pushdown_filters = true`+ /// * `reorder_filters = true`+ #[structopt(long = "pushdown")]+ pushdown: bool,+/// Common options#[structopt(flatten)]common: CommonOpt,@@ -122,6 +130,12 @@ impl RunOpt {// The hits_partitioned dataset specifies string columns// as binary due to how it was written. Force it to stringsparquet_options.binary_as_string = true;++ // Turn on Parquet filter pushdown if requested+ if self.pushdown {+ parquet_options.pushdown_filters = true;+ parquet_options.reorder_filters = true;+ }}let rt_builder = self.common.runtime_env_builder()?;