drill-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rahul Challapalli (JIRA)" <j...@apache.org>
Subject [jira] [Created] (DRILL-1216) Decimal multiplication breaks when the scale exceeds 38 even when the actual data is small
Date Tue, 29 Jul 2014 17:46:53 GMT
Rahul Challapalli created DRILL-1216:
----------------------------------------

             Summary: Decimal multiplication breaks when the scale exceeds 38 even when the
actual data is small
                 Key: DRILL-1216
                 URL: https://issues.apache.org/jira/browse/DRILL-1216
             Project: Apache Drill
          Issue Type: Bug
          Components: Execution - Data Types
            Reporter: Rahul Challapalli


git.commit.id.abbrev=caa8b78

Input File Contents :
{code}
111.11|222.22|333.33
444.44|555.55|666.66
777.77|888.88|999.99
{code}

The below SQL query gives inaccurate results since the scale of the multiplication is 39 (>38):
{code}
select cast(columns[0] as decimal(15,2)) * cast(columns[1] as decimal(15,2)) * cast(columns[2]
as decimal(15,2)) val from `decimal_scale.tbl`;
+------------+
|     val      |
+------------+
| 1000000000 |
| 0          |
| 0          |
+------------+
{code}

However the below SQL query succeeds :
{code}
 select cast(columns[0] as decimal(5,2)) * cast(columns[1] as decimal(5,2)) * cast(columns[2]
as decimal(5,2)) val from `decimal_scale.tbl`;
+------------+
|     val      |
+------------+
| 8230205.763786 |
| 164604115.275720 |
| 691337284.158024 |
+------------+
{code}



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

Mime
View raw message