sort

The sort method returns a new PartitionedTable in which the rows are ordered based on values in a specified set of columns.

Warning

A partitioned table cannot be sorted on its __CONSTITUENT__ column.

Syntax

Parameters

ParameterTypeDescription
order_byUnion[str, Sequence[str]]

The column(s) to be sorted on. Cannot include the __CONSTITUENT__ column.

orderUnion[SortDirection, Sequence[SortDirection]]

The sort order(s). Default is SortDirection.ASCENDING.

Returns

A sorted PartitionedTable.

Examples

The following example partitions a source table on a single column. The partitioned table is then sorted on that key column in descending order.

The following example partitions a source table on two columns. The partitioned table is then sorted in ascending order on Exchange and descending order on Coin.