Github user yhuai commented on the pull request:

    https://github.com/apache/spark/pull/10228#issuecomment-163365216
  
    oh, just realized that the plan for a query like `SELECT COUNT(DISTINCT a) 
FROM table` will be
    ```
    AGG-2 (count distinct)
      Shuffle to a single reducer
        AGG-1 (grouping on a)
          Shuffle by a
            Partial-AGG-1 (grouping on a)
    ```
    Ideally, we should still use four aggregate operators like the one shown 
below but without the overhead of using Expand.
    ```
    AGG-2 (count distinct)
      Shuffle to a single reducer
        Partial-AGG-2 (count distinct)
          AGG-1 (grouping on a)
            Shuffle by a
              Partial-AGG-1 (grouping on a)
    ```
    



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

Reply via email to