Return-Path: X-Original-To: apmail-drill-dev-archive@www.apache.org Delivered-To: apmail-drill-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 0DA5010575 for ; Fri, 20 Feb 2015 22:54:12 +0000 (UTC) Received: (qmail 21708 invoked by uid 500); 20 Feb 2015 22:54:11 -0000 Delivered-To: apmail-drill-dev-archive@drill.apache.org Received: (qmail 21647 invoked by uid 500); 20 Feb 2015 22:54:11 -0000 Mailing-List: contact dev-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 dev@drill.apache.org Received: (qmail 21599 invoked by uid 99); 20 Feb 2015 22:54:11 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 20 Feb 2015 22:54:11 +0000 Date: Fri, 20 Feb 2015 22:54:11 +0000 (UTC) From: "Aman Sinha (JIRA)" To: dev@drill.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Resolved] (DRILL-2191) Aggregation on columns with case statements returns wrong results 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-2191?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Aman Sinha resolved DRILL-2191. ------------------------------- Resolution: Fixed > Aggregation on columns with case statements returns wrong results > ----------------------------------------------------------------- > > Key: DRILL-2191 > URL: https://issues.apache.org/jira/browse/DRILL-2191 > Project: Apache Drill > Issue Type: Bug > Components: Query Planning & Optimization > Reporter: Abhishek Girish > Assignee: Aman Sinha > Priority: Critical > Fix For: 0.8.0 > > Attachments: explain_plan_q1_with_case.txt, explain_plan_q1_without_case.txt > > > Dataset: TPCDS SF 1 > The following queries returns wrong results: > *Query 1* > SELECT > ss_quantity , > SUM(wholesale) AS sum_wholesale > FROM > ( > SELECT > ss_quantity , > sum(case when s.ss_quantity between 1 AND 2 then s.ss_wholesale_cost else 0 end) as wholesale > FROM > store_sales s > WHERE > s.ss_quantity between 1 AND 2 > GROUP BY > ss_quantity, > ss_store_sk > ) dat > GROUP BY ss_quantity > ORDER BY ss_quantity; > *Query 2:* > SELECT > c.c_birth_country, > sum(case when s.ss_quantity between 1 AND 2 then s.ss_wholesale_cost else 0 end) as wholesale > FROM > store_sales s > JOIN > customer c > ON > s.ss_customer_sk = c.c_customer_sk > GROUP BY > c.c_birth_country > Order by c.c_birth_country; > The returned results have issues with decimal placement. Example: > Rows returned from Drill: > 3 2227134.0 > 3 2128570.0 > Rows returned from Postgres: > 3 22271.34 > 3 21285.7 > The results are correct when case statements are removed. -- This message was sent by Atlassian JIRA (v6.3.4#6332)