Uploaded image for project: 'Apache Drill'
  1. Apache Drill
  2. DRILL-1842

SELECT COUNT DISTINCT with HAVING fails to plan the query

    XMLWordPrintableJSON

Details

    Description

      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 with a planing error.

      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)
      

      Attachments

        1. ip-172-16-1-175_drillbit.log
          40 kB
          Chris Matta

        Activity

          People

            amansinha100 Aman Sinha
            cmatta Chris Matta
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: