Github user cloud-fan commented on a diff in the pull request:
https://github.com/apache/spark/pull/7583#discussion_r35395333
--- Diff:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/planning/patterns.scala
---
@@ -144,14 +144,14 @@ object PartialAggregation {
// time. However some of them might be unnamed so we alias them
allowing them to be
// referenced in the second aggregation.
val namedGroupingExpressions: Seq[(Expression, NamedExpression)] =
- groupingExpressions.filter(!_.isInstanceOf[Literal]).map {
+ groupingExpressions.map {
case n: NamedExpression => (n, n)
case other => (other, Alias(other, "PartialGroup")())
}
// Replace aggregations with a new expression that computes the
result from the already
// computed partial evaluations and grouping values.
- val rewrittenAggregateExpressions =
aggregateExpressions.map(_.transformUp {
+ val rewrittenAggregateExpressions =
aggregateExpressions.map(_.transformDown {
--- End diff --
In the new aggregation code path, we use `transformDown` to do the
rewriting, as we won't have group expressions inside aggregation expression. We
should apply it in this old aggregation code path too.
---
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]