[
https://issues.apache.org/jira/browse/DRILL-6710?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16597951#comment-16597951
]
ASF GitHub Bot commented on DRILL-6710:
---------------------------------------
vvysotskyi commented on a change in pull request #1453: DRILL-6710: Disallow
negative scale for decimal data type
URL: https://github.com/apache/drill/pull/1453#discussion_r214175568
##########
File path:
exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/output/DecimalReturnTypeInference.java
##########
@@ -277,7 +277,7 @@
return TypeProtos.MajorType.newBuilder()
.setMinorType(attributes.getReturnValue().getType().getMinorType())
- .setScale(scale)
+ .setScale(Math.max(scale, 0))
Review comment:
Checks for type inference rules in this class were added only for the cases
when resulting scale/precision depends on the input scale/precision and may
become incorrect for correct values of the scale/precision.
But for the cases when resulting scale/precision is the same as the input
scale/precision, there is no need to add checks since it should be validated at
the stage when such scale/precision is set to the major type.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
> Disallow negative scale for VarDecimal
> --------------------------------------
>
> 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: Volodymyr Vysotskyi
> 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)