sigmod commented on a change in pull request #32280:
URL: https://github.com/apache/spark/pull/32280#discussion_r618930570



##########
File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/expressions.scala
##########
@@ -740,8 +751,10 @@ object NullPropagation extends Rule[LogicalPlan] {
     case _ => false
   }
 
-  def apply(plan: LogicalPlan): LogicalPlan = plan transform {
-    case q: LogicalPlan => q transformExpressionsUp {
+  def apply(plan: LogicalPlan): LogicalPlan = plan.transformWithPruning(
+    _.containsAnyPattern(NULL_CHECK, NULL_LITERAL, COUNT, CAST), ruleId) {

Review comment:
       I tried to capture the first case:
    case e @ WindowExpression(Cast(Literal(0L, _), _, _), _)
   
   I'm not sure why this pattern is related to NullPropagation, but that seems 
a separate issue.
   I updated the condition to be more restrictive since CAST may be common in 
certain queries:
   
   t.containsAnyPattern(NULL_CHECK, NULL_LITERAL, COUNT)
           || t.containsAllPatterns(WINDOW_EXPRESSION, CAST, LITERAL)




-- 
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]



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

Reply via email to