HyukjinKwon commented on a change in pull request #30898:
URL: https://github.com/apache/spark/pull/30898#discussion_r549213198



##########
File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/expressions.scala
##########
@@ -475,6 +475,8 @@ object SimplifyConditionals extends Rule[LogicalPlan] with 
PredicateHelper {
       case If(TrueLiteral, trueValue, _) => trueValue
       case If(FalseLiteral, _, falseValue) => falseValue
       case If(Literal(null, _), _, falseValue) => falseValue
+      case If(_, TrueLiteral, TrueLiteral) => TrueLiteral
+      case If(_, FalseLiteral, FalseLiteral) => FalseLiteral
       case If(cond, TrueLiteral, FalseLiteral) => cond
       case If(cond, FalseLiteral, TrueLiteral) => Not(cond)
       case If(cond, trueValue, falseValue)

Review comment:
       BTW, the tests you added at 
https://github.com/apache/spark/pull/30898/files#diff-c18cf81d53bb8508802317a785a74f2dadb0487d88e0164efb36f89ce64973e3R210-R213
 will pass because of the case match here.




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