drill-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Chun Chang (JIRA)" <j...@apache.org>
Subject [jira] [Created] (DRILL-1085) Rounding issue with float4 data type
Date Thu, 26 Jun 2014 21:33:25 GMT
Chun Chang created DRILL-1085:
---------------------------------

             Summary: Rounding issue with float4 data type
                 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)

Mime
View raw message