Skip to content

Read Primitives — Decimal Order By

Read Primitives benchmark · all Read Primitives queries

Multi-column sort with mixed ASC/DESC on decimal columns

Representative SQL

Rendered for DataFusion with default parameters.

SELECT
l_orderkey,
l_extendedprice,
l_discount
FROM lineitem
ORDER BY
l_extendedprice DESC,
l_discount ASC,
l_orderkey ASC
LIMIT 100

Representative DataFrame

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

def orderby_decimal_expression_impl(ctx: DataFrameContext) -> Any:
lineitem = ctx.get_table("lineitem")
return (
lineitem.sort(["l_extendedprice", "l_discount", "l_orderkey"], descending=[True, False, False])
.select("l_orderkey", "l_extendedprice", "l_discount")
.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 factor
queries = bench.get_queries(dialect="datafusion") # your platform's dialect; drop dialect= for native SQL
print(queries['orderby_decimal16'])

For the DataFrame form:

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

Source

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