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

    https://github.com/apache/spark/pull/13216#discussion_r64697298
  
    --- Diff: 
sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/optimizer/TypedFilterOptimizationSuite.scala
 ---
    @@ -34,40 +35,47 @@ class TypedFilterOptimizationSuite extends PlanTest {
           Batch("EliminateSerialization", FixedPoint(50),
             EliminateSerialization) ::
           Batch("EmbedSerializerInFilter", FixedPoint(50),
    -        EmbedSerializerInFilter) :: Nil
    +        EmbedSerializerInFilter,
    +        RemoveAliasOnlyProject,
    +        CombineFilters) :: Nil
       }
     
       implicit private def productEncoder[T <: Product : TypeTag] = 
ExpressionEncoder[T]()
     
    -  test("back to back filter") {
    +  test("embed deserializer in filter condition if there is only one 
filter") {
         val input = LocalRelation('_1.int, '_2.int)
    -    val f1 = (i: (Int, Int)) => i._1 > 0
    -    val f2 = (i: (Int, Int)) => i._2 > 0
    +    val f = (i: (Int, Int)) => i._1 > 0
     
    -    val query = input.filter(f1).filter(f2).analyze
    +    val query = input.filter(f).analyze
     
         val optimized = Optimize.execute(query)
     
    -    val expected = input.deserialize[(Int, Int)]
    -      .where(callFunction(f1, BooleanType, 'obj))
    -      .select('obj.as("obj"))
    -      .where(callFunction(f2, BooleanType, 'obj))
    -      .serialize[(Int, Int)].analyze
    +    val deserializer = input.deserialize[(Int, Int)].analyze
    +      .asInstanceOf[DeserializeToObject].deserializer
    +    val boundReference = BoundReference(0, deserializer.dataType, nullable 
= false)
    +    val callFunc = callFunction(f, BooleanType, boundReference)
    +    val condition = ReferenceToExpressions(callFunc, deserializer :: Nil)
    +    val expected = input.where(condition).analyze
     
         comparePlans(optimized, expected)
       }
     
    -  test("embed deserializer in filter condition if there is only one 
filter") {
    +  test("embed deserializer in filter condition if there are two filters") {
    --- End diff --
    
    Shall we add a new test case instead of replacing the original one?


---
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 [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to