cloud-fan commented on code in PR #36455:
URL: https://github.com/apache/spark/pull/36455#discussion_r866435782
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/nullExpressions.scala:
##########
@@ -66,6 +67,19 @@ case class Coalesce(children: Seq[Expression]) extends
ComplexTypeMergingExpress
}
}
+ /**
+ * We should only return the first child, because others may not get
accessed.
+ */
+ override def alwaysEvaluatedInputs: Seq[Expression] = children.head :: Nil
+
+ override def branchGroups: Seq[Seq[Expression]] = if (children.length > 1) {
+ // If there is only one child, the first child is already covered by
+ // `head` and we should exclude it here.
Review Comment:
```suggestion
// `alwaysEvaluatedInputs` and we should exclude it 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.
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]