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 836F9109AA for ; Thu, 29 May 2014 23:08:25 +0000 (UTC) Received: (qmail 55593 invoked by uid 500); 29 May 2014 23:08:25 -0000 Delivered-To: apmail-drill-issues-archive@drill.apache.org Received: (qmail 55568 invoked by uid 500); 29 May 2014 23:08:25 -0000 Mailing-List: contact issues-help@drill.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@drill.incubator.apache.org Delivered-To: mailing list issues@drill.incubator.apache.org Received: (qmail 55559 invoked by uid 99); 29 May 2014 23:08:25 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 29 May 2014 23:08:25 +0000 X-ASF-Spam-Status: No, hits=-2000.7 required=5.0 tests=ALL_TRUSTED,RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO mail.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with SMTP; Thu, 29 May 2014 23:08:26 +0000 Received: (qmail 54899 invoked by uid 99); 29 May 2014 23:08:01 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 29 May 2014 23:08:01 +0000 Date: Thu, 29 May 2014 23:08:01 +0000 (UTC) From: "Chun Chang (JIRA)" To: issues@drill.incubator.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (DRILL-861) sum(decimal38) gives wrong result, even without overflowing MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/DRILL-861?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14013073#comment-14013073 ] Chun Chang commented on DRILL-861: ---------------------------------- similar error for sum() for decimal28. > sum(decimal38) gives wrong result, even without overflowing > ----------------------------------------------------------- > > Key: DRILL-861 > URL: https://issues.apache.org/jira/browse/DRILL-861 > Project: Apache Drill > Issue Type: Bug > Components: Functions - Drill > Reporter: Chun Chang > Assignee: Mehant Baid > > #Wed May 28 17:19:59 PDT 2014 > git.commit.id.abbrev=c8a08c3 > sum over decimal38 type of data gives wrong result. this is without encounter overflowing. > I have the following data in a decimal38 column: > 0: jdbc:drill:schema=dfs> select cast(c_decimal38 as decimal(38,14)) from data where c_row <= 14; > +------------+ > | EXPR$0 | > +------------+ > | 0E-14 | > | 1.00000000000000 | > | 123456789.00000000000000 | > | 999999999.00000000000000 | > | -999999999.00000000000000 | > | 1.000000E-8 | > | -1.000000E-8 | > | 12345.67890000000000 | > | 123456789.12345678900000 | > | 999999999999999999.00000000000000 | > | -999999999999999999.00000000000000 | > | 0E-14 | > | 0E-14 | > | 12345678901234.12345678901234 | > +------------+ > 14 rows selected (0.288 seconds) > The sum of the columns gives the following wrong number: > 0: jdbc:drill:schema=dfs> select sum(cast(c_decimal38 as decimal(38,14))) from data where c_row <= 14; > +------------+ > | EXPR$0 | > +------------+ > | 1.2345925827186123E13 | > The correct number should be (from postgres, I also hand calculated): > foodmart=# select sum(cast(c_decimal38 as decimal(38,14))) from data where c_row <= 14; > sum > ------------------------------- > 12345925827158.92581357801234 -- This message was sent by Atlassian JIRA (v6.2#6252)