Read Primitives — Window SUM
Read Primitives benchmark · all Read Primitives queries
Window function SUM() OVER (PARTITION BY …)
Representative SQL
Rendered for DataFusion with default parameters.
SELECT l_orderkey, l_linenumber, l_extendedprice, SUM(l_extendedprice) OVER (PARTITION BY l_orderkey) AS order_totalFROM lineitemRepresentative DataFrame
Expression family (Polars, PySpark, DataFusion), default parameters.
def window_sum_expression_impl(ctx: DataFrameContext) -> Any: return ( ctx.get_table("lineitem") .with_columns(ctx.window_sum("l_extendedprice", partition_by=["l_orderkey"]).alias("order_total")) .select("l_orderkey", "l_linenumber", "l_extendedprice", "order_total") )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['window_sum'])For the DataFrame form:
from benchbox.core.query_catalog import get_dataframe_render
print(get_dataframe_render('read_primitives', 'window_sum', family="expression").source) # or family="pandas"Source
Query text: benchbox/core/read_primitives/queries.py