You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@drill.apache.org by "Boaz Ben-Zvi (JIRA)" <ji...@apache.org> on 2019/02/26 02:17:00 UTC

[jira] [Updated] (DRILL-6836) Eliminate StreamingAggr for COUNT DISTINCT

     [ https://issues.apache.org/jira/browse/DRILL-6836?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Boaz Ben-Zvi updated DRILL-6836:
--------------------------------
    Fix Version/s:     (was: 1.16.0)
                   1.17.0

> Eliminate StreamingAggr for COUNT DISTINCT
> ------------------------------------------
>
>                 Key: DRILL-6836
>                 URL: https://issues.apache.org/jira/browse/DRILL-6836
>             Project: Apache Drill
>          Issue Type: Improvement
>          Components: Execution - Relational Operators, Query Planning &amp; Optimization
>    Affects Versions: 1.14.0
>            Reporter: Boaz Ben-Zvi
>            Assignee: Boaz Ben-Zvi
>            Priority: Minor
>             Fix For: 1.17.0
>
>
> The COUNT DISTINCT operation is often implemented with a Hash-Aggr operator for the DISTINCT, and a Streaming-Aggr above to perform the COUNT.  That Streaming-Aggr does the counting like any aggregation, counting each value, batch after batch.
>   While very efficient, that counting work is basically not needed, as the Hash-Aggr knows the number of distinct values (in the in-memory partitions).
>   Hence _a possible small performance improvement_ - eliminate the Streaming-Aggr operator, and notify the Hash-Aggr to return a COUNT (these are Planner changes). The Hash-Aggr operator would need to generate the single Float8 column output schema, and output that batch with a single value, just like the Streaming -Aggr did (likely without generating code).
>   In case of a spill, the Hash-Aggr still needs to read and process those partitions, to get the exact distinct number.
>    The expected improvement is the elimination of the batch by batch output from the Hash-Aggr, and the batch by batch, row by row processing of the Streaming-Aggr.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)