maropu commented on a change in pull request #25878: [SPARK-29162][SQL]Simplify 
NOT(IsNull(x)) and NOT(IsNotNull(x))
URL: https://github.com/apache/spark/pull/25878#discussion_r326878605
 
 

 ##########
 File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/expressions.scala
 ##########
 @@ -556,6 +556,9 @@ object NullPropagation extends Rule[LogicalPlan] {
       // a null literal.
       case e: NullIntolerant if e.children.exists(isNullLiteral) =>
         Literal.create(null, e.dataType)
+
+      case n@Not(expr: IsNull) => IsNotNull(expr.child)
+      case n@Not(expr: IsNotNull) => IsNull(expr.child)
 
 Review comment:
   Yea, the @viirya suggestion looks nice to me.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to 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