Skip to content

Read Primitives — Descending Order By

Read Primitives benchmark · all Read Primitives queries

ORDER BY with descending sort

Representative SQL

Rendered for DataFusion with default parameters.

SELECT
o_orderkey,
o_totalprice,
o_orderdate
FROM orders
ORDER BY
o_totalprice DESC
LIMIT 100

Representative DataFrame

Expression family (Polars, PySpark, DataFusion), default parameters.

def expression_impl(ctx: DataFrameContext) -> Any:
result = _select_sort_limit(ctx.get_table(table_name), cols, sort, desc, distinct=distinct)
return _limit(result, limit)

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 factor
queries = bench.get_queries(dialect="datafusion") # your platform's dialect; drop dialect= for native SQL
print(queries['orderby_desc'])

For the DataFrame form:

from benchbox.core.query_catalog import get_dataframe_render
print(get_dataframe_render('read_primitives', 'orderby_desc', family="expression").source) # or family="pandas"

Source

Query text: benchbox/core/read_primitives/queries.py