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

[jira] [Updated] (DRILL-1085) Rounding issue with casting, such as casting(float4 as int)

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

Chun Chang updated DRILL-1085:
------------------------------

    Summary: Rounding issue with casting, such as casting(float4 as int)  (was: Rounding issue with float4 data type)

this bug affects casting from real, double, decimal to int, bigint.

> Rounding issue with casting, such as casting(float4 as int)
> -----------------------------------------------------------
>
>                 Key: DRILL-1085
>                 URL: https://issues.apache.org/jira/browse/DRILL-1085
>             Project: Apache Drill
>          Issue Type: Bug
>          Components: Functions - Drill
>            Reporter: Chun Chang
>
> #Thu Jun 26 13:57:45 PDT 2014
> git.commit.id.abbrev=3ea8eb5
> For data type float4 (real), we still don't round correctly when casting from float4 to int.
> postgres:
> foodmart=# select c_row, c_float4, cast(c_float4 as int) from data;
>  c_row | c_float4 | c_float4
> -------+----------+----------
>      1 |     10.5 |       10
>      2 |   100.06 |      100
>      3 |     10.5 |       10
>      4 |  100.006 |      100
>      5 | -1.00006 |       -1
>      6 |   123456 |   123456
>      7 |   999999 |   999999
>      8 |  -999999 |  -999999
>      9 |    1e-05 |        0
>     10 |        0 |        0
>     11 |      0.1 |        0
>     12 |      0.5 |        0
>     13 |      0.6 |        1
>     14 |  -0.0456 |        0
>     15 | -456.678 |     -457
>     16 |  1203.43 |     1203
>     17 |  9999.99 |    10000
>     18 | -9999.99 |   -10000
>     19 |   0.0009 |        0
>     20 |  4593.29 |     4593
>     21 |  9302.21 |     9302
>     22 |    5.832 |        6
>     23 | -3920.23 |    -3920
> (23 rows)
> drill:
> 0: jdbc:drill:schema=dfs> select cast(c_float4 as int) from data;
> +------------+
> |   EXPR$0   |
> +------------+
> | 10         |
> | 100        |
> | 10         |
> | 100        |
> | -1         |
> | 123456     |
> | 999999     |
> | -999999    |
> | 0          |
> | 0          |
> | 0          |
> | 0          |
> | 0          |
> | 0          |
> | -456       |
> | 1203       |
> | 9999       |
> | -9999      |
> | 0          |
> | 4593       |
> | 9302       |
> | 5          |
> | -3920      |
> +------------+
> 23 rows selected (0.125 seconds)



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