Read Primitives — List Filter
Read Primitives benchmark · all Read Primitives queries
Filter array elements by condition
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, FILTER(prices, x -> x > 100000) AS large_ordersFROM order_pricesORDER BY o_custkeyLIMIT 100Representative DataFrame
Expression family (Polars, PySpark, DataFusion), default parameters.
def list_filter_expression_impl(ctx: DataFrameContext) -> Any: col = ctx.col lit = ctx.lit elem = ctx.element()
return ( _expr_grouped_list(ctx, "orders", "o_custkey", "o_totalprice", "prices") .with_columns(col("prices").list.eval(elem.filter(elem > lit(100000))).alias("large_orders")) .select("o_custkey", "large_orders") .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['list_filter'])For the DataFrame form:
from benchbox.core.query_catalog import get_dataframe_render
print(get_dataframe_render('read_primitives', 'list_filter', family="expression").source) # or family="pandas"Source
Query text: benchbox/core/read_primitives/queries.py