cloud-fan commented on a change in pull request #35213:
URL: https://github.com/apache/spark/pull/35213#discussion_r785718131
##########
File path:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/Expression.scala
##########
@@ -366,6 +366,8 @@ trait RuntimeReplaceable extends UnaryExpression with
Unevaluable {
// are semantically equal.
override lazy val preCanonicalized: Expression = child.preCanonicalized
+ def isAggregate: Boolean = child.isInstanceOf[AggregateFunction]
Review comment:
More thoughts about it: technically a `RuntimeReplaceable` can combine
one or more expressions, even for something like `f(x) = max(x) - min(x)`.
For aggregate functions, it's very hard to reason about `f(distinct x)
FILTER WHERE ...` if `f(x)` combines many expressions, so I think it makes
sense to only allow a direct mapping here.
We can make this assumption more explicit here
```
def isAggregate: Boolean = {
if (child.isInstanceOf[AggregateFunction]) {
true
} else {
assert(child.find(_.isInstanceOf[AggregateFunction]).isEmpty)
false
}
}
```
--
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]