SortDsl
A specialized Columns Selection DSL for selecting columns to sort rows by and specifying how each column should be sorted.
The Sort DSL allows selecting columns to sort rows by values in these columns. It also allows reversing the sort order for individual columns or column sets, and controlling the position of null values.
The order in which columns are selected determines the sort priority.
By default, all selected columns are sorted in the original order (ascending in sortBy and descending in sortByDesc). Use reversed to impose the reverse ordering for a column or column set.
By default, null values are considered the smallest values when sorting. Use nullsLast to treat them as the largest values.
Examples
// Sort rows by "age" column values ascending
df.sortBy { age }
// Sort rows by "age" column values descending
// and then by the ("name"/"firstName") column values ascending
df.sortBy { age.reversed() and name.firstName }
// Sort rows by "weight" column values ascending with nulls last
df.sortBy { weight.nullsLast() }Sorting values can also be computed inline using expr.
// Sort rows by the product of "volume" and "quantity" descending
df.sortBy { expr { volume * quantity }.reversed() }Properties
Accesses the 'key' column of this KeyValueProperty ColumnsContainer.
Functions
Creates a new ColumnSet that contains a subset of columns from this, containing all columns after column, excluding column itself.
Creates a new ColumnSet that contains a subset of columns from this, containing all columns after column, excluding column itself.
Creates a new ColumnSet that contains a subset of columns from this, containing all columns before column, excluding column itself.
Creates a new ColumnSet that contains a subset of columns from this, containing all columns before column, excluding column itself.
Exclude a selection of columns from the current selection using the Columns Selection DSL.
Creates a new ColumnSet that contains a subset of columns from this, containing all columns from column, including column itself.
Creates a new ColumnSet that contains a subset of columns from this, containing all columns from column, including column itself.
Creates a new ColumnSet that contains a subset of columns from this, containing all columns up to column, including column itself.
Creates a new ColumnSet that contains a subset of columns from this, containing all columns up to column, including column itself.
Exclude a selection of columns from the current selection using the Columns Selection DSL.
The and operator allows you to combine selections of columns or simply select multiple columns at once.
Creates a ColumnAccessor (or SingleColumn) for a column with the given argument which can be either an index (Int) or a reference to a column (String, ColumnPath, KProperty, or ColumnAccessor; any Access APIs).
Creates a ColumnAccessor (or SingleColumn) for a column group with the given argument which can be either an index (Int) or a reference to a column (String, ColumnPath, KProperty, or ColumnAccessor; any Access APIs).
Creates a subset of columns from this that are ColumnGroups.
Creates a subset of columns from this that are ColumnGroups.
Creates a subset of columns from this that are ColumnGroups.
Creates a subset of columns from this that are ColumnGroups.
Creates a subset of columns from this that are ColumnGroups.
Creates a subset of columns from this that are ColumnGroups.
Retrieves multiple columns from this in the form of a ColumnSet by a range of indices. If any of the indices in the range are out of bounds, an IndexOutOfBoundsException is thrown.
Retrieves multiple columns from this in the form of a ColumnSet by a range of indices. If any of the indices in the range are out of bounds, an IndexOutOfBoundsException is thrown.
Retrieves multiple columns from this in the form of a ColumnSet by a range of indices. If any of the indices in the range are out of bounds, an IndexOutOfBoundsException is thrown.
Retrieves multiple columns from this in the form of a ColumnSet by a range of indices. If any of the indices in the range are out of bounds, an IndexOutOfBoundsException is thrown.
Retrieves multiple columns from this in the form of a ColumnSet by a range of indices. If any of the indices in the range are out of bounds, an IndexOutOfBoundsException is thrown.
Retrieves multiple columns from this in the form of a ColumnSet by a range of indices. If any of the indices in the range are out of bounds, an IndexOutOfBoundsException is thrown.
Retrieves one or multiple columns from this in the form of a ColumnSet by their indices. If any of the indices are out of bounds, an IndexOutOfBoundsException is thrown.
Retrieves one or multiple columns from this in the form of a ColumnSet by their indices. If any of the indices are out of bounds, an IndexOutOfBoundsException is thrown.
Retrieves one or multiple columns from this in the form of a ColumnSet by their indices. If any of the indices are out of bounds, an IndexOutOfBoundsException is thrown.
Retrieves one or multiple columns from this in the form of a ColumnSet by their indices. If any of the indices are out of bounds, an IndexOutOfBoundsException is thrown.
Retrieves one or multiple columns from this in the form of a ColumnSet by their indices. If any of the indices are out of bounds, an IndexOutOfBoundsException is thrown.
Retrieves one or multiple columns from this in the form of a ColumnSet by their indices. If any of the indices are out of bounds, an IndexOutOfBoundsException is thrown.
Returns all columns in this at any depth (so also inside Column Groups)
Returns all columns in this at any depth (so also inside Column Groups)
Returns all columns in this at any depth (so also inside Column Groups)
Returns all columns in this at any depth (so also inside Column Groups)
Returns all columns in this at any depth (so also inside Column Groups)
Returns all columns in this at any depth (so also inside Column Groups)
colsInGroups is a function that returns all columns at the top-levels of all column groups in this. This is useful if you want to select all columns that are "one level deeper".
colsInGroups is a function that returns all columns at the top-levels of all column groups in this. This is useful if you want to select all columns that are "one level deeper".
colsInGroups is a function that returns all columns at the top-levels of all column groups in this. This is useful if you want to select all columns that are "one level deeper".
colsInGroups is a function that returns all columns at the top-levels of all column groups in this. This is useful if you want to select all columns that are "one level deeper".
colsInGroups is a function that returns all columns at the top-levels of all column groups in this. This is useful if you want to select all columns that are "one level deeper".
colsInGroups is a function that returns all columns at the top-levels of all column groups in this. This is useful if you want to select all columns that are "one level deeper".
Returns a ColumnSet of columns from this that are a subtype of the given type C, optionally filtered by filter.
Returns a ColumnSet of columns from this that are a subtype of the given type C, optionally filtered by filter.
Creates a subset of columns from this that are of the given kind(s).
Creates a subset of columns from this that are of the given kind(s).
Creates a subset of columns from this that are of the given kind(s).
Creates a subset of columns from this that are of the given kind(s).
Creates a subset of columns from this that are of the given kind(s).
Creates a subset of columns from this that are of the given kind(s).
Exclude a selection of columns from the current selection using the Columns Selection DSL.
Creates a temporary new column by defining an expression to fill up each row.
Returns the first column from this that adheres to the optional given condition. If no column adheres to the given condition, NoSuchElementException is thrown.
Returns the first column from this that adheres to the optional given condition. If no column adheres to the given condition, NoSuchElementException is thrown.
Returns the first column from this that adheres to the optional given condition. If no column adheres to the given condition, NoSuchElementException is thrown.
Returns the first column from this that adheres to the optional given condition. If no column adheres to the given condition, NoSuchElementException is thrown.
Returns the first column from this that adheres to the optional given condition. If no column adheres to the given condition, NoSuchElementException is thrown.
Returns the first column from this that adheres to the optional given condition. If no column adheres to the given condition, NoSuchElementException is thrown.
Creates a ColumnAccessor (or SingleColumn) for a frame column with the given argument which can be either an index (Int) or a reference to a column (String, ColumnPath, KProperty, or ColumnAccessor; any Access APIs).
Creates a subset of columns from this that are FrameColumns.
Creates a subset of columns from this that are FrameColumns.
Creates a subset of columns from this that are FrameColumns.
Creates a subset of columns from this that are FrameColumns.
Creates a subset of columns from this that are FrameColumns.
Creates a subset of columns from this that are FrameColumns.
Creates a ColumnAccessor (or SingleColumn) for a column with the given argument which can be either an index (Int) or a reference to a column (String, ColumnPath, KProperty, or ColumnAccessor; any Access APIs).
Retrieves multiple columns from this in the form of a ColumnSet by a range of indices. If any of the indices in the range are out of bounds, an IndexOutOfBoundsException is thrown.
Retrieves one or multiple columns from this in the form of a ColumnSet by their indices. If any of the indices are out of bounds, an IndexOutOfBoundsException is thrown.
Creates a ColumnPath from the receiver and the given column name column. This is a shorthand for pathOf("myColumnName", "myNestedColumnName") and is often used in combination with ColumnPath.invoke to retrieve the value of a nested column. For instance:
Retrieves the value of this KProperty Accessor from the DataFrame.
As extension to "myColumn"["myNestedColumn"], this function enables "myColumn"["myNestedColumn"]["myDoublyNestedColumn"] as alternative to pathOf("myColumn", "myNestedColumn", "myDoublyNestedColumn")
Renaming a column in the ColumnsSelectionDsl is done by calling the infix functions named or into. They behave exactly the same, so it's up to contextual preference which one to use. Any combination of Access APIs can be used to specify the column to rename and which name should be used instead.
Retrieves the value of the column with this name from the DataFrame. This can be both typed and untyped. This is a shorthand for get("myColumnName") and can be written as "myColumnName"<MyColumnType>() instead.
Retrieves the value of the column with this name from the DataFrame. This can be both typed and untyped. This is a shorthand for get("myColumnName") and can be written as "myColumnName"() instead.
Retrieves the value of this KProperty Accessor from the DataFrame.
Retrieves the value of this ColumnPath from the DataFrame. This is a shorthand for getColumn(myColumnPath) and is most often used in combination with operator fun String.get(column: String), for instance:
Retrieves the value of this ColumnReference or -Accessor from the DataFrame.
Invokes the given ColumnsSelector using this ColumnsSelectionDsl.
Perform a selection of columns using the Columns Selection DSL on any ColumnGroup. This is more powerful than the cols filter, because now all operations of the DSL are at your disposal.
Returns the last column from this that adheres to the optional given condition. If no column adheres to the given condition, NoSuchElementException is thrown.
Returns the last column from this that adheres to the optional given condition. If no column adheres to the given condition, NoSuchElementException is thrown.
Returns the last column from this that adheres to the optional given condition. If no column adheres to the given condition, NoSuchElementException is thrown.
Returns the last column from this that adheres to the optional given condition. If no column adheres to the given condition, NoSuchElementException is thrown.
Returns the last column from this that adheres to the optional given condition. If no column adheres to the given condition, NoSuchElementException is thrown.
Returns the last column from this that adheres to the optional given condition. If no column adheres to the given condition, NoSuchElementException is thrown.
Returns a new DataColumn with the given name and the values that body computes from the rows of this ColumnsContainer.
Renaming a column in the ColumnsSelectionDsl is done by calling the infix functions named or into. They behave exactly the same, so it's up to contextual preference which one to use. Any combination of Access APIs can be used to specify the column to rename and which name should be used instead.
Creates an empty ColumnsResolver / ColumnSet, essentially selecting no columns at all.
Places null values after non-null values when sorting in ascending order, or before non-null values when sorting in descending order by this column.
Places null values after non-null values when sorting in ascending order, or before non-null values when sorting in descending order by these columns.
Creates a ColumnSet containing all columns from this up to (and including) endInclusive.
Creates a ColumnSet containing all columns from this up to (and including) endInclusive.
Creates a ColumnSet containing all columns from this up to (and including) endInclusive.
Marks the selected column to be sorted in reversed order.
Marks the selected columns to be sorted in reversed order.
Perform a selection of columns using the Columns Selection DSL on any ColumnGroup. This is more powerful than the cols filter, because now all operations of the DSL are at your disposal.
Returns the single column from this. If there is no column, NoSuchElementException is thrown. If there are multiple columns, IllegalArgumentException is thrown.
Returns the single column from this. If there is no column, NoSuchElementException is thrown. If there are multiple columns, IllegalArgumentException is thrown.
Returns the single column from this. If there is no column, NoSuchElementException is thrown. If there are multiple columns, IllegalArgumentException is thrown.
Returns the single column from this. If there is no column, NoSuchElementException is thrown. If there are multiple columns, IllegalArgumentException is thrown.
Returns the single column from this. If there is no column, NoSuchElementException is thrown. If there are multiple columns, IllegalArgumentException is thrown.
Returns the single column from this. If there is no column, NoSuchElementException is thrown. If there are multiple columns, IllegalArgumentException is thrown.
Creates a ColumnAccessor (or SingleColumn) for a value column with the given argument which can be either an index (Int) or a reference to a column (String, ColumnPath, KProperty, or ColumnAccessor; any Access APIs).
Creates a subset of columns from this that are ValueColumns.
Creates a subset of columns from this that are ValueColumns.
Creates a subset of columns from this that are ValueColumns.
Creates a subset of columns from this that are ValueColumns.
Creates a subset of columns from this that are ValueColumns.
Creates a subset of columns from this that are ValueColumns.