Skip to content

Commit

Permalink
added one more test case.
Browse files Browse the repository at this point in the history
  • Loading branch information
gatorsmile committed Mar 20, 2016
1 parent 96d9d4e commit dddc78b
Showing 1 changed file with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,20 @@ class ReplaceOperatorSuite extends PlanTest {
comparePlans(Optimize.execute(query1.analyze), correctAnswer1)
}

test("continuous Intersect whose children do not contain Distinct") {
val table1 = LocalRelation('a.int, 'b.int)
val table2 = LocalRelation('c.int, 'd.int)
val table3 = LocalRelation('e.int, 'f.int)

// Just need one Distinct for continuous Intersect, even if no child has Distinct.
val query1 = table1.intersect(table2).intersect(table3)
val correctAnswer1 =
table1
.join(table2, LeftSemi, Option('a <=> 'c && 'b <=> 'd)).groupBy('a, 'b)('a, 'b)
.join(table3, LeftSemi, Option('a <=> 'e && 'b <=> 'f)).analyze
comparePlans(Optimize.execute(query1.analyze), correctAnswer1)
}

test("replace Intersect with Left-semi Join whose left is inferred to have distinct values") {
val table1 = LocalRelation('a.int)
val table2 = LocalRelation('c.int, 'd.int)
Expand Down

0 comments on commit dddc78b

Please sign in to comment.