Github user maropu commented on the issue: https://github.com/apache/spark/pull/14876 I found that we need to push-down partial aggregation below exchange operators instead of merging them? For example, in the spark v2.0 branch, ``` (0 to 1000).map(x => (x % 2, x.toString)).toDF("a", "b").repartition($"a").createOrReplaceTempView("t") spark.sql("select max(b) from t group by a").explain ``` This prints like: ``` == Physical Plan == SortAggregate(key=[a#5], functions=[max(b#6)], output=[max(b)#20]) +- SortAggregate(key=[a#5], functions=[partial_max(b#6)], output=[a#5,max#22]) +- *Sort [a#5 ASC], false, 0 +- Exchange hashpartitioning(a#5, 4) +- LocalTableScan [a#5, b#6] ``` In this case, I think it is more natural to push-down the partial aggregation below the exchange.
--- 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 infrastruct...@apache.org or file a JIRA ticket with INFRA. --- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org