You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hive.apache.org by "Johnny Zhang (JIRA)" <ji...@apache.org> on 2012/12/18 01:12:15 UTC

[jira] [Updated] (HIVE-3715) float and double calculation is inaccurate in Hive

     [ https://issues.apache.org/jira/browse/HIVE-3715?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Johnny Zhang updated HIVE-3715:
-------------------------------

    Status: Patch Available  (was: Open)
    
> float and double calculation is inaccurate in Hive
> --------------------------------------------------
>
>                 Key: HIVE-3715
>                 URL: https://issues.apache.org/jira/browse/HIVE-3715
>             Project: Hive
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 0.10.0
>            Reporter: Johnny Zhang
>            Assignee: Johnny Zhang
>         Attachments: HIVE-3715.patch.txt
>
>
> I found this during debug the e2e test failures. I found Hive miss calculate the float and double value. Take float calculation as an example:
> hive> select f from all100k limit 1;
> 48308.98
> hive> select f/10 from all100k limit 1;
> 4830.898046875   <--added 04875 in the end
> hive> select f*1.01 from all100k limit 1;
> 48792.0702734375  <--should be 48792.0698
> It might be essentially the same problem as http://effbot.org/pyfaq/why-are-floating-point-calculations-so-inaccurate.htm. But since e2e test compare the results with mysql and seems mysql does it right, so it is worthy fixing it in Hive.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira