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

[jira] [Commented] (DRILL-607) cast bigint as decimal(38,0) produces wrong results

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

Chun Chang commented on DRILL-607:
----------------------------------

cast bigint to decimal(28,4) also produces wrong results.

postgres:

foodmart=# select cast(c_bigint as decimal(28,4)) from data;
         c_bigint
---------------------------
                    0.0000
                    1.0000
                   -1.0000
                   12.0000
                  123.0000
 -9223372036854775808.0000
  9223372036854775807.0000
     4567890123456789.0000
    -4567890123456789.0000
      920320399049584.0000
  -922337203685477580.0000
            -99392039.0000
          -2147483648.0000
           2147483647.0000
                32767.0000
               -32767.0000
                49032.0000
             -4989385.0000
             69834830.0000
                  243.0000
              -426432.0000
                -3904.0000
   922337203685477580.0000
(23 rows)

drill:

0: jdbc:drill:schema=dfs> select cast(c_bigint as decimal(28,4)) from data;
+------------+
|   EXPR$0   |
+------------+
| 0.0000     |
| 1.0000     |
| -1.0000    |
| 12.0000    |
| 123.0000   |
| 0.0000     |
| 9.0000     |
| 4567890.0000 |
| -4567890.0000 |
| 920320.0000 |
| -922337203.0000 |
| -99392039.0000 |
| -2.0000    |
| 2.0000     |
| 32767.0000 |
| -32767.0000 |
| 49032.0000 |
| -4989385.0000 |
| 69834830.0000 |
| 243.0000   |
| -426432.0000 |
| -3904.0000 |
| 922337203.0000 |
+------------+
23 rows selected (0.112 seconds)



> cast bigint as decimal(38,0) produces wrong results
> ---------------------------------------------------
>
>                 Key: DRILL-607
>                 URL: https://issues.apache.org/jira/browse/DRILL-607
>             Project: Apache Drill
>          Issue Type: Bug
>            Reporter: Chun Chang
>
> postgres:
> foodmart=# select cast(c_bigint as decimal(38,0)) from data;
>        c_bigint
> ----------------------
>                     0
>                     1
>                    -1
>                    12
>                   123
>  -9223372036854775808
>   9223372036854775807
>      4567890123456789
>     -4567890123456789
>       920320399049584
>   -922337203685477580
>             -99392039
>           -2147483648
>            2147483647
>                 32767
>                -32767
>                 49032
>              -4989385
>              69834830
>                   243
>               -426432
>                 -3904
>    922337203685477580
> (23 rows)
> drill:
> 0: jdbc:drill:schema=dfs> select cast(c_bigint as decimal(38,0)) from data;
> +------------+
> |   EXPR$0   |
> +------------+
> | 0          |
> | 1          |
> | -1         |
> | 12         |
> | 123        |
> | 0          |
> | 9          |
> | 4567890    |
> | -4567890   |
> | 920320     |
> | -922337203 |
> | -99392039  |
> | -2         |
> | 2          |
> | 32767      |
> | -32767     |
> | 49032      |
> | -4989385   |
> | 69834830   |
> | 243        |
> | -426432    |
> | -3904      |
> | 922337203  |
> +------------+
> 23 rows selected (0.121 seconds)



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