innerJoin

fun <A, B> DataFrame<A>.innerJoin(other: DataFrame<B>, selector: JoinColumnsSelector<A, B>? = null): DataFrame<A>

Performs an inner join of this DataFrame with the other DataFrame using the selected key columns. Includes only matching rows from both DataFrames; rows are merged.

This is a shortcut for join with JoinType.Inner.

If no join columns are specified, all columns with matching names in both DataFrames are used.

If both DataFrames contain columns with the same name that are not part of the join keys, such columns are treated as distinct. Such a column from the right DataFrame will be automatically renamed in the resulting DataFrame.

See also general join, as well as the shortcuts for the other join types: leftJoin, rightJoin, fullJoin, filterJoin, excludeJoin.

This can include column groups and nested columns.

See Selecting Columns.

For more information, See join on the documentation website.

This innerJoin overload

Select join columns (including those that have different names in different DataFrames) using JoinDsl.

JoinDsl allows you to define the columns used for joining DataFrames and provides methods to match columns with different names between the left and right side.

Provides the left DataFrame both as the receiver (this) and as the argument (it), allowing you to reference its columns directly. Use right to access columns from the right DataFrame, and match to explicitly pair columns with different names.

See also Columns selection via DSL.

For more information: See join on the documentation website.

Examples

// Join by two columns with the same names in both dataframes
dfLeft.join(dfRight) { name and city }

// Join by one column with different names —
// "firstName" in the left dataframe and "name" in the right one
dfLeft.join(dfRight) { left -> left.firstName match right.name }

// Match columns using String API
dfLeft.join(dfRight) { "symbol" match right.getValue<Char>("char") }

Return

joined DataFrame.

Parameters

other

DataFrame to join with.

selector

JoinColumnsSelector specifying join columns; if null, same-name columns are used.


fun <A, B> DataFrame<A>.innerJoin(other: DataFrame<B>, vararg columns: String): DataFrame<A>

Performs an inner join of this DataFrame with the other DataFrame using the selected key columns. Includes only matching rows from both DataFrames; rows are merged.

This is a shortcut for join with JoinType.Inner.

If no join columns are specified, all columns with matching names in both DataFrames are used.

If both DataFrames contain columns with the same name that are not part of the join keys, such columns are treated as distinct. Such a column from the right DataFrame will be automatically renamed in the resulting DataFrame.

See also general join, as well as the shortcuts for the other join types: leftJoin, rightJoin, fullJoin, filterJoin, excludeJoin.

This can include column groups and nested columns.

See Selecting Columns.

For more information, See join on the documentation website.

This innerJoin overload

Select single or multiple columns using their names as Strings. (String API).

Example

// Join by two columns with the same names in both dataframes
dfLeft.join(dfRight, "name", "city")

Return

joined DataFrame.

Parameters

other

DataFrame to join with.

columns

Column Names specifying join columns.