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

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

paul-rogers 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_r386777176
 
 

 ##########
 File path: 
exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/union/UnionAllRecordBatch.java
 ##########
 @@ -184,38 +184,43 @@ private void createUnionAller(RecordBatch inputBatch) {
       ValueVector vvIn = vw.getValueVector();
       ValueVector vvOut = container.getValueVector(index).getValueVector();
 
-      final ErrorCollector collector = new ErrorCollectorImpl();
-      // According to input data names, Minortypes, Datamodes, choose to
+      MaterializedField inField = vvIn.getField();
+      MaterializedField outputField = vvOut.getField();
+
+      ErrorCollector collector = new ErrorCollectorImpl();
+      // According to input data names, MinorTypes, DataModes, choose to
       // transfer directly,
       // rename columns or
-      // cast data types (Minortype or DataMode)
-      if 
(container.getSchema().getColumn(index).hasSameTypeAndMode(vvIn.getField())
-          && vvIn.getField().getType().getMinorType() != 
TypeProtos.MinorType.MAP // Per DRILL-5521, existing bug for map transfer
-          ) {
+      // cast data types (MinorType or DataMode)
+      if (outputField.hasSameTypeAndMode(inField)
 
 Review comment:
   Nit: Seems cleaner to add this predicate to `Types`: `isSameTypeAndMode()`, 
then say:
   
   ```
   if (Types.isSameTypeAndMode(outputField.getType(), inputField.getType()) {
   ```
 
----------------------------------------------------------------
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