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

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

arina-ielchiieva commented on pull request #2006: DRILL-7615: UNION ALL query 
returns the wrong result for the decimal value
URL: https://github.com/apache/drill/pull/2006#discussion_r388235923
 
 

 ##########
 File path: 
exec/java-exec/src/test/java/org/apache/drill/exec/store/parquet/TestVarlenDecimal.java
 ##########
 @@ -139,8 +145,32 @@ public void testWriteReadCsv() throws Exception {
           .baselineValues(new BigDecimal(bigDecimalValue))
           .go();
     } finally {
-      resetSessionOption(ExecConstants.OUTPUT_FORMAT_OPTION);
-      test("drop table if exists dfs.tmp.%s", tableName);
+      client.resetSession(ExecConstants.OUTPUT_FORMAT_OPTION);
+      run("drop table if exists dfs.tmp.%s", tableName);
+    }
+  }
+
+  @Test
+  public void testUnionAllWithDifferentScales() throws Exception {
+    try {
+      run("create table dfs.tmp.t as select cast(999999999999999 as 
decimal(15,0)) as d");
+
+      String query = "select cast(1000 as decimal(10,1)) as d\n" +
+          "union all \n" +
+          "select 596.000 as d \n" +
+          "union all \n" +
+          "select d from dfs.tmp.t";
+
+      testBuilder()
+          .sqlQuery(query)
+          .unOrdered()
+          .baselineColumns("d")
+          .baselineValues(new BigDecimal("1000.000"))
+          .baselineValues(new BigDecimal("596.000"))
+          .baselineValues(new BigDecimal("999999999999999.000"))
 
 Review comment:
   Thanks for explanation.
 
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


> UNION ALL query returns the wrong result for the decimal value
> --------------------------------------------------------------
>
>                 Key: DRILL-7615
>                 URL: https://issues.apache.org/jira/browse/DRILL-7615
>             Project: Apache Drill
>          Issue Type: Bug
>    Affects Versions: 1.14.0
>            Reporter: Vova Vysotskyi
>            Assignee: Vova Vysotskyi
>            Priority: Major
>              Labels: ready-to-commit
>             Fix For: 1.18.0
>
>
> The following query:
> {code:java}
> select cast(1000 as decimal(10,1)) 
> union all 
> select 596.000 
> {code}
> returns incorrect result:
> {code:java}
> 10.000
> 596.000
> {code}
> The expected result is 1000.000 for the first record.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to