Skip to content

Read Primitives — Simple Aggregation

Read Primitives benchmark · all Read Primitives queries

Aggregate over all rows in table

Representative SQL

Rendered for DataFusion with default parameters.

SELECT
COUNT(*) AS total_orders,
SUM(o_totalprice) AS total_revenue
FROM orders

Representative DataFrame

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

def aggregation_simple_expression_impl(ctx: DataFrameContext) -> Any:
col = ctx.col
return ctx.get_table("orders").select(
col("o_orderkey").count().alias("total_orders"), col("o_totalprice").sum().alias("total_revenue")
)

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

For the DataFrame form:

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

Source

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