beliefer commented on a change in pull request #27058: [SPARK-30276][SQL]
Support Filter expression allows simultaneous use of DISTINCT
URL: https://github.com/apache/spark/pull/27058#discussion_r367318890
##########
File path:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/CheckAnalysis.scala
##########
@@ -207,6 +207,26 @@ trait CheckAnalysis extends PredicateHelper {
s"of type ${condition.dataType.catalogString} is not a
boolean.")
case Aggregate(groupingExprs, aggregateExprs, child) =>
+ val distinctAggregateExprs = aggregateExprs.flatMap(_.collect {
+ case ae: AggregateExpression if ae.isDistinct => ae
+ })
+ val distinctAggGroups = distinctAggregateExprs.groupBy { e =>
+ val unfoldableChildren =
e.aggregateFunction.children.filter(!_.foldable).toSet
+ if (unfoldableChildren.nonEmpty) {
+ unfoldableChildren
+ } else {
+ e.aggregateFunction.children.take(1).toSet
Review comment:
This PR is changed to implement multiple DISTINCT aggregate with Filter
clause. I modified the title and description of this PR.
----------------------------------------------------------------
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]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]