You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2020/12/19 12:30:14 UTC

[GitHub] [spark] wangyum commented on a change in pull request #30849: [SPARK-33845][SQL] Remove unnecessary if when trueValue and falseValue are foldable boolean types

wangyum commented on a change in pull request #30849:
URL: https://github.com/apache/spark/pull/30849#discussion_r546233120



##########
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(cond, TrueLiteral, FalseLiteral) if cond.deterministic => cond

Review comment:
       We had similar discussions before: https://github.com/apache/spark/pull/21848#pullrequestreview-139604857




----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org