cloud-fan commented on code in PR #36850:
URL: https://github.com/apache/spark/pull/36850#discussion_r965411787


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/expressions.scala:
##########
@@ -205,10 +205,14 @@ object ConstantPropagation extends Rule[LogicalPlan] {
     def replaceConstants0(expression: Expression) = expression transform {
       case a: AttributeReference => constantsMap.getOrElse(a, a)
     }
-    condition transform {
-      case e @ EqualTo(_, _) if !predicates.contains(e) => replaceConstants0(e)
-      case e @ EqualNullSafe(_, _) if !predicates.contains(e) => 
replaceConstants0(e)
-    }
+    splitConjunctivePredicates(condition).map {
+      // Don't replace constants in IsNotNull because 
InferFiltersFromConstraints may infer
+      // another IsNotNull
+      case isNotNull: IsNotNull => isNotNull
+      case e: EqualTo if predicates.contains(e) => e
+      case e: EqualNullSafe if predicates.contains(e) => e

Review Comment:
   I'm not convinced that the new code can cover all the cases of the old code. 
e.g. `Not(EqualTo)` can be handled by `condition.transform`



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

Reply via email to