Github user yhuai commented on a diff in the pull request:
https://github.com/apache/spark/pull/8874#discussion_r40238553
--- Diff:
sql/core/src/main/scala/org/apache/spark/sql/execution/aggregate/utils.scala ---
@@ -37,6 +37,57 @@ object Utils {
UnsafeProjection.canSupport(groupingExpressions)
}
+ def planAggregateWithoutPartial(
+ groupingExpressions: Seq[Expression],
+ aggregateExpressions: Seq[AggregateExpression2],
+ aggregateFunctionMap: Map[(AggregateFunction2, Boolean),
(AggregateFunction2, Attribute)],
+ resultExpressions: Seq[NamedExpression],
+ child: SparkPlan): Seq[SparkPlan] = {
+
+ val namedGroupingExpressions = groupingExpressions.map {
+ case ne: NamedExpression => ne -> ne
+ // If the expression is not a NamedExpressions, we add an alias.
+ // So, when we generate the result of the operator, the Aggregate
Operator
+ // can directly get the Seq of attributes representing the grouping
expressions.
+ case other =>
+ val withAlias = Alias(other, other.toString)()
+ other -> withAlias
+ }
+ val groupExpressionMap = namedGroupingExpressions.toMap
+ val namedGroupingAttributes =
namedGroupingExpressions.map(_._2.toAttribute)
+
+ val finalAggregateExpressions = aggregateExpressions.map(_.copy(mode =
Complete))
+ val finalAggregateAttributes =
--- End diff --
`completeAggregateExpressions` and `completeAggregateAttributes`?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]