Skip to content

Commit

Permalink
feat: Added prefer_round_robin for clickbench_partitioned
Browse files Browse the repository at this point in the history
  • Loading branch information
Weijun-H committed Feb 9, 2025
1 parent ec01612 commit cc8ed26
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion benchmarks/bench.sh
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,7 @@ run_clickbench_partitioned() {
RESULTS_FILE="${RESULTS_DIR}/clickbench_partitioned.json"
echo "RESULTS_FILE: ${RESULTS_FILE}"
echo "Running clickbench (partitioned, 100 files) benchmark..."
$CARGO_COMMAND --bin dfbench -- clickbench --iterations 5 --path "${DATA_DIR}/hits_partitioned" --queries-path "${SCRIPT_DIR}/queries/clickbench/queries.sql" -o "${RESULTS_FILE}"
$CARGO_COMMAND --bin dfbench -- clickbench --iterations 5 --path "${DATA_DIR}/hits_partitioned" --prefer_round_robin "${PREFER_ROUND_ROBIN}" --queries-path "${SCRIPT_DIR}/queries/clickbench/queries.sql" -o "${RESULTS_FILE}"
}

# Runs the clickbench "extended" benchmark with a single large parquet file
Expand Down
13 changes: 13 additions & 0 deletions benchmarks/src/clickbench.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ use datafusion_common::exec_datafusion_err;
use datafusion_common::instant::Instant;
use structopt::StructOpt;

// hack to avoid `default_value is meaningless for bool` errors
type BoolDefaultTrue = bool;

/// Run the clickbench benchmark
///
/// The ClickBench[1] benchmarks are widely cited in the industry and
Expand Down Expand Up @@ -68,6 +71,11 @@ pub struct RunOpt {
/// If present, write results json here
#[structopt(parse(from_os_str), short = "o", long = "output")]
output_path: Option<PathBuf>,

/// If true then round robin repartitioning is used, if false then on demand repartitioning
/// True by default.
#[structopt(short = "r", long = "prefer_round_robin", default_value = "true")]
prefer_round_robin: BoolDefaultTrue,
}

struct AllQueries {
Expand Down Expand Up @@ -124,6 +132,11 @@ impl RunOpt {
parquet_options.binary_as_string = true;
}

config
.options_mut()
.optimizer
.prefer_round_robin_repartition = self.prefer_round_robin;

let ctx = SessionContext::new_with_config(config);
self.register_hits(&ctx).await?;

Expand Down

0 comments on commit cc8ed26

Please sign in to comment.