join {SparkR}R Documentation

Join

Description

Join two DataFrames based on the given join expression.

Usage

## S4 method for signature 'DataFrame,DataFrame'
join(x, y, joinExpr = NULL, joinType = NULL)

Arguments

x

A Spark DataFrame

y

A Spark DataFrame

joinExpr

(Optional) The expression used to perform the join. joinExpr must be a Column expression. If joinExpr is omitted, join() wil perform a Cartesian join

joinType

The type of join to perform. The following join types are available: 'inner', 'outer', 'left_outer', 'right_outer', 'semijoin'. The default joinType is "inner".

Value

A DataFrame containing the result of the join operation.

Examples

## Not run: 
##D sc <- sparkR.init()
##D sqlContext <- sparkRSQL.init(sc)
##D df1 <- jsonFile(sqlContext, path)
##D df2 <- jsonFile(sqlContext, path2)
##D join(df1, df2) # Performs a Cartesian
##D join(df1, df2, df1$col1 == df2$col2) # Performs an inner join based on expression
##D join(df1, df2, df1$col1 == df2$col2, "right_outer")
## End(Not run)

[Package SparkR version 1.5.1 Index]