[
https://issues.apache.org/jira/browse/DRILL-6710?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16591966#comment-16591966
]
Robert Hou edited comment on DRILL-6710 at 8/24/18 5:37 PM:
------------------------------------------------------------
I think we should have consistent behavior with our multiple clients. If the
Apache JDBC driver accepts this behavior, then our Simba drivers should accept
this behavior.
I am not sure there is a universal SQL standard. It seems Oracle has
implemented more than the SQL standard, hence most JDBC clients support
negative scale values. If Drill's implementation is following Oracle's
implementation, then we should ask Simba to support it.
If we are following the SQL spec (I think SQL Server follows the SQL spec),
then perhaps we should keep scale to be non-negative. I looked at this page:
https://docs.microsoft.com/en-us/sql/t-sql/data-types/precision-scale-and-length-transact-sql?view=sql-server-2017
Does this apply?
{noformat}
Resulting scale is MIN(precision, 38) - max(p1 – s1, p2 – s2), so the
fractional part might be rounded to fit into the resulting scale.
{noformat}
was (Author: rhou):
I think we should have consistent behavior with our multiple clients. If the
Apache JDBC driver accepts this behavior, then our Simba drivers should accept
this behavior.
I am not sure there is a universal SQL standard. It seems Oracle has
implemented more than the SQL standard, hence most JDBC clients support
negative scale values. If Drill's implementation is following Oracle's
implementation, then we should ask Simba to support it.
If we are following the SQL Server design, then perhaps we should keep scale to
be non-negative. I looked at this page:
https://docs.microsoft.com/en-us/sql/t-sql/data-types/precision-scale-and-length-transact-sql?view=sql-server-2017
Does this apply?
{noformat}
Resulting scale is MIN(precision, 38) - max(p1 – s1, p2 – s2), so the
fractional part might be rounded to fit into the resulting scale.
{noformat}
> 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)