Ngone51 commented on a change in pull request #23651: [SPARK-26730][SQL] Strip 
redundant AssertNotNull for ExpressionEncoder's serializer
URL: https://github.com/apache/spark/pull/23651#discussion_r251792619
 
 

 ##########
 File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/encoders/ExpressionEncoder.scala
 ##########
 @@ -192,6 +192,9 @@ case class ExpressionEncoder[T](
 
     if (isSerializedAsStructForTopLevel) {
       val nullSafeSerializer = objSerializer.transformUp {
+        case _ @ AssertNotNull(a: AssertNotNull, _) =>
+          // strip redundant AssertNotNull
+          a
         case r: BoundReference =>
 
 Review comment:
   Hi, @cloud-fan . Thanks for your suggestion. Yeah, this actually could be an 
equivalent solution.  But, we may lost `walkedTypePath`(though, current fix 
lost it, either) info, would it be OK ?
   
   
   
    > `expressions.If(IsNull(inputObject), nullOutput, nonNullOutput)`
   So inputObject can't be null already
   
   Not sure I got your point clearly. Just to be clarify, we'll strip `If` 
expression later after we added `AssertNotNull` expression:
   
   ```
   nullSafeSerializer match {
     case If(_: IsNull, _, s: CreateNamedStruct) => s
     case _ =>
        throw new RuntimeException(s"class $clsName has unexpected serializer: 
$objSerializer")
   }
   ```
   So, it seems not appropriate to say `already` at this point(wihout 
`AssertNotNull`), or maybe I misunderstand your opinion.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

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

Reply via email to