Skip to content

ClickBench — Multi-Aggregate Scan

ClickBench benchmark · all ClickBench queries

SUM, COUNT, AVG on full table scan - multiple aggregate functions

Representative SQL

Rendered for DataFusion with default parameters.

SELECT
SUM(AdvEngineID),
COUNT(*),
AVG(ResolutionWidth)
FROM hits

Representative DataFrame

Expression family (Polars, PySpark, DataFusion), default parameters.

def impl(ctx: DataFrameContext) -> Any:
hits = _expr_filter(ctx, _hits(ctx), filter_code)
return hits.select(*[_expr_agg(ctx, token) for token in agg_spec.split(";")])

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 factor
queries = bench.get_queries(dialect="datafusion") # your platform's dialect; drop dialect= for native SQL
print(queries['Q3'])

For the DataFrame form:

from benchbox.core.query_catalog import get_dataframe_render
print(get_dataframe_render('clickbench', 'Q3', family="expression").source) # or family="pandas"

Source

Query text: benchbox/core/clickbench/queries.py