From a5bb36462890cd6f2cc3b13f6344a2d9e458f897 Mon Sep 17 00:00:00 2001 From: Siew Kam Onn Date: Wed, 9 Sep 2026 18:02:15 +0800 Subject: [PATCH 1/4] empty commit From d8e2209c517747aea363f23378e16fd7faa407a4 Mon Sep 17 00:00:00 2001 From: Siew Kam Onn Date: Wed, 9 Sep 2026 12:12:50 +0800 Subject: [PATCH 2/4] =?UTF-8?q?feat:=20add=20data=E2=80=91free=20SQL=20har?= =?UTF-8?q?ness=20for=20array=5Fagg=5Fdistinct=20benchmark?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Added harness implementation: - `benchmarks/sql_benchmarks/array_agg_distinct/array_agg_distinct.suite` – defines the benchmark suite, test parameters, and execution configuration for the data‑free SQL harness. - `benchmarks/sql_benchmarks/array_agg_distinct/benchmarks/q01.benchmark` – contains the specific query benchmark (`q01`) that exercises the `array_agg(DISTINCT …)` workload without requiring any input data. - Workload characteristics: - Simulates **2 M range rows** → **1 M groups**. - Each group contains **2 rows** with **2 distinct values**, providing a realistic yet data‑free test scenario for aggregation performance. - add bench.sh wrapper for array_agg_distinct --- benchmarks/bench.sh | 12 ++++++++++++ .../array_agg_distinct/array_agg_distinct.suite | 11 +++++++++++ .../array_agg_distinct/benchmarks/q01.benchmark | 11 +++++++++++ 3 files changed, 34 insertions(+) create mode 100644 benchmarks/sql_benchmarks/array_agg_distinct/array_agg_distinct.suite create mode 100644 benchmarks/sql_benchmarks/array_agg_distinct/benchmarks/q01.benchmark diff --git a/benchmarks/bench.sh b/benchmarks/bench.sh index 419fd5be3ad2b..3fb9dcb37616f 100755 --- a/benchmarks/bench.sh +++ b/benchmarks/bench.sh @@ -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: 1M-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 @@ -651,6 +652,9 @@ main() { dict) run_dict ;; + array_agg_distinct) + run_array_agg_distinct + ;; compile_profile) run_compile_profile "${PROFILE_ARGS[@]}" ;; @@ -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" diff --git a/benchmarks/sql_benchmarks/array_agg_distinct/array_agg_distinct.suite b/benchmarks/sql_benchmarks/array_agg_distinct/array_agg_distinct.suite new file mode 100644 index 0000000000000..b114854f14f54 --- /dev/null +++ b/benchmarks/sql_benchmarks/array_agg_distinct/array_agg_distinct.suite @@ -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." diff --git a/benchmarks/sql_benchmarks/array_agg_distinct/benchmarks/q01.benchmark b/benchmarks/sql_benchmarks/array_agg_distinct/benchmarks/q01.benchmark new file mode 100644 index 0000000000000..b1987a14656ee --- /dev/null +++ b/benchmarks/sql_benchmarks/array_agg_distinct/benchmarks/q01.benchmark @@ -0,0 +1,11 @@ +name Q01 +group array_agg_distinct + +expect_plan AggregateExec + +run +-- 1M 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(2000000) +GROUP BY value / 2; From 4200992be1d18b5e16d99106b913eb589ea75c72 Mon Sep 17 00:00:00 2001 From: Siew Kam Onn Date: Wed, 9 Sep 2026 16:51:07 +0800 Subject: [PATCH 3/4] chore: adjust benchmark scope from 1M to 10K groups - `benchmarks/sql_benchmarks/array_agg_distinct/benchmarks/q01.benchmark`: changed `range` from `2000000` to `20000` - `benchmarks/bench.sh`: updated help text --- benchmarks/bench.sh | 2 +- .../array_agg_distinct/benchmarks/q01.benchmark | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/benchmarks/bench.sh b/benchmarks/bench.sh index 3fb9dcb37616f..0a44cf3d7f8b1 100755 --- a/benchmarks/bench.sh +++ b/benchmarks/bench.sh @@ -164,7 +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: 1M-group, two-row-per-group array_agg(DISTINCT) benchmark +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 diff --git a/benchmarks/sql_benchmarks/array_agg_distinct/benchmarks/q01.benchmark b/benchmarks/sql_benchmarks/array_agg_distinct/benchmarks/q01.benchmark index b1987a14656ee..283f7e80f2275 100644 --- a/benchmarks/sql_benchmarks/array_agg_distinct/benchmarks/q01.benchmark +++ b/benchmarks/sql_benchmarks/array_agg_distinct/benchmarks/q01.benchmark @@ -4,8 +4,8 @@ group array_agg_distinct expect_plan AggregateExec run --- 1M groups, 2 rows/group, and 2 distinct values/group. `range` is end-exclusive. +-- 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(2000000) +FROM range(20000) GROUP BY value / 2; From 78cf4e00ac3a5b989ad62477c9a7137881f0d79a Mon Sep 17 00:00:00 2001 From: Siew Kam Onn Date: Wed, 9 Sep 2026 18:02:20 +0800 Subject: [PATCH 4/4] empty commit