Github user maropu commented on the issue:

    https://github.com/apache/spark/pull/14876
  
    On the other hand, when caching the already-partitioned input table, we 
cannot push-down them;
    ```
    (0 to 1000).map(x => (x % 2, x.toString)).toDF("a", 
"b").repartition($"a").cache.createOrReplaceTempView("t")
    spark.sql("select max(b) from t group by a").explain
    ```
    ```
    == Physical Plan ==
    SortAggregate(key=[a#40], functions=[max(b#41)])
    +- SortAggregate(key=[a#40], functions=[partial_max(b#41)])
       +- *Sort [a#40 ASC], false, 0
          +- InMemoryTableScan [a#40, b#41]
             :  +- InMemoryRelation [a#40, b#41], true, 10000, 
StorageLevel(disk, memory, deserialized, 1 replicas)
             :     :  +- Exchange hashpartitioning(a#40, 4)
             :     :     +- LocalTableScan [a#40, b#41]
    ```
    ISTM all we can do is merge the aggregations into one in this case.


---
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

Reply via email to