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/07/10 00:03:08 UTC

[jira] [Created] (DRILL-1123) how scale (significant digits after decimal point) is determined for decimal operations

Chun Chang created DRILL-1123:
---------------------------------

             Summary: how scale (significant digits after decimal point) is determined for decimal operations
                 Key: DRILL-1123
                 URL: https://issues.apache.org/jira/browse/DRILL-1123
             Project: Apache Drill
          Issue Type: Bug
          Components: Functions - Drill
            Reporter: Chun Chang
            Assignee: Mehant Baid


#Wed Jul 09 10:28:32 PDT 2014
git.commit.id.abbrev=810a204

The way we determine how many significant digits after decimal point during decimal operation seems confusion, and in some cases, just doesn't make sense. Here is the experiments I did:

0: jdbc:drill:schema=dfs> select cast('12.3456' as decimal(18,6)) / cast('2.0' as decimal(38,1)) from data limit 1;
+------------+
|   EXPR$0   |
+------------+
| 6.1728000000000000000000000 |
+------------+
1 row selected (0.163 seconds)
0: jdbc:drill:schema=dfs> select cast('12.3456' as decimal(18,6)) / cast('2.0' as decimal(38,10)) from data limit 1;
+------------+
|   EXPR$0   |
+------------+
| 6.1728000000000000 |
+------------+
1 row selected (0.173 seconds)
0: jdbc:drill:schema=dfs> select cast('12.3456' as decimal(18,6)) / cast('2.0' as decimal(38,20)) from data limit 1;
+------------+
|   EXPR$0   |
+------------+
| 6.172800   |
+------------+
1 row selected (0.136 seconds)
0: jdbc:drill:schema=dfs> select cast('12.3456' as decimal(18,6)) / cast('2.0' as decimal(38,30)) from data limit 1;
+------------+
|   EXPR$0   |
+------------+
| 6          |
+------------+
1 row selected (0.185 seconds)

Look at the last example, no decimal digits are displayed, even though I increased decimal scale.



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