[
https://issues.apache.org/jira/browse/DRILL-6710?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16595435#comment-16595435
]
Robert Hou commented on DRILL-6710:
-----------------------------------
I tried this query on both platforms:
select cast('9' as decimal(1,0)) +
cast('9' as decimal(1,0)) +
cast('9' as decimal(1,0)) +
cast('9' as decimal(1,0)) +
cast('9' as decimal(1,0)) +
cast('9' as decimal(1,0)) +
cast('9' as decimal(1,0)) +
cast('9' as decimal(1,0)) +
cast('9' as decimal(1,0)) +
cast('9' as decimal(1,0)) +
cast('9' as decimal(1,0)) +
cast('9' as decimal(1,0)) +
cast('9' as decimal(1,0)) +
cast('9' as decimal(1,0)) +
cast('9' as decimal(1,0)) +
cast('9' as decimal(1,0)) +
cast('9' as decimal(1,0)) +
cast('9' as decimal(1,0)) +
cast('9' as decimal(1,0)) +
cast('9' as decimal(1,0)) +
cast('9' as decimal(1,0)) +
cast('9' as decimal(1,0)) +
cast('9' as decimal(1,0)) +
cast('9' as decimal(1,0)) +
cast('9' as decimal(1,0)) +
cast('9' as decimal(1,0)) +
cast('9' as decimal(1,0)) +
cast('9' as decimal(1,0)) +
cast('9' as decimal(1,0)) +
cast('9' as decimal(1,0)) +
cast('9' as decimal(1,0)) +
cast('9' as decimal(1,0)) +
cast('9' as decimal(1,0)) +
cast('9' as decimal(1,0)) +
cast('9' as decimal(1,0)) +
cast('9' as decimal(1,0)) +
cast('9' as decimal(1,0)) +
cast('9' as decimal(1,0)) +
cast('9' as decimal(1,0)) +
cast('9' as decimal(1,0))
from data limit 1;
Both SQL and Drill return a value. Drill returns a more accurate value because
the answer is 360, and Drill rounds this to 400. SQL returns 360.
If I use CTAS to store the value in a table, Drill cannot read the table:
{noformat}
0: jdbc:drill:drillbit=10.10.100.186> select * from td20;
Error: SYSTEM ERROR: IllegalArgumentException: Invalid DECIMAL scale: -2
[Error Id: 12a150cb-f003-4ca2-b3a7-6230d897237c on qa-node186.qa.lab:31010]
(state=,code=0)
{noformat}
With SQL, I created a table with decimal (38,0), and it stored the value and I
can read it back.
Also, sum does not work on Drill, but it works with SQL.
> Drill C++ Client does not handle scale = 0 properly for decimal
> ---------------------------------------------------------------
>
> Key: DRILL-6710
> URL: https://issues.apache.org/jira/browse/DRILL-6710
> Project: Apache Drill
> Issue Type: Bug
> Components: Execution - Relational Operators
> Affects Versions: 1.14.0
> Reporter: Robert Hou
> Assignee: Sorabh Hamirwasia
> Priority: Major
> Fix For: 1.15.0
>
>
> Query is:
> select cast('999999999999999999' as decimal(18,0)) +
> cast('9999999999999999999999999999999999999' as decimal(38,0)) from data
> limit 1
> This is the error I get when my test program calls SQLExecDirect:
> The driver reported the following diagnostics whilst running SQLExecDirect
> HY000:1:40140:[MapR][Support] (40140) Scale can't be less than zero.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)