Skip to content

Commit 66347e4

Browse files
Omega359martin-g
authored andcommitted
add clickbench sorted SQL benchmark (apache#22807)
## Which issue does this PR close? Part of apache#21706 ## Rationale for this change Continue work on sql benchmark migration. ## What changes are included in this PR? clickbench_sorted sql benchmark ## Are these changes tested? Yes `BENCH_NAME=clickbench_sorted cargo bench --bench sql` ## Are there any user-facing changes? No --------- Co-authored-by: Martin Grigorov <[email protected]>
1 parent 8c347d7 commit 66347e4

2 files changed

Lines changed: 25 additions & 0 deletions

File tree

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name Q00
2+
group clickbench_sorted
3+
4+
init sql_benchmarks/clickbench/init/set_config.sql
5+
6+
load sql_benchmarks/clickbench_sorted/init/load.sql
7+
8+
assert I
9+
SELECT COUNT(*) > 0 from hits;
10+
----
11+
true
12+
13+
run
14+
SELECT * FROM hits ORDER BY "EventTime" DESC limit 10;
15+
16+
result sql_benchmarks/clickbench_sorted/results/q00.csv
17+
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
-- Run benchmark with prefer_existing_sort configuration
2+
-- This allows DataFusion to optimize away redundant sorts while maintaining parallelism
3+
4+
set datafusion.optimizer.prefer_existing_sort=true;
5+
6+
CREATE EXTERNAL TABLE hits_raw STORED AS PARQUET LOCATION '${DATA_DIR:-data}/hits_sorted.parquet' WITH ORDER ("${SORTED_BY:-EventTime}" ${SORTED_ORDER:-ASC});
7+
8+
CREATE VIEW hits AS SELECT * EXCEPT ("EventDate"), CAST(CAST("EventDate" AS INTEGER) AS DATE) AS "EventDate" FROM hits_raw;

0 commit comments

Comments
 (0)