You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@drill.apache.org by "Mehant Baid (JIRA)" <ji...@apache.org> on 2014/05/05 06:44:14 UTC

[jira] [Commented] (DRILL-629) SUM() group by results in wrong values

    [ https://issues.apache.org/jira/browse/DRILL-629?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13989276#comment-13989276 ] 

Mehant Baid commented on DRILL-629:
-----------------------------------

We use Float8 (which uses double) in the sum() aggregate function. I added the double values 135540.7, 72730.13 in a standalone java program got the result 208270.83000000002 instead of 208270.83. This is just the imprecision with double data type. 

Note: Currently for sum() and avg() of numeric types (including decimal) we use Float8 as the output type so its going to be approximate.

> SUM() group by results in wrong values
> --------------------------------------
>
>                 Key: DRILL-629
>                 URL: https://issues.apache.org/jira/browse/DRILL-629
>             Project: Apache Drill
>          Issue Type: Bug
>            Reporter: Ramana Inukonda Nagaraj
>
> Parquet file was created from pig, pig datatypes for the interested columns are long and double
> A select of the columns from the parquet file results in :
> 0: jdbc:drill:schema=dfs.drillTestDirTpch> select O_CUSTKEY,O_TOTALPRICE from orders where  O_CUSTKEY=1499;
> +------------+--------------+
> | O_CUSTKEY  | O_TOTALPRICE |
> +------------+--------------+
> | 1499       | 135540.7     |
> | 1499       | 72730.13     |
> +------------+--------------+
> 2 rows selected (1.275 seconds)
> However in a sum agg function grouped by the O_CUSTKEY results in
> select O_CUSTKEY,SUM(O_TOTALPRICE) from orders group by O_CUSTKEY;
> 1499	208270.83000000002
> as opposed to 
> 1499	208270.83 which is the correct result.



--
This message was sent by Atlassian JIRA
(v6.2#6252)