Return-Path: X-Original-To: apmail-drill-issues-archive@minotaur.apache.org Delivered-To: apmail-drill-issues-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 14A1BC65E for ; Thu, 11 Dec 2014 14:39:14 +0000 (UTC) Received: (qmail 19219 invoked by uid 500); 11 Dec 2014 14:39:13 -0000 Delivered-To: apmail-drill-issues-archive@drill.apache.org Received: (qmail 18925 invoked by uid 500); 11 Dec 2014 14:39:13 -0000 Mailing-List: contact issues-help@drill.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@drill.apache.org Delivered-To: mailing list issues@drill.apache.org Received: (qmail 18911 invoked by uid 99); 11 Dec 2014 14:39:13 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 11 Dec 2014 14:39:13 +0000 Date: Thu, 11 Dec 2014 14:39:13 +0000 (UTC) From: "Chris Matta (JIRA)" To: issues@drill.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Updated] (DRILL-1842) SELECT COUNT DISTINCT with HAVING fails to plan the query MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/DRILL-1842?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Chris Matta updated DRILL-1842: ------------------------------- Attachment: ip-172-16-1-175_drillbit.log Log file generated when the statement is run via sqlline. > SELECT COUNT DISTINCT with HAVING fails to plan the query > --------------------------------------------------------- > > Key: DRILL-1842 > URL: https://issues.apache.org/jira/browse/DRILL-1842 > Project: Apache Drill > Issue Type: Bug > Components: Query Planning & Optimization > Affects Versions: 0.6.0 > Reporter: Chris Matta > Attachments: ip-172-16-1-175_drillbit.log > > > Tableau is using the following query to get the distinct count of a measure: > {code:SQL} > 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); > {code} > 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: > {code} > : 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) > {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332)