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


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/conditionalExpressions.scala:
##########
@@ -48,6 +48,14 @@ case class If(predicate: Expression, trueValue: Expression, 
falseValue: Expressi
   override def second: Expression = trueValue
   override def third: Expression = falseValue
   override def nullable: Boolean = trueValue.nullable || falseValue.nullable
+  /**
+   * Common subexpressions will always be evaluated at the beginning, but the 
true and
+   * false expressions in `If` may not get accessed, according to the 
predicate expression.
+   * We should only return the predicate expression.

Review Comment:
   I think we can simplify the comment now
   ```
   Only the condition expression will always be evaluated.
   ```



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