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 CD4C918EBC for ; Wed, 16 Sep 2015 17:22:55 +0000 (UTC) Received: (qmail 14411 invoked by uid 500); 16 Sep 2015 17:22:46 -0000 Delivered-To: apmail-drill-issues-archive@drill.apache.org Received: (qmail 14278 invoked by uid 500); 16 Sep 2015 17:22:46 -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 14111 invoked by uid 99); 16 Sep 2015 17:22:46 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 16 Sep 2015 17:22:46 +0000 Date: Wed, 16 Sep 2015 17:22:46 +0000 (UTC) From: "Chun Chang (JIRA)" To: issues@drill.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Updated] (DRILL-3783) Incorrect results : COUNT() over results returned by UNION ALL 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-3783?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Chun Chang updated DRILL-3783: ------------------------------ Assignee: Khurram Faraaz (was: Chun Chang) > Incorrect results : COUNT() over results returned by UNION ALL > ---------------------------------------------------------------------------- > > Key: DRILL-3783 > URL: https://issues.apache.org/jira/browse/DRILL-3783 > Project: Apache Drill > Issue Type: Bug > Components: Execution - Relational Operators > Affects Versions: 1.2.0 > Environment: 4 node cluster on CentOS > Reporter: Khurram Faraaz > Assignee: Khurram Faraaz > Priority: Critical > Fix For: 1.2.0 > > > Count over results returned union all query, returns incorrect results. The below query returned an Exception (please se DRILL-2637) that JIRA was marked as fixed, however the query returns incorrect results. > {code} > 0: jdbc:drill:schema=dfs.tmp> select count(c1) from (select cast(columns[0] as int) c1 from `testWindow.csv`) union all (select cast(columns[0] as int) c2 from `testWindow.csv`); > +---------+ > | EXPR$0 | > +---------+ > | 11 | > | 100 | > | 10 | > | 2 | > | 50 | > | 55 | > | 67 | > | 113 | > | 119 | > | 89 | > | 57 | > | 61 | > +---------+ > 12 rows selected (0.753 seconds) > {code} > Results returned by the query on LHS and RHS of Union all operator are > {code} > 0: jdbc:drill:schema=dfs.tmp> select cast(columns[0] as int) c1 from `testWindow.csv`; > +------+ > | c1 | > +------+ > | 100 | > | 10 | > | 2 | > | 50 | > | 55 | > | 67 | > | 113 | > | 119 | > | 89 | > | 57 | > | 61 | > +------+ > 11 rows selected (0.197 seconds) > 0: jdbc:drill:schema=dfs.tmp> select cast(columns[0] as int) c2 from `testWindow.csv`; > +------+ > | c2 | > +------+ > | 100 | > | 10 | > | 2 | > | 50 | > | 55 | > | 67 | > | 113 | > | 119 | > | 89 | > | 57 | > | 61 | > +------+ > 11 rows selected (0.173 seconds) > {code} > Note that enclosing the queries within correct parentheses returns correct results. We do not want to return incorrect results to user when the parentheses are missing. > {code} > 0: jdbc:drill:schema=dfs.tmp> select count(c1) from ((select cast(columns[0] as int) c1 from `testWindow.csv`) union all (select cast(columns[0] as int) c2 from `testWindow.csv`)); > +---------+ > | EXPR$0 | > +---------+ > | 22 | > +---------+ > 1 row selected (0.234 seconds) > {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332)