Skip to content

Commit

Permalink
Support to specify join type when calling join with usingColumns.
Browse files Browse the repository at this point in the history
  • Loading branch information
viirya committed Sep 4, 2015
1 parent cf42138 commit 5ab4846
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions sql/core/src/main/scala/org/apache/spark/sql/DataFrame.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -502,7 +503,7 @@ class DataFrame private[sql](
Join(
joined.left,
joined.right,
joinType = Inner,
joinType = JoinType(joinType),
condition)
)
}
Expand Down

0 comments on commit 5ab4846

Please sign in to comment.