beliefer commented on a change in pull request #29626:
URL: https://github.com/apache/spark/pull/29626#discussion_r486028869
##########
File path:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/RewriteDistinctAggregates.scala
##########
@@ -292,13 +292,14 @@ object RewriteDistinctAggregates extends
Rule[LogicalPlan] {
// Final aggregate
val operators = expressions.map { e =>
val af = e.aggregateFunction
- val naf = patchAggregateFunctionChildren(af) { x =>
- val condition = if (e.filter.isDefined) {
- e.filter.map(distinctAggFilterAttrLookup.get(_)).get
- } else {
- None
+ val condition =
e.filter.map(distinctAggFilterAttrLookup.get(_)).flatten
+ val naf = if (af.children.forall(_.foldable)) {
+ val firstChild = evalWithinGroup(id, af.children.head, condition)
Review comment:
OK
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]