Skip to content

Commit 53ce343

Browse files
committed
Inline sql.
1 parent 0cef615 commit 53ce343

32 files changed

Lines changed: 238 additions & 65 deletions

‎benchmarks/sql_benchmarks/sort_pushdown/README.md‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
# Sort pushdown SQL benchmarks
22

33
Run the existing sort pushdown queries through `benchmark_runner`. This suite
4-
uses the same Parquet files and references the original SQL files under
5-
`benchmarks/queries/`. The `dfbench` implementation and its commands remain
6-
available for comparison.
4+
uses the same Parquet files, with queries inlined in each `.benchmark` file.
5+
The `dfbench` implementation and its commands remain available for comparison.
76

87
From `benchmarks/`, prepare data with the existing generators:
98

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
11
template sql_benchmarks/sort_pushdown/sort_pushdown.benchmark.template
22
QPAD=01
3-
QUERY_ID=1
43
VARIANT=baseline
54
DATASET=sort_pushdown
6-
QUERY_DIR=sort_pushdown
75
SETTINGS=standard
86
ORDERING=unordered
7+
8+
run
9+
-- Sort elimination: ORDER BY sort key ASC (full scan)
10+
-- With --sorted: SortExec removed, sequential scan in file order
11+
-- Without --sorted: full SortExec required
12+
SELECT l_orderkey, l_partkey, l_suppkey
13+
FROM lineitem
14+
ORDER BY l_orderkey
Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,15 @@
11
template sql_benchmarks/sort_pushdown/sort_pushdown.benchmark.template
22
QPAD=02
3-
QUERY_ID=2
43
VARIANT=baseline
54
DATASET=sort_pushdown
6-
QUERY_DIR=sort_pushdown
75
SETTINGS=standard
86
ORDERING=unordered
7+
8+
run
9+
-- Sort elimination + limit pushdown
10+
-- With --sorted: SortExec removed + limit pushed to DataSourceExec
11+
-- Without --sorted: TopK sort over all data
12+
SELECT l_orderkey, l_partkey, l_suppkey
13+
FROM lineitem
14+
ORDER BY l_orderkey
15+
LIMIT 100
Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
11
template sql_benchmarks/sort_pushdown/sort_pushdown.benchmark.template
22
QPAD=03
3-
QUERY_ID=3
43
VARIANT=baseline
54
DATASET=sort_pushdown
6-
QUERY_DIR=sort_pushdown
75
SETTINGS=standard
86
ORDERING=unordered
7+
8+
run
9+
-- Sort elimination: wide projection (all columns)
10+
-- Tests sort elimination benefit with larger row payload
11+
SELECT *
12+
FROM lineitem
13+
ORDER BY l_orderkey
Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
11
template sql_benchmarks/sort_pushdown/sort_pushdown.benchmark.template
22
QPAD=04
3-
QUERY_ID=4
43
VARIANT=baseline
54
DATASET=sort_pushdown
6-
QUERY_DIR=sort_pushdown
75
SETTINGS=standard
86
ORDERING=unordered
7+
8+
run
9+
-- Sort elimination + limit: wide projection
10+
SELECT *
11+
FROM lineitem
12+
ORDER BY l_orderkey
13+
LIMIT 100
Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,15 @@
11
template sql_benchmarks/sort_pushdown/sort_pushdown.benchmark.template
22
QPAD=05
3-
QUERY_ID=5
43
VARIANT=baseline
54
DATASET=sort_pushdown
6-
QUERY_DIR=sort_pushdown
75
SETTINGS=standard
86
ORDERING=unordered
7+
8+
run
9+
-- Reverse scan: ORDER BY DESC LIMIT (narrow projection)
10+
-- With --sorted: reverse_row_groups=true + TopK + stats init + cumulative prune
11+
-- Without --sorted: full TopK sort over all data
12+
SELECT l_orderkey, l_partkey, l_suppkey
13+
FROM lineitem
14+
ORDER BY l_orderkey DESC
15+
LIMIT 100
Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
11
template sql_benchmarks/sort_pushdown/sort_pushdown.benchmark.template
22
QPAD=06
3-
QUERY_ID=6
43
VARIANT=baseline
54
DATASET=sort_pushdown
6-
QUERY_DIR=sort_pushdown
75
SETTINGS=standard
86
ORDERING=unordered
7+
8+
run
9+
-- Reverse scan: ORDER BY DESC LIMIT larger fetch (narrow projection)
10+
SELECT l_orderkey, l_partkey, l_suppkey
11+
FROM lineitem
12+
ORDER BY l_orderkey DESC
13+
LIMIT 1000
Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
11
template sql_benchmarks/sort_pushdown/sort_pushdown.benchmark.template
22
QPAD=07
3-
QUERY_ID=7
43
VARIANT=baseline
54
DATASET=sort_pushdown
6-
QUERY_DIR=sort_pushdown
75
SETTINGS=standard
86
ORDERING=unordered
7+
8+
run
9+
-- Reverse scan: wide projection + DESC LIMIT
10+
SELECT *
11+
FROM lineitem
12+
ORDER BY l_orderkey DESC
13+
LIMIT 100
Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
11
template sql_benchmarks/sort_pushdown/sort_pushdown.benchmark.template
22
QPAD=08
3-
QUERY_ID=8
43
VARIANT=baseline
54
DATASET=sort_pushdown
6-
QUERY_DIR=sort_pushdown
75
SETTINGS=standard
86
ORDERING=unordered
7+
8+
run
9+
-- Reverse scan: wide projection + DESC LIMIT larger fetch
10+
SELECT *
11+
FROM lineitem
12+
ORDER BY l_orderkey DESC
13+
LIMIT 1000
Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,16 @@
11
template sql_benchmarks/sort_pushdown/sort_pushdown.benchmark.template
22
QPAD=01
3-
QUERY_ID=1
43
VARIANT=inexact
54
DATASET=sort_pushdown_inexact
6-
QUERY_DIR=sort_pushdown_inexact
75
SETTINGS=inexact
86
ORDERING=ordered
7+
8+
run
9+
-- Inexact path: TopK + DESC LIMIT on ASC-declared file.
10+
-- With RG reorder, the first RG read contains the highest max value,
11+
-- so TopK's threshold tightens quickly and subsequent RGs get filtered
12+
-- efficiently via dynamic filter pushdown.
13+
SELECT l_orderkey, l_partkey, l_suppkey
14+
FROM lineitem
15+
ORDER BY l_orderkey DESC
16+
LIMIT 100

0 commit comments

Comments
 (0)