sortByColumns

fun sortByColumns(dataFrameLike: Any?, columnPaths: List<List<String>>, desc: List<Boolean>): AnyFrame

Sorts a dataframe-like object by multiple columns. If a column type is not comparable, sorting by string representation is applied instead. Sorts DataFrames by their size because looking at the smallest / biggest groups after groupBy is very popular.

Returns a "lazily materialized" dataframe, which means a get, getRows, or take operation must be applied to turn it into a valid sorted dataframe. "lazily materialized" - after sorting 1 million rows and given the page size = 100, a dataframe with only 100 rows is created.

Return

The sorted dataframe.

Parameters

dataFrameLike

The dataframe-like object to sort.

columnPaths

The list of columns to sort by. Each element in the list represents a column path.

desc

The list of booleans indicating whether each column should be sorted in descending order. The size of this list should be the same as the size of the columnPaths list.

Throws

if dataFrameLike is null.


fun sortByColumns(df: AnyFrame, columnPaths: List<List<String>>, isDesc: List<Boolean>): AnyFrame

Sorts a dataframe by multiple columns with specified sorting order for each column. If a column type is not comparable, sorting by string representation is applied instead.

Return

The sorted dataframe.

Parameters

df

The dataframe to be sorted.

columnPaths

A list of column paths where each path is a list of strings representing the hierarchical path of the column.

isDesc

A list of boolean values indicating whether each column should be sorted in descending order; true for descending, false for ascending. The size of this list should match the size of columnPaths.