cloud-fan commented on code in PR #36455:
URL: https://github.com/apache/spark/pull/36455#discussion_r866433341
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/EquivalentExpressions.scala:
##########
@@ -127,56 +127,18 @@ class EquivalentExpressions {
// There are some special expressions that we should not recurse into all of
its children.
// 1. CodegenFallback: it's children will not be used to generate code
(call eval() instead)
- // 2. If: 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 recurse into the predicate expression.
- // 3. CaseWhen: like `If`, the children of `CaseWhen` only get accessed in
a certain
- // condition. We should only recurse into the first condition
expression as it
- // will always get accessed.
- // 4. Coalesce: it's also a conditional expression, we should only recurse
into the first
- // children, because others may not get accessed.
- // 5. NaNvl: it's a conditional expression, we can only guarantee the left
child can be always
- // accessed. And if we hit the left child, the right will not be
accessed.
+ // 2. ConditionalExpression: use it's specified expression
Review Comment:
```suggestion
// 2. ConditionalExpression: use its children that 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]