Github user dbtsai commented on a diff in the pull request: https://github.com/apache/spark/pull/21848#discussion_r204515560 --- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/expressions.scala --- @@ -390,6 +390,7 @@ 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(_, trueValue, falseValue) if trueValue.semanticEquals(falseValue) => trueValue --- End diff -- Can you elaborate? For `trueValue.semanticEquals(falseValue)`, it's guaranteed that both `trueValue` and `falseValue` are `deterministic`. ```scala def semanticEquals(other: Expression): Boolean = deterministic && other.deterministic && canonicalized == other.canonicalized ```
--- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org