You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@drill.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2018/08/30 07:26:00 UTC

[jira] [Commented] (DRILL-6710) Disallow negative scale for VarDecimal

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

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

sohami 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_r213745915
 
 

 ##########
 File path: exec/java-exec/src/test/java/org/apache/drill/exec/fn/impl/TestVarDecimalFunctions.java
 ##########
 @@ -73,10 +78,26 @@ public void testDecimalAdd() throws Exception {
             new BigDecimal("1358024680358024680358024680358024.679"),
             new BigDecimal("1234567891234567891234567891234567.890"),
             new BigDecimal("2.09"), new BigDecimal("-1.91"), new BigDecimal("-12.93"),
-            new BigDecimal("1.3234567891234567891234567890469135782E+38"))
+            new BigDecimal("13234567891234567891234567890469135782"))
         .go();
   }
 
+  @Test
+  public void testDecimalAdd_OverflowWithNegativeScale() {
+    String query =
+      "select\n" +
+        // check trimming (negative scale)
+        "cast('99999999999999999999999999992345678912' as DECIMAL(38, 0))\n" +
+        "+ cast('32345678912345678912345678912345678912' as DECIMAL(38, 0)) as s7";
+    try {
+      test(query);
+      fail();
+    } catch (Exception ex) {
 
 Review comment:
   added check using `ExpectedException`

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


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