kokila-19 commented on code in PR #6575:
URL: https://github.com/apache/hive/pull/6575#discussion_r3600437464


##########
ql/src/java/org/apache/hadoop/hive/ql/optimizer/physical/Vectorizer.java:
##########
@@ -4818,6 +4822,12 @@ public static Operator<? extends OperatorDesc> 
vectorizeSelectOperator(
     // The following method introduces a cast if x or y is DECIMAL_64 and 
parent expression (x % y) is DECIMAL.
     try {
       fixDecimalDataTypePhysicalVariations(vContext, vectorSelectExprs);
+      for (int i = 0; i < size; i++) {
+        int exprIndex = vectorSelectExprIndexForCol[i];
+        if (exprIndex >= 0) {
+          projectedOutputColumns[i] = 
vectorSelectExprs[exprIndex].getOutputColumnNum();
+        }

Review Comment:
   Thanks for pointing this out!
   This is set before fixDecimalDataTypePhysicalVariations(). That method can 
re-instantiate expressions and replace vectorSelectExprs[i]. 
   With the old 2-arg rebuild for a 3-arg multiply ctor, instantiateExpression 
allocated a new output column but projection still pointed at the pre-fix 
output from 4804. The later loop re-reads getOutputColumnNum() from the updated 
vectorSelectExprs so projection matches where the expression actually writes.
   
   Instead of writing it twice, the code is updated to set only once after the 
fixDecimalDataTypePhysicalVariations() now.
   



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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to