Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Support to specify join type when calling join with usingColumns.
  • Loading branch information
viirya committed Sep 4, 2015
commit 5ab4846852723d1c3505223e18c41dbf7bc40fa0
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 = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We cannot use default parameter values in order to maintain compatibility with Java. You can add an extra method.

// 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