[
https://issues.apache.org/jira/browse/DRILL-6710?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16591666#comment-16591666
]
Volodymyr Vysotskyi commented on DRILL-6710:
--------------------------------------------
Using negative scale was done due to the limitation of max numeric precision to
allow at least storing significant digits for large values.
Some databases, like Oracle, allow using decimals with the negative scale but
looks like according to SQL spec a scale should be non-negative:
{quote}4.4.2 Characteristics of numbers
An exact numeric type has a precision P and a scale S. P is a positive integer
that determines the number of significant digits in a particular radix R, where
R is either 2 or 10. S is a non-negative integer.
{quote}
The current implementation in Drill allows just returning decimals with the
negative scale.
Most of the JDBC clients (including SQuirrel) also support it.
We should decide what should we do: follow the SQL standard and throw an
exception for such cases or take a step to the side and keep allowing it. In
the last scenario, native Drill ODBC client should be modified to handle such
cases correctly.
> 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)