sunchao commented on a change in pull request #33930:
URL: https://github.com/apache/spark/pull/33930#discussion_r708768728
##########
File path:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/expressions.scala
##########
@@ -797,6 +834,19 @@ object NullPropagation extends Rule[LogicalPlan] {
// a null literal.
case e: NullIntolerant if e.children.exists(isNullLiteral) =>
Literal.create(null, e.dataType)
+
+ // [SPARK-36665] Unwrap inside of IsNull/IsNotNull if the inside is
NullIntolerant
+ // E.g. IsNull(Not(null)) == IsNull(null)
+ // Cannot apply to `ExtractValue` as the query planner uses the trait to
resolve the columns.
+ // E.g. the planner may resolve column `a` to `a#123`, then
IsNull(a#123) cannot be optimized
+ // UnaryExpression only for now as applying this optimization to other
expressions is too
+ // disruptive for some tests (e.g. [SPARK-32290].) TODO remove
e.isInstanceOf[UnaryExpression]
+ case IsNull(e: NullIntolerant) if e.isInstanceOf[UnaryExpression] &&
+ !e.isInstanceOf[ExtractValue] && e.children.nonEmpty =>
+ e.children.map(IsNull(_): Expression).reduceLeft(Or)
Review comment:
I see. Make sense.
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]