Read Primitives — Full Outer Join with GroupBy
Read Primitives benchmark · all Read Primitives queries
FULL OUTER JOIN with string grouping and aggregation
Representative SQL
Rendered for DataFusion with default parameters.
SELECT c.c_mktsegment, COUNT(o.o_orderkey) AS order_count, COUNT(c.c_custkey) AS customer_countFROM customer AS cFULL OUTER JOIN orders AS o ON c.c_custkey = o.o_custkeyGROUP BY c.c_mktsegmentRepresentative DataFrame
Expression family (Polars, PySpark, DataFusion), default parameters.
def expression_impl(ctx: DataFrameContext) -> Any: joined = ctx.get_table("customer").join( ctx.get_table("orders"), left_on="c_custkey", right_on="o_custkey", how=how ) return joined.group_by("c_mktsegment").agg( *(getattr(ctx.col(col), func)().alias(alias) for col, func, alias in aggs) )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 factorqueries = bench.get_queries(dialect="datafusion") # your platform's dialect; drop dialect= for native SQLprint(queries['shuffle_full_join_one_to_many_string_with_groupby'])For the DataFrame form:
from benchbox.core.query_catalog import get_dataframe_render
print(get_dataframe_render('read_primitives', 'shuffle_full_join_one_to_many_string_with_groupby', family="expression").source) # or family="pandas"Source
Query text: benchbox/core/read_primitives/queries.py