Read Primitives — Window Growing Frame
Read Primitives benchmark · all Read Primitives queries
Running sum window aggregation with growing frame size
Representative SQL
Rendered for DataFusion with default parameters.
SELECT l_orderkey, l_linenumber, l_quantity, SUM(l_quantity) OVER ( PARTITION BY l_orderkey ORDER BY l_linenumber ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW ) AS running_quantityFROM lineitemWHERE l_orderkey <= 1000Representative DataFrame
Expression family (Polars, PySpark, DataFusion), default parameters.
def window_growing_frame_expression_impl(ctx: DataFrameContext) -> Any: col, lit = ctx.col, ctx.lit return ( ctx.get_table("lineitem") .filter(col("l_orderkey") <= lit(1000)) .sort(["l_orderkey", "l_linenumber"]) .with_columns( ctx.window_sum("l_quantity", partition_by=["l_orderkey"], order_by=[("l_linenumber", True)]).alias( "running_quantity" ) ) .select("l_orderkey", "l_linenumber", "l_quantity", "running_quantity") )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_growing_frame'])For the DataFrame form:
from benchbox.core.query_catalog import get_dataframe_render
print(get_dataframe_render('read_primitives', 'window_growing_frame', family="expression").source) # or family="pandas"Source
Query text: benchbox/core/read_primitives/queries.py