Read Primitives — Array Min/Max
Read Primitives benchmark · all Read Primitives queries
Get min and max from array
Representative SQL
Rendered in the benchmark’s native SQL with default parameters (no dialect translation available).
WITH order_prices AS ( SELECT o_custkey, ARRAY_AGG(o_totalprice) AS prices FROM orders GROUP BY o_custkey)SELECT o_custkey, ARRAY_MIN(prices) AS min_order, ARRAY_MAX(prices) AS max_orderFROM order_pricesORDER BY o_custkeyLIMIT 100Representative DataFrame
Expression family (Polars, PySpark, DataFusion), default parameters.
def array_min_max_expression_impl(ctx: DataFrameContext) -> Any: col = ctx.col
return ( _expr_grouped_list(ctx, "orders", "o_custkey", "o_totalprice", "prices") .with_columns(col("prices").list.min().alias("min_order"), col("prices").list.max().alias("max_order")) .select("o_custkey", "min_order", "max_order") .sort("o_custkey") .limit(100) )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['array_min_max'])For the DataFrame form:
from benchbox.core.query_catalog import get_dataframe_render
print(get_dataframe_render('read_primitives', 'array_min_max', family="expression").source) # or family="pandas"Source
Query text: benchbox/core/read_primitives/queries.py