cloud-fan commented on a change in pull request #34580: URL: https://github.com/apache/spark/pull/34580#discussion_r749077669
########## File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/expressions.scala ########## @@ -681,7 +681,9 @@ object PushFoldableIntoBranches extends Rule[LogicalPlan] with PredicateHelper { if supportedUnaryExpression(u) && atMostOneUnfoldable(branches.map(_._2) ++ elseValue) => c.copy( branches.map(e => e.copy(_2 = u.withNewChildren(Array(e._2)))), - elseValue.map(e => u.withNewChildren(Array(e)))) + elseValue + .orElse { if (u.isInstanceOf[IsNull]) Some(Literal(null, c.dataType)) else None } Review comment: Can we optimize away the useless else branch? I think null propagation + removing null else branch should do the work? -- 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: reviews-unsubscr...@spark.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org