Thanks Aman,
Other version of the query work correctly, but the non-working query is
generated by Tableau by default. I would think something like this would
need to be supported. I'll file a Jira.

Chris Matta
[email protected]
215-701-3146

On Wed, Dec 10, 2014 at 3:59 PM, Aman Sinha <[email protected]> wrote:

> Since there is no GROUP-BY in the query, I am not sure what the HAVING
> COUNT(1) > 0 really means here.  The query computes the total number of
> distinct values of a column and filters it by checking the count(1)  (which
> is equivalent to count(*)) ?  There is only 1 value returned.
>
> Drill fails to plan the query, which is a bug - pls file a JIRA -  but the
> following alternate versions of the query seem more meaningful (I think
> both of these should run successfully):
>   1.  SELECT  column1,  COUNT(distinct column2) FROM ...  GROUP BY column1
> HAVING COUNT(*) > 0
>   2.  SELECT  COUNT(distinct column2) FROM .... HAVING COUNT(distinct
> column2) > 0
>
> Aman
>
> On Wed, Dec 10, 2014 at 12:29 PM, Christopher Matta <[email protected]>
> wrote:
>
> > Tableau is using the following query to get the distinct count of a
> > measure:
> >
> > SELECT COUNT(DISTINCT `custview`.`age`) AS `ctd_age_ok` FROM
> `mfs.views`.`nestedclickview` `nestedclickview` INNER JOIN
> `mfs.views`.`custview` `custview` ON (`nestedclickview`.`cust_id` =
> `custview`.`cust_id`) HAVING (COUNT(1) > 0);
> >
> > And it fails on 0.06r2.
> >
> > Interestingly if I remove the HAVING(COUNT(1)>0) statement at the end it
> > works:
> >
> > : jdbc:drill:zk=172.16.1.175:5181,172.16.1.1> SELECT COUNT(DISTINCT
> `custview`.`age`) AS `ctd_age_ok` FROM `mfs.views`.`nestedclickview`
> `nestedclickview` INNER JOIN `mfs.views`.`custview` `custview` ON
> (`nestedclickview`.`cust_id` = `custview`.`cust_id`);
> >
> > +------------+
> > | ctd_age_ok |
> > +------------+
> > | 5          |
> > +------------+
> > 1 row selected (4.776 seconds)
> >
> > Is this a bug, or a malformed query from Tableau?
> >
> > See the error log attached for more detail.
> >
> > Chris Matta
> > [email protected]
> > 215-701-3146
> > ​
> >
>

Reply via email to