Skip to content

Apache DataFusion SQL Query Engine

Add ClickBench URL pushdown benchmark (#21945)

xudong.w702f4794d66f
diff --git a/benchmarks/queries/clickbench/README.md b/benchmarks/queries/clickbench/README.md
index cead49586b..8b3d08b128 100644
--- a/benchmarks/queries/clickbench/README.md
+++ b/benchmarks/queries/clickbench/README.md
@@ -241,6 +241,25 @@ These queries test the performance of the `FIRST_VALUE` aggregation function wit
| Q12 | `WatchID` | `Int64` | `OS` | `Int16` | 91 |
+### Q13: Filter-only URL Range Match
+
+**Question**: "What is the sum of counter IDs for page views with URLs in the normal URL string range?"
+
+**Important Query Properties**: Filter-only string range match. The `URL`
+column is used only by the pushed-down filter and is not projected or
+aggregated. This makes the query useful for measuring optimizations that can
+skip RowFilter evaluation when Parquet row group statistics prove that all rows
+in a row group satisfy the string predicate. The output-side aggregation is
+intentionally lightweight so the scan-time filter evaluation cost remains
+visible. Run this query with Parquet filter pushdown enabled, for example
+`dfbench clickbench --pushdown --query 13`.
+
+```sql
+SELECT SUM("CounterID") AS counter_id_sum
+FROM hits
+WHERE "URL" < 'zzzz';
+```
+
diff --git a/benchmarks/queries/clickbench/extended/q13.sql b/benchmarks/queries/clickbench/extended/q13.sql
new file mode 100644
index 0000000000..b76a076656
--- /dev/null
+++ b/benchmarks/queries/clickbench/extended/q13.sql
@@ -0,0 +1,6 @@
+-- Must set for ClickBench hits_partitioned dataset. See https://github.com/apache/datafusion/issues/16591
+-- set datafusion.execution.parquet.binary_as_string = true
+
+SELECT SUM("CounterID") AS counter_id_sum
+FROM hits
+WHERE "URL" < 'zzzz';