single

open fun <C> ColumnSet<C>.single(): SingleColumn<C>

Single (Col)

Returns the single column from this. If there is no column, NoSuchElementException is thrown. If there are multiple columns, IllegalArgumentException is thrown.

This function operates solely on columns at the top-level.

NOTE: For column groups, single is named singleCol instead to avoid confusion.

For more information: See First (Col), Last (Col), Single (Col) on the documentation website.

Check out: Grammar

Examples:

df.select{ nameStartsWith("order").single() }

df.select{ "myColumnGroup".colsNameStartsWith("order").singleCol() }

Examples for this overload:

df.select{ colsOf<String>().nameStartsWith("year").single() }

df.select{ colsOf<Int>().single() }

Return

A SingleColumn containing the single column.

Throws

if there are no columns in this.

if there is more than one column in this.


Single (Col)

Returns the single column from this. If there is no column, NoSuchElementException is thrown. If there are multiple columns, IllegalArgumentException is thrown.

This function operates solely on columns at the top-level.

NOTE: For column groups, single is named singleCol instead to avoid confusion.

For more information: See First (Col), Last (Col), Single (Col) on the documentation website.

Check out: Grammar

Examples:

df.select{ nameStartsWith("order").single() }

df.select{ "myColumnGroup".colsNameStartsWith("order").singleCol() }

Examples for this overload:

df.select{ nameStartsWith("year").single() }

Return

A SingleColumn containing the single column.

Throws

if there are no columns in this.

if there is more than one column in this.


open fun <C> ColumnSet<C>.single(condition: (ColumnWithPath<C>) -> Boolean = { true }): SingleColumn<C>

Deprecated

Deprecated shortcut for better compiler plugin support. Will be ERROR in 1.1.

Replace with

this.filter(condition).single()

Single (Col)

Returns the single column from this. If there is no column, NoSuchElementException is thrown. If there are multiple columns, IllegalArgumentException is thrown.

This function operates solely on columns at the top-level.

NOTE: For column groups, single is named singleCol instead to avoid confusion.

For more information: See First (Col), Last (Col), Single (Col) on the documentation website.

Check out: Grammar

Examples:

df.select{ nameStartsWith("order").single() }

df.select{ "myColumnGroup".colsNameStartsWith("order").singleCol() }

Examples for this overload:

df.select{ colsOf<String>().single{ it.name().startsWith("year") } }

df.select{ colsOf<Int>().single() }

Return

A SingleColumn containing the single column.

Throws

if there are no columns in this.

if there is more than one column in this.


open fun ColumnsSelectionDsl<*>.single(condition: (ColumnWithPath<*>) -> Boolean = { true }): SingleColumn<*>

Deprecated

Deprecated shortcut for better compiler plugin support. Will be ERROR in 1.1.

Replace with

this.cols().filter(condition).single()

Single (Col)

Returns the single column from this. If there is no column, NoSuchElementException is thrown. If there are multiple columns, IllegalArgumentException is thrown.

This function operates solely on columns at the top-level.

NOTE: For column groups, single is named singleCol instead to avoid confusion.

For more information: See First (Col), Last (Col), Single (Col) on the documentation website.

Check out: Grammar

Examples:

df.select{ nameStartsWith("order").single() }

df.select{ "myColumnGroup".colsNameStartsWith("order").singleCol() }

Examples for this overload:

df.select{ single{ it.name().startsWith("year") } }

Return

A SingleColumn containing the single column.

Throws

if there are no columns in this.

if there is more than one column in this.