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

Ethan Wang updated PHOENIX-418:
-------------------------------
    Attachment: PHOENIX-418-v3.patch

Patch for supporting approximate count distinct.

Syntax:
select APPROX_COUNT_DISTINCT(name) from person
select APPROX_COUNT_DISTINCT(address||name) from person
select APPROX_COUNT_DISTINCT(a.address||b.name) from person a, person b where 
a.name=b.name
explain select APPROX_COUNT_DISTINCT(name) from person
(explain plan will be same as count())


Dependency and License:
Due to java1.7, we use com.clearspring.analytics.stream libraray for 
HyperLogLog. (The only pom addon)

This library is under Apache license. This Dependency relies on the dependecies 
below, listed with their license respectively:

Apache: guava,mahout-math,charts4j,fastutil
MIT:  commons-codec
Eclipse Public License: Junit
CERN - European Organization for Nuclear Research
https://dst.lbl.gov/ACSSoftware/colt/license.html
:colt

> Support approximate COUNT DISTINCT
> ----------------------------------
>
>                 Key: PHOENIX-418
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-418
>             Project: Phoenix
>          Issue Type: Task
>            Reporter: James Taylor
>            Assignee: Ethan Wang
>              Labels: gsoc2016
>         Attachments: PHOENIX-418-v1.patch, PHOENIX-418-v2.patch, 
> PHOENIX-418-v3.patch
>
>
> Support an "approximation" of count distinct to prevent having to hold on to 
> all distinct values (since this will not scale well when the number of 
> distinct values is huge). The Apache Drill folks have had some interesting 
> discussions on this 
> [here](http://mail-archives.apache.org/mod_mbox/incubator-drill-dev/201306.mbox/%3CJIRA.12650169.1369931282407.88049.1370645900553%40arcas%3E).
>  They recommend using  [Welford's 
> method](http://en.wikipedia.org/wiki/Algorithms_for_calculating_variance_Online_algorithm).
>  I'm open to having a config option that uses exact versus approximate. I 
> don't have experience implementing an approximate implementation, so I'm not 
> sure how much state is required to keep on the server and return to the 
> client (other than realizing it'd be much less that returning all distinct 
> values and their counts).



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to