[ 
https://issues.apache.org/jira/browse/SPARK-2554?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14065621#comment-14065621
 ] 

Michael Armbrust commented on SPARK-2554:
-----------------------------------------

I think this may be hard to do if there are other aggregates in the same query, 
though I could be wrong.

If there are only distinct aggregates in the query you could just add a logical 
rewrite rule:
{code}
Aggregate CountDistinct(x)
  Relation
{code}
to
{code}
Aggregate Count(x)
  Distinct
    Project (x)
      Relation
{code}

> CountDistinct and SumDistinct should do partial aggregation
> -----------------------------------------------------------
>
>                 Key: SPARK-2554
>                 URL: https://issues.apache.org/jira/browse/SPARK-2554
>             Project: Spark
>          Issue Type: Improvement
>          Components: SQL
>    Affects Versions: 1.0.1, 1.0.2
>            Reporter: Cheng Lian
>
> {{CountDistinct}} and {{SumDistinct}} should first do a partial aggregation 
> and return unique value sets in each partition as partial results. Shuffle IO 
> can be greatly reduced in in cases that there are only a few unique values.



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to