Skip to content

Flags the expression as "sorted"

Description

Enables downstream code to user fast paths for sorted arrays.

Warning: This can lead to incorrect results if the data is NOT sorted!! Use with care!

Usage

<Expr>$set_sorted(..., descending = FALSE)

Arguments

These dots are for future extensions and must be empty.
descending Whether the Series order is descending.

Value

A polars expression

Examples

library("polars")

df <- pl$DataFrame(a = 1:3)
df$select(pl$col("a")$set_sorted()$max())
#> shape: (1, 1)
#> ┌─────┐
#> │ a   │
#> │ --- │
#> │ i32 │
#> ╞═════╡
#> │ 3   │
#> └─────┘