arina-ielchiieva commented on a change in 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_r388138604
 
 

 ##########
 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:
   Not sure why this will be complex.
   Here is an example:
   ```
       RowSet actual = client.queryBuilder().sql(sql).rowSet();
   
       TupleMetadata expectedSchema = new SchemaBuilder()
           // add your schema here 
           .buildSchema();
       RowSet expected = new RowSetBuilder(client.allocator(), expectedSchema)
          // add your columns here
           .build();
       RowSetUtilities.verify(expected, actual);
   ```
   See `TestCsvIgnoreHeaders` for example.

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


With regards,
Apache Git Services

Reply via email to