From 5ab4846852723d1c3505223e18c41dbf7bc40fa0 Mon Sep 17 00:00:00 2001 From: Liang-Chi Hsieh Date: Fri, 4 Sep 2015 17:43:35 +0800 Subject: [PATCH] Support to specify join type when calling join with usingColumns. --- sql/core/src/main/scala/org/apache/spark/sql/DataFrame.scala | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sql/core/src/main/scala/org/apache/spark/sql/DataFrame.scala b/sql/core/src/main/scala/org/apache/spark/sql/DataFrame.scala index 791c10c3d7ce7..5f0b0c6977efe 100644 --- a/sql/core/src/main/scala/org/apache/spark/sql/DataFrame.scala +++ b/sql/core/src/main/scala/org/apache/spark/sql/DataFrame.scala @@ -480,10 +480,11 @@ class DataFrame private[sql]( * * @param right Right side of the join operation. * @param usingColumns Names of the columns to join on. This columns must exist on both sides. + * @param joinType One of: (default)`inner`, `outer`, `left_outer`, `right_outer`, `leftsemi`. * @group dfops * @since 1.4.0 */ - def join(right: DataFrame, usingColumns: Seq[String]): DataFrame = { + def join(right: DataFrame, usingColumns: Seq[String], joinType: String = "inner"): DataFrame = { // Analyze the self join. The assumption is that the analyzer will disambiguate left vs right // by creating a new instance for one of the branch. val joined = sqlContext.executePlan( @@ -502,7 +503,7 @@ class DataFrame private[sql]( Join( joined.left, joined.right, - joinType = Inner, + joinType = JoinType(joinType), condition) ) }