Read Primitives — Count Star
Read Primitives benchmark · all Read Primitives queries
Metadata-based count optimization vs full table scan
Representative SQL
Rendered for DataFusion with default parameters.
SELECT COUNT(*) AS total_lineitemsFROM lineitemRepresentative DataFrame
Expression family (Polars, PySpark, DataFusion), default parameters.
def count_star_expression_impl(ctx: DataFrameContext) -> Any: return ctx.get_table("lineitem").select(ctx.col("l_orderkey").count().alias("total_lineitems"))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['count_star'])For the DataFrame form:
from benchbox.core.query_catalog import get_dataframe_render
print(get_dataframe_render('read_primitives', 'count_star', family="expression").source) # or family="pandas"Source
Query text: benchbox/core/read_primitives/queries.py