phoenix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ethan Wang (JIRA)" <>
Subject [jira] [Commented] (PHOENIX-418) Support approximate COUNT DISTINCT
Date Wed, 30 Aug 2017 18:06:00 GMT


Ethan Wang commented on PHOENIX-418:

I see. I forgot to mention that, for me the local test to work, I have to copy both the compiled
phoenix-server.jar as well as a stream.jar to hbase lib folder. I will go prepare another

> Support approximate COUNT DISTINCT
> ----------------------------------
>                 Key: PHOENIX-418
>                 URL:
>             Project: Phoenix
>          Issue Type: New Feature
>            Reporter: James Taylor
>            Assignee: Ethan Wang
>            Priority: Blocker
>              Labels: gsoc2016
>             Fix For: 4.12.0
>         Attachments: PHOENIX-418-v1.patch, PHOENIX-418-v2.patch, PHOENIX-418-v3.patch,
PHOENIX-418-v4.patch, PHOENIX-418-v5.patch, PHOENIX-418-v6.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](
They recommend using  [Welford's method](
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).
> Update:
> Syntax of using approximate count distinct as:
> select APPROX_COUNT_DISTINCT(name) from person
> select APPROX_COUNT_DISTINCT(address||name) from person
> It is equivalent of  Select COUNT(DISTINCT ID) from person. Implemented using hyperloglog,
see discuss below.
> Source code patch link below, co-authorred with [~swapna]

This message was sent by Atlassian JIRA

View raw message