Skip to content

Read Primitives — Shuffle Join

Read Primitives benchmark · all Read Primitives queries

Data is redistributed based on the join keys

Representative SQL

Rendered for DataFusion with default parameters.

SELECT
o.o_orderkey,
SUM(l.l_quantity) AS total_qty
FROM orders AS o
JOIN lineitem AS l
ON o.o_orderkey = l.l_orderkey
GROUP BY
o.o_orderkey

Representative DataFrame

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

def shuffle_join_expression_impl(ctx: DataFrameContext) -> Any:
return (
ctx.get_table("orders")
.join(ctx.get_table("lineitem"), left_on="o_orderkey", right_on="l_orderkey")
.group_by("o_orderkey")
.agg(ctx.col("l_quantity").sum().alias("total_qty"))
)

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

For the DataFrame form:

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

Source

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