ClickBench — URL Length Analysis
ClickBench benchmark · all ClickBench queries
Average URL length by counter with HAVING > 100000
Representative SQL
Rendered for DataFusion with default parameters.
SELECT CounterID, AVG(LENGTH(URL)) AS l, COUNT(*) AS cFROM hitsWHERE URL <> ''GROUP BY CounterIDHAVING COUNT(*) > 100000ORDER BY l DESCLIMIT 25Representative DataFrame
Expression family (Polars, PySpark, DataFusion), default parameters.
def q28_expression_impl(ctx: DataFrameContext) -> Any: col, lit = ctx.col, ctx.lit return ( _hits(ctx) .filter(col("URL") != lit("")) .with_columns(col("URL").str.len_chars().alias("url_len")) .group_by("CounterID") .agg(col("url_len").mean().alias("l"), col("CounterID").count().alias("c")) .filter(col("c") > lit(100000)) .sort("l", descending=True) .limit(25) )Get the exact query for your run
The blocks above are representative. To get the precise statement a specific platform runs at a specific scale, substitute your own values:
from benchbox import ClickBench
bench = ClickBench(scale_factor=1.0) # your scale factorqueries = bench.get_queries(dialect="datafusion") # your platform's dialect; drop dialect= for native SQLprint(queries['Q28'])For the DataFrame form:
from benchbox.core.query_catalog import get_dataframe_render
print(get_dataframe_render('clickbench', 'Q28', family="expression").source) # or family="pandas"Source
Query text: benchbox/core/clickbench/queries.py