Skip to content

Commit 8ff97ed

Browse files
committed
Add unit test.
1 parent 5ab4846 commit 8ff97ed

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

sql/core/src/test/scala/org/apache/spark/sql/DataFrameJoinSuite.scala

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,19 @@ class DataFrameJoinSuite extends QueryTest with SharedSQLContext {
4242
Row(1, 2, "1", "2") :: Row(2, 3, "2", "3") :: Row(3, 4, "3", "4") :: Nil)
4343
}
4444

45+
test("join - join using multiple columns and specifying join type") {
46+
val df = Seq(1, 2, 3).map(i => (i, i + 1, i.toString)).toDF("int", "int2", "str")
47+
val df2 = Seq(1, 2, 3).map(i => (i, i + 1, (i + 1).toString)).toDF("int", "int2", "str")
48+
49+
checkAnswer(
50+
df.join(df2, Seq("int", "str"), "left"),
51+
Row(1, 2, "1", null) :: Row(2, 3, "2", null) :: Row(3, 4, "3", null) :: Nil)
52+
53+
checkAnswer(
54+
df.join(df2, Seq("int", "str"), "right"),
55+
Row(null, null, null, 2) :: Row(null, null, null, 3) :: Row(null, null, null, 4) :: Nil)
56+
}
57+
4558
test("join - join using self join") {
4659
val df = Seq(1, 2, 3).map(i => (i, i.toString)).toDF("int", "str")
4760

0 commit comments

Comments
 (0)