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

[jira] [Updated] (DRILL-1007) decimal38 comparison with double failed on some values

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

Mehant Baid updated DRILL-1007:
-------------------------------

    Attachment: DRILL-1007.patch

> decimal38 comparison with double failed on some values
> ------------------------------------------------------
>
>                 Key: DRILL-1007
>                 URL: https://issues.apache.org/jira/browse/DRILL-1007
>             Project: Apache Drill
>          Issue Type: Bug
>          Components: Functions - Drill
>            Reporter: Chun Chang
>            Assignee: Mehant Baid
>         Attachments: DRILL-1007.patch
>
>
> comparison between double and decimal38 fails for some values like:
> 0 vs -0.000000010000000000
> -56789012345.1234 vs -999999999999999999.000000000000000000
> For example, the following query yields the following results with postgres:
> foodmart=# select c_row, c_float8, cast(c_decimal38 as decimal(38,18)) from data where c_row < 15 and c_float8 > cast(c_decimal38 as decimal(38,18));
>  c_row |     c_float8      |              c_decimal38
> -------+-------------------+----------------------------------------
>      1 |              10.5 |                   0.000000000000000000
>      2 |              10.5 |                   1.000000000000000000
>      4 |   123456789012345 |           999999999.000000000000000000
>      5 |   999999999999999 |          -999999999.000000000000000000
>      7 |                 0 |                  -0.000000010000000000
>     11 | -56789012345.1234 | -999999999999999999.000000000000000000
>     13 |        2147483647 |                  -0.000000000000000010
> (7 rows)
> with Drill, two rows are missing due to failed comparison:
> 0: jdbc:drill:schema=dfs> select c_row, c_float8, cast(c_decimal38 as decimal(38,18)) from data where c_row < 15 and c_float8 > cast(c_decimal38 as decimal(38,18));
> +------------+------------+------------+
> |   c_row    |  c_float8  |   EXPR$2   |
> +------------+------------+------------+
> | 1          | 10.5       | 0E-18      |
> | 2          | 10.5       | 1.000000000000000000 |
> | 4          | 1.23456789012345E14 | 999999999.000000000000000000 |
> | 5          | 9.99999999999999E14 | -999999999.000000000000000000 |
> | 13         | 2.147483647E9 | -1.0E-17   |
> +------------+------------+------------+
> 5 rows selected (0.156 seconds)



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