You are viewing a plain text version of this content. The canonical link for it is here.
Posted to gitbox@hive.apache.org by GitBox <gi...@apache.org> on 2021/05/19 10:28:21 UTC

[GitHub] [hive] pgaref commented on a change in pull request #2286: HIVE-25117 Vector PTF ClassCastException with Decimal64

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



---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org