[ 
https://issues.apache.org/jira/browse/DRILL-6710?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16596117#comment-16596117
 ] 

ASF GitHub Bot commented on DRILL-6710:
---------------------------------------

vvysotskyi commented on a change in pull request #1451: DRILL-6710: Drill C++ 
Client does not handle scale = 0 properly for d…
URL: https://github.com/apache/drill/pull/1451#discussion_r213603063
 
 

 ##########
 File path: 
exec/java-exec/src/test/java/org/apache/drill/TestFunctionsQuery.java
 ##########
 @@ -394,17 +398,30 @@ public void testLiteralCastToTINYINTYieldsTINYINT() 
throws Exception {
 
 
   @Test
-  public void testDecimalMultiplicationOverflowHandling() throws Exception {
+  public void testDecimalMultiplicationOverflowNegativeScale() throws 
Exception {
+    String query = "select cast('1000000000000000001.000000000000000000' as 
decimal(38, 18)) * " +
+      "cast('0.999999999999999999' as decimal(38, 18)) as DEC38_1 from 
cp.`employee.json` where employee_id = 1";
+    try {
+      test(query);
+      fail();
+    } catch (Exception ex) {
 
 Review comment:
   Could you please rewrite this test to use `ExpectedException` rule? It will 
allow avoiding `try catch` block and clearer validating error type. 
   
   Also, I think it is enough to check that error message contains a string 
"VALIDATION ERROR:" instead of checking `getErrorType()` and add a check for a 
string, where current precision and scale are displayed.

----------------------------------------------------------------
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:
us...@infra.apache.org


> 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)

Reply via email to