You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2022/07/20 03:52:34 UTC
[GitHub] [spark] cloud-fan commented on a diff in pull request #37224: [SPARK-39812][SQL] Simplify code which construct `AggregateExpression` with `toAggregateExpression`
cloud-fan commented on code in PR #37224:
URL: https://github.com/apache/spark/pull/37224#discussion_r925149070
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/RewriteDistinctAggregates.scala:
##########
@@ -330,11 +330,8 @@ object RewriteDistinctAggregates extends Rule[LogicalPlan] {
val operator = Alias(e.copy(aggregateFunction = af, filter = filterOpt), e.sql)()
// Select the result of the first aggregate in the last aggregate.
- val result = AggregateExpression(
- aggregate.First(operator.toAttribute, ignoreNulls = true),
- mode = Complete,
- isDistinct = false,
- filter = Some(EqualTo(gid, regularGroupId)))
+ val result = aggregate.First(operator.toAttribute, ignoreNulls = true)
+ .toAggregateExpression(false, Some(EqualTo(gid, regularGroupId)))
Review Comment:
```suggestion
.toAggregateExpression(isDistinct = false, filter = Some(EqualTo(gid, regularGroupId)))
```
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org