Skip to content

Commit

Permalink
test the various join types in a single test case.
Browse files Browse the repository at this point in the history
  • Loading branch information
gengliangwang committed Sep 27, 2017
1 parent 0f25a07 commit b721017
Showing 1 changed file with 6 additions and 22 deletions.
28 changes: 6 additions & 22 deletions sql/core/src/test/scala/org/apache/spark/sql/JoinSuite.scala
Original file line number Diff line number Diff line change
Expand Up @@ -200,28 +200,12 @@ class JoinSuite extends QueryTest with SharedSQLContext {
Nil)
}

test("inner join, propagate empty relation before checking Cartesian products") {
val x = testData2.as("x")
val y = testData2.where($"a" === 2 && !($"a" === 2)).as("y")
checkAnswer(
x.join(y).where($"x.a" === $"y.a"),
Nil)
}

test("left outer join, propagate empty relation before checking Cartesian products") {
val x = testData2.where($"a" === 2 && !($"a" === 2)).as("x")
val y = testData2.as("y")
checkAnswer(
x.join(y, Seq.empty, "left_outer"),
Nil)
}

test("right outer join, propagate empty relation before checking Cartesian products") {
val x = testData2.as("x")
val y = testData2.where($"a" === 2 && !($"a" === 2)).as("y")
checkAnswer(
x.join(y, Seq.empty, "right_outer"),
Nil)
test("SPARK-22141: Propagate empty relation before checking Cartesian products") {
Seq("inner", "left", "right", "left_outer", "right_outer", "full_outer").foreach { joinType =>
val x = testData2.where($"a" === 2 && !($"a" === 2)).as("x")
val y = testData2.where($"a" === 1 && !($"a" === 1)).as("y")
checkAnswer(x.join(y, Seq.empty, joinType), Nil)
}
}

test("big inner join, 4 matches per row") {
Expand Down

0 comments on commit b721017

Please sign in to comment.