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/19 00:14:26 UTC

[jira] [Created] (DRILL-1019) decimal multiplication between decimal9 and decimal38 place decimal point wrong

Chun Chang created DRILL-1019:
---------------------------------

             Summary: decimal multiplication between decimal9 and decimal38 place decimal point wrong
                 Key: DRILL-1019
                 URL: https://issues.apache.org/jira/browse/DRILL-1019
             Project: Apache Drill
          Issue Type: Bug
          Components: Functions - Drill
            Reporter: Chun Chang
            Assignee: Mehant Baid


#Wed Jun 18 10:27:23 PDT 2014
git.commit.id.abbrev=894037a

Multiplying decimal9 with decimal38 produce wrong result - decimal point position is placed wrong.

postgres:
foodmart=# select c_row, cast(c_decimal9 as decimal(9,5)), cast(c_decimal38 as decimal(38,18)), cast(c_decimal9 as decimal(9,5)) * cast(c_decimal38 as decimal(38,18)) from data where c_row > 8 and c_row < 14;
 c_row | c_decimal9  |              c_decimal38               |                   ?column?
-------+-------------+----------------------------------------+-----------------------------------------------
     9 | -9876.54321 |           123456789.123456789000000000 |        -1219326312345.67900112635269000000000
    10 |   123.45000 |  999999999999999999.000000000000000000 | 123449999999999999876.55000000000000000000000
    11 |   -54.32100 | -999999999999999999.000000000000000000 |  54320999999999999945.67900000000000000000000
    12 |   100.00600 |                   0.000000000000000010 |                     0.00000000000000100006000
    13 |    -1.00006 |                  -0.000000000000000010 |                     0.00000000000000001000060
(5 rows)

Drill:
0: jdbc:drill:schema=dfs> select c_row, cast(c_decimal9 as decimal(9,5)), cast(c_decimal38 as decimal(38,18)), cast(c_decimal9 as decimal(9,5)) * cast(c_decimal38 as decimal(38,18)) from data where c_row > 8 and c_row < 14;
+------------+------------+------------+------------+
|   c_row    |   EXPR$1   |   EXPR$2   |   EXPR$3   |
+------------+------------+------------+------------+
| 9          | -9876.54321 | 123456789.123456789000000000 | -1219326312345679001126.35269000000000 |
| 10         | 123.45000  | 999999999999999999.000000000000000000 | 123449999999999999876550000000.00000000000000 |
| 11         | -54.32100  | -999999999999999999.000000000000000000 | 54320999999999999945679000000.00000000000000 |
| 12         | 100.00600  | 1.0E-17    | 0.00000100006000 |
| 13         | -1.00006   | -1.0E-17   | 1.000060E-8 |
+------------+------------+------------+------------+
5 rows selected (0.367 seconds)



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