Skip to content

Read Primitives — ORDER BY ALL Simple

Read Primitives benchmark · all Read Primitives queries

Order by all columns in SELECT list

Representative SQL

Rendered for DataFusion with default parameters.

SELECT
r_name,
n_name,
COUNT(*) AS supplier_count
FROM supplier AS s
JOIN nation AS n
ON s.s_nationkey = n.n_nationkey
JOIN region AS r
ON n.n_regionkey = r.r_regionkey
GROUP BY
r_name,
n_name
ORDER BY
r_name,
n_name,
supplier_count

Representative DataFrame

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

def orderby_all_simple_expression_impl(ctx: DataFrameContext) -> Any:
supplier, nation, region = _tables(ctx, "supplier", "nation", "region")
col = ctx.col
return (
supplier.join(nation, left_on="s_nationkey", right_on="n_nationkey")
.join(region, left_on="n_regionkey", right_on="r_regionkey")
.group_by("r_name", "n_name")
.agg(col("s_suppkey").count().alias("supplier_count"))
.sort(["r_name", "n_name", "supplier_count"])
)

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['orderby_all_simple'])

For the DataFrame form:

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

Source

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