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 2021/08/02 15:32:46 UTC
[GitHub] [spark] cloud-fan commented on a change in pull request #33590: [SPARK-36359][SQL] Coalesce returns the first expression if it is non nullable
cloud-fan commented on a change in pull request #33590:
URL: https://github.com/apache/spark/pull/33590#discussion_r681071652
##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/expressions.scala
##########
@@ -780,6 +780,8 @@ object NullPropagation extends Rule[LogicalPlan] {
Literal.create(null, e.dataType)
} else if (newChildren.length == 1) {
newChildren.head
+ } else if (!newChildren.head.nullable) {
Review comment:
can we generalize it? I think we should find the first non-nullable child, and drop all other children after it.
```
else {
Coalesce(newChildren.take(newChildren.indexWhere(_.nullable) + 1))
}
```
--
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: reviews-unsubscribe@spark.apache.org
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