uros-db commented on code in PR #47525:
URL: https://github.com/apache/spark/pull/47525#discussion_r1697604316
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/RewriteDistinctAggregates.scala:
##########
@@ -205,7 +205,8 @@ object RewriteDistinctAggregates extends Rule[LogicalPlan] {
// clause for this rule because aggregation strategy can handle a single
distinct aggregate
// group without filter clause.
// This check can produce false-positives, e.g., SUM(DISTINCT a) &
COUNT(DISTINCT a).
- distinctAggs.size > 1 || distinctAggs.exists(_.filter.isDefined)
+ distinctAggs.size > 1 || distinctAggs.exists(_.filter.isDefined) ||
+ distinctAggs.exists(_.aggregateFunction.children.forall(_.foldable))
Review Comment:
yes, this is the problem only for non-grouping aggregates - fixed in latest
commit
--
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]