Github user dilipbiswal commented on a diff in the pull request:

    https://github.com/apache/spark/pull/9348#discussion_r43538406
  
    --- Diff: 
sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/optimizer/OptimizeInSuite.scala
 ---
    @@ -82,4 +83,35 @@ class OptimizeInSuite extends PlanTest {
     
         comparePlans(optimized, correctAnswer)
       }
    +
    +  test("OptimizedIn test: NULL IN (expr1, ..., exprN) gets transformed to 
Filter(null)") {
    +    val originalQuery =
    +      testRelation
    +        .where(In(Literal.create(null, NullType), Seq(Literal(1), 
Literal(2))))
    +        .analyze
    +
    +    val optimized = Optimize.execute(originalQuery.analyze)
    +    val correctAnswer =
    +      testRelation
    +        .where(Literal.create(null, BooleanType))
    +        .analyze
    +
    +    comparePlans(optimized, correctAnswer)
    +  }
    +
    +  test("OptimizedIn test: Inset optimization disabled as " +
    +    "list expression contains attribute)") {
    +    val originalQuery =
    +      testRelation
    +        .where(In(Literal.create(null, StringType), Seq(Literal(1), 
UnresolvedAttribute("b"))))
    +        .analyze
    +
    +    val optimized = Optimize.execute(originalQuery.analyze)
    +    val correctAnswer =
    +      testRelation
    +        .where(Literal.create(null, BooleanType))
    +        .analyze
    +
    +    comparePlans(optimized, correctAnswer)
    +  }
    --- End diff --
    
    @yhuai 
    Sure.. I have added the test case. Thanks a lot for reviewing.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to