[ 
https://issues.apache.org/jira/browse/HIVE-25117?focusedWorklogId=599123&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-599123
 ]

ASF GitHub Bot logged work on HIVE-25117:
-----------------------------------------

                Author: ASF GitHub Bot
            Created on: 19/May/21 10:28
            Start Date: 19/May/21 10:28
    Worklog Time Spent: 10m 
      Work Description: pgaref commented on a change in pull request #2286:
URL: https://github.com/apache/hive/pull/2286#discussion_r635106215



##########
File path: 
ql/src/java/org/apache/hadoop/hive/ql/optimizer/physical/Vectorizer.java
##########
@@ -4962,9 +4969,8 @@ private static void createVectorPTFDesc(Operator<? 
extends OperatorDesc> ptfOp,
         evaluatorWindowFrameDefs,
         evaluatorInputExprNodeDescLists);
 
-    TypeInfo[] reducerBatchTypeInfos = vContext.getAllTypeInfos();
-
     vectorPTFDesc.setReducerBatchTypeInfos(reducerBatchTypeInfos);
+    
vectorPTFDesc.setReducerBatchDataTypePhysicalVariations(reducerBatchDataTypePhysicalVariations);

Review comment:
       Shall we have setReducerBatchTypeInfos(Types, TypeVariations) instead of 
creating a separate method?
   Seems like a good practice making sure we pas TypeVariations along with 
Types.

##########
File path: ql/src/java/org/apache/hadoop/hive/ql/plan/VectorPTFDesc.java
##########
@@ -487,10 +495,18 @@ public void setOutputColumnNames(String[] 
outputColumnNames) {
     return outputTypeInfos;
   }
 
+  public DataTypePhysicalVariation[] getOutputDataTypePhysicalVariations() {
+    return outputDataTypePhysicalVariations;
+  }
+
   public void setOutputTypeInfos(TypeInfo[] outputTypeInfos) {
     this.outputTypeInfos = outputTypeInfos;
   }
 
+  public void setOutputDataTypePhysicalVariations(DataTypePhysicalVariation[] 
outputDataTypePhysicalVariations) {

Review comment:
       As per comment above this can be simplified

##########
File path: 
ql/src/java/org/apache/hadoop/hive/ql/optimizer/physical/Vectorizer.java
##########
@@ -4978,6 +4984,7 @@ private static void createVectorPTFDesc(Operator<? 
extends OperatorDesc> ptfOp,
 
     vectorPTFDesc.setOutputColumnNames(outputColumnNames);
     vectorPTFDesc.setOutputTypeInfos(outputTypeInfos);
+    
vectorPTFDesc.setOutputDataTypePhysicalVariations(outputDataTypePhysicalVariations);

Review comment:
       Same comment as above for outputTypes

##########
File path: 
ql/src/java/org/apache/hadoop/hive/ql/exec/vector/ptf/VectorPTFOperator.java
##########
@@ -250,13 +253,16 @@ protected VectorizedRowBatch setupOverflowBatch() throws 
HiveException {
     for (int i = 0; i < outputProjectionColumnMap.length; i++) {
       int outputColumn = outputProjectionColumnMap[i];
       String typeName = outputTypeInfos[i].getTypeName();
-      allocateOverflowBatchColumnVector(overflowBatch, outputColumn, typeName);
+      allocateOverflowBatchColumnVector(overflowBatch, outputColumn, typeName, 
outputDataTypePhysicalVariations[i]);
     }
 
     // Now, add any scratch columns needed for children operators.
     int outputColumn = initialColumnCount;
+    DataTypePhysicalVariation[] dataTypePhysicalVariations = 
vOutContext.getScratchDataTypePhysicalVariations();
     for (String typeName : vOutContext.getScratchColumnTypeNames()) {
-      allocateOverflowBatchColumnVector(overflowBatch, outputColumn++, 
typeName);
+      allocateOverflowBatchColumnVector(overflowBatch, outputColumn, typeName,
+          dataTypePhysicalVariations[outputColumn-initialColumnCount]);

Review comment:
       I would expect the ScratchCol Types not to include the initial 
outputCols Types. Why do we need the outputColumn-initialColumnCount here?

##########
File path: ql/src/java/org/apache/hadoop/hive/ql/plan/VectorPTFDesc.java
##########
@@ -419,6 +422,11 @@ public void setReducerBatchTypeInfos(TypeInfo[] 
reducerBatchTypeInfos) {
     this.reducerBatchTypeInfos = reducerBatchTypeInfos;
   }
 
+  public void setReducerBatchDataTypePhysicalVariations(

Review comment:
       As per comment above this can be simplified




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


Issue Time Tracking
-------------------

    Worklog Id:     (was: 599123)
    Time Spent: 20m  (was: 10m)

> Vector PTF ClassCastException with Decimal64
> --------------------------------------------
>
>                 Key: HIVE-25117
>                 URL: https://issues.apache.org/jira/browse/HIVE-25117
>             Project: Hive
>          Issue Type: Bug
>            Reporter: Panagiotis Garefalakis
>            Assignee: Ramesh Kumar Thangarajan
>            Priority: Major
>              Labels: pull-request-available
>         Attachments: vector_ptf_classcast_exception.q
>
>          Time Spent: 20m
>  Remaining Estimate: 0h
>
> Only reproduces when there is at least 1 buffered batch, so needed 2 rows 
> with 1 row/batch:
> {code:java}
> set hive.vectorized.testing.reducer.batch.size=1;
> {code}
> {code:java}
> Caused by: java.lang.ClassCastException: 
> org.apache.hadoop.hive.ql.exec.vector.DecimalColumnVector cannot be cast to 
> org.apache.hadoop.hive.ql.exec.vector.LongColumnVector
>       at 
> org.apache.hadoop.hive.ql.exec.vector.VectorizedBatchUtil.copyNonSelectedColumnVector(VectorizedBatchUtil.java:664)
>       at 
> org.apache.hadoop.hive.ql.exec.vector.ptf.VectorPTFGroupBatches.forwardBufferedBatches(VectorPTFGroupBatches.java:228)
>       at 
> org.apache.hadoop.hive.ql.exec.vector.ptf.VectorPTFGroupBatches.fillGroupResultsAndForward(VectorPTFGroupBatches.java:318)
>       at 
> org.apache.hadoop.hive.ql.exec.vector.ptf.VectorPTFOperator.process(VectorPTFOperator.java:403)
>       at 
> org.apache.hadoop.hive.ql.exec.Operator.vectorForward(Operator.java:919)
>       at 
> org.apache.hadoop.hive.ql.exec.vector.VectorSelectOperator.process(VectorSelectOperator.java:158)
>       at 
> org.apache.hadoop.hive.ql.exec.tez.ReduceRecordSource.processVectorGroup(ReduceRecordSource.java:497)
> {code}



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

Reply via email to