Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ulysses-you committed Jul 7, 2020
1 parent bbf63c9 commit 0d982d2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -230,8 +230,9 @@ object ReorderAssociativeOperator extends Rule[LogicalPlan] {
* Optimize IN predicates:
* 1. Converts the predicate to false when the list is empty and
* the value is not nullable.
* 2. Removes literal repetitions.
* 3. Replaces [[In (value, seq[Literal])]] with optimized version
* 2. Extract convertible part from list.
* 3. Removes literal repetitions.
* 4. Replaces [[In (value, seq[Literal])]] with optimized version
* [[InSet (value, HashSet[Literal])]] which is much faster.
*/
object OptimizeIn extends Rule[LogicalPlan] {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,21 +91,6 @@ class OptimizeInSuite extends PlanTest {
comparePlans(optimized, correctAnswer)
}

test("OptimizedIn test: In clause not optimized in case filter has attributes") {
val originalQuery =
testRelation
.where(In(UnresolvedAttribute("a"), Seq(Literal(1), Literal(2), UnresolvedAttribute("b"))))
.analyze

val optimized = Optimize.execute(originalQuery.analyze)
val correctAnswer =
testRelation
.where(In(UnresolvedAttribute("a"), Seq(Literal(1), Literal(2), UnresolvedAttribute("b"))))
.analyze

comparePlans(optimized, correctAnswer)
}

test("OptimizedIn test: NULL IN (expr1, ..., exprN) gets transformed to Filter(null)") {
val originalQuery =
testRelation
Expand Down

0 comments on commit 0d982d2

Please sign in to comment.