Read Primitives — Long Predicate
Read Primitives benchmark · all Read Primitives queries
Query with many conjunctive predicates across multiple tables
Representative SQL
Rendered for DataFusion with default parameters.
SELECT COUNT(*)FROM lineitem AS lJOIN orders AS o ON l.l_orderkey = o.o_orderkeyJOIN customer AS c ON o.o_custkey = c.c_custkeyWHERE l.l_shipdate >= CAST('1994-01-01' AS DATE) AND l.l_shipdate < CAST('1995-01-01' AS DATE) AND l.l_discount BETWEEN 0.05 AND 0.07 AND l.l_quantity < 24 AND o.o_orderpriority = '1-URGENT' AND c.c_mktsegment = 'BUILDING' AND l.l_returnflag = 'R' AND l.l_linestatus = 'F' AND o.o_totalprice > 100000 AND c.c_nationkey IN (1, 2, 3, 4, 5)Representative DataFrame
Expression family (Polars, PySpark, DataFusion), default parameters.
def long_predicate_expression_impl(ctx: DataFrameContext) -> Any: col, lit = ctx.col, ctx.lit return ( ctx.get_table("lineitem") .join(ctx.get_table("orders"), left_on="l_orderkey", right_on="o_orderkey") .join(ctx.get_table("customer"), left_on="o_custkey", right_on="c_custkey") .filter( (col("l_shipdate") >= lit(date(1994, 1, 1))) & (col("l_shipdate") < lit(date(1995, 1, 1))) & (col("l_discount") >= lit(0.05)) & (col("l_discount") <= lit(0.07)) & (col("l_quantity") < lit(24)) & (col("o_orderpriority") == lit("1-URGENT")) & (col("c_mktsegment") == lit("BUILDING")) & (col("l_returnflag") == lit("R")) & (col("l_linestatus") == lit("F")) & (col("o_totalprice") > lit(100000)) & col("c_nationkey").is_in([1, 2, 3, 4, 5]) ) .select(col("l_orderkey").count().alias("count")) )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['long_predicate'])For the DataFrame form:
from benchbox.core.query_catalog import get_dataframe_render
print(get_dataframe_render('read_primitives', 'long_predicate', family="expression").source) # or family="pandas"Source
Query text: benchbox/core/read_primitives/queries.py