Skip to contents

Joins two SparkDataFrames based on the given join expression.

Usage

# S4 method for SparkDataFrame,SparkDataFrame
join(x, y, joinExpr = NULL, joinType = NULL)

Arguments

x

A SparkDataFrame

y

A SparkDataFrame

joinExpr

(Optional) The expression used to perform the join. joinExpr must be a Column expression. If joinExpr is omitted, the default, inner join is attempted and an error is thrown if it would be a Cartesian Product. For Cartesian join, use crossJoin instead.

joinType

The type of join to perform, default 'inner'. Must be one of: 'inner', 'cross', 'outer', 'full', 'fullouter', 'full_outer', 'left', 'leftouter', 'left_outer', 'right', 'rightouter', 'right_outer', 'semi', 'leftsemi', 'left_semi', 'anti', 'leftanti', 'left_anti'.

Value

A SparkDataFrame containing the result of the join operation.

Note

join since 1.4.0

Examples

if (FALSE) {
sparkR.session()
df1 <- read.json(path)
df2 <- read.json(path2)
join(df1, df2, df1$col1 == df2$col2) # Performs an inner join based on expression
join(df1, df2, df1$col1 == df2$col2, "right_outer")
join(df1, df2) # Attempts an inner join
}