Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions benchmarks/bench.sh
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ nlj: Benchmark for simple nested loop joins, testing various
hj: Benchmark for simple hash joins, testing various join scenarios
smj: Benchmark for simple sort merge joins, testing various join scenarios
dict: Benchmark for dictionary-encoded group-by scenarios
array_agg_distinct: 10K-group, two-row-per-group array_agg(DISTINCT) benchmark
compile_profile: Compile and execute TPC-H across selected Cargo profiles, reporting timing and binary size


Expand Down Expand Up @@ -651,6 +652,9 @@ main() {
dict)
run_dict
;;
array_agg_distinct)
run_array_agg_distinct
;;
compile_profile)
run_compile_profile "${PROFILE_ARGS[@]}"
;;
Expand Down Expand Up @@ -1661,6 +1665,14 @@ run_dict() {
debug_run $CARGO_COMMAND --bin dfbench -- dict --iterations 5 -o "${RESULTS_FILE}" ${QUERY_ARG} ${LATENCY_ARG}
}

# Runs the data-free high-cardinality array_agg(DISTINCT) SQL benchmark.
run_array_agg_distinct() {
echo "Running array_agg_distinct benchmark..."
debug_run env BENCH_NAME=array_agg_distinct \
${QUERY:+BENCH_QUERY="${QUERY}"} \
bash -c "$SQL_CARGO_COMMAND"
}


compare_benchmarks() {
BASE_RESULTS_DIR="${SCRIPT_DIR}/results"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
description = "High-cardinality array_agg(DISTINCT) SQL benchmarks"

query_pattern = "q{QUERY_ID_PADDED}.benchmark"

[[examples]]
command = "cargo run --release --bin benchmark_runner -- array_agg_distinct"
description = "Run the high-cardinality array_agg(DISTINCT) benchmark."

[[examples]]
command = "cargo run --release --bin benchmark_runner -- array_agg_distinct --query 1 --iterations 5 --output /tmp/array_agg_distinct.json"
description = "Run five iterations and write comparable JSON results."
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name Q01
group array_agg_distinct

expect_plan AggregateExec

run
-- 10K groups, 2 rows/group, and 2 distinct values/group. `range` is end-exclusive.
-- This is data-free so comparisons isolate grouped array_agg(DISTINCT) execution.
SELECT value / 2 AS k, array_agg(DISTINCT value % 2) AS distinct_values
FROM range(20000)
GROUP BY value / 2;