Read Primitives — Predicate Ordering Costs
Read Primitives benchmark · all Read Primitives queries
Order filter predicates by selectivity with result projection only
Representative SQL
Rendered for DataFusion with default parameters.
SELECT *FROM lineitemWHERE l_quantity > 45 AND l_extendedprice > 50000 AND l_discount < 0.05 AND l_shipinstruct = 'DELIVER IN PERSON' AND l_shipmode IN ('AIR', 'AIR REG')LIMIT 100Representative DataFrame
Expression family (Polars, PySpark, DataFusion), default parameters.
def predicate_ordering_costs_expression_impl(ctx: DataFrameContext) -> Any: col, lit = ctx.col, ctx.lit return ( ctx.get_table("lineitem") .filter( (col("l_quantity") > lit(45)) & (col("l_extendedprice") > lit(50000)) & (col("l_discount") < lit(0.05)) & (col("l_shipinstruct") == lit("DELIVER IN PERSON")) & col("l_shipmode").is_in(["AIR", "AIR REG"]) ) .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['predicate_ordering_costs'])For the DataFrame form:
from benchbox.core.query_catalog import get_dataframe_render
print(get_dataframe_render('read_primitives', 'predicate_ordering_costs', family="expression").source) # or family="pandas"Source
Query text: benchbox/core/read_primitives/queries.py