distinct

open fun <C> ColumnSet<C>.distinct(): ColumnSet<C>

Returns a new ColumnSet from this ColumnSet containing only distinct columns (by path). This is useful when you've selected the same column multiple times but only want it once.

This doesn't solve DuplicateColumnNamesException if you've selected two columns with the same name. For this, you'll need to rename one of the columns.

For more information: See distinct in the Columns Selection DSL on the documentation website.

See also Grammar, named, simplify.

Examples

df.select { (colsOf<Int>() and age).distinct() }
df.select { colsAtAnyDepth().nameStartsWith("order").distinct() }

Return

A new ColumnSet containing only distinct columns (by path).