Read Primitives — Optimizer: Column Pruning
Read Primitives benchmark · all Read Primitives queries
Test column pruning at scan
Representative SQL
Rendered for DataFusion with default parameters.
SELECT c.c_nameFROM customer AS cJOIN orders AS o ON c.c_custkey = o.o_custkeyJOIN lineitem AS l ON o.o_orderkey = l.l_orderkeyWHERE o.o_orderdate >= CAST('1995-01-01' AS DATE) AND o.o_orderdate < CAST('1996-01-01' AS DATE) AND l.l_quantity > 40 AND c.c_nationkey = 15ORDER BY c.c_nameLIMIT 500Representative DataFrame
Expression family (Polars, PySpark, DataFusion), default parameters.
def optimizer_column_pruning_expression_impl(ctx: DataFrameContext) -> Any: customer, orders, lineitem = _tables(ctx, "customer", "orders", "lineitem") col = ctx.col lit = ctx.lit
return ( customer.join(orders, col("c_custkey") == col("o_custkey")) .join(lineitem, col("o_orderkey") == col("l_orderkey")) .filter(col("o_orderdate") >= lit(date(1995, 1, 1))) .filter(col("o_orderdate") < lit(date(1996, 1, 1))) .filter(col("l_quantity") > lit(40)) .filter(col("c_nationkey") == lit(15)) .select("c_name") .sort("c_name") .limit(500) )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['optimizer_column_pruning'])For the DataFrame form:
from benchbox.core.query_catalog import get_dataframe_render
print(get_dataframe_render('read_primitives', 'optimizer_column_pruning', family="expression").source) # or family="pandas"Source
Query text: benchbox/core/read_primitives/queries.py