mustafaiman commented on a change in pull request #1481:
URL: https://github.com/apache/hive/pull/1481#discussion_r486463497



##########
File path: 
ql/src/java/org/apache/hadoop/hive/ql/exec/vector/VectorGroupByOperator.java
##########
@@ -427,8 +428,12 @@ public void initialize(Configuration hconf) throws 
HiveException {
       computeMemoryLimits();
       LOG.debug("using hash aggregation processing mode");
 
+      reusableBufferSize = (int) (maxHtEntries * percentEntriesToFlush);
+
+      reusableAggregationBufferRows = new ArrayDeque<>(reusableBufferSize);
+
       if (keyWrappersBatch.getVectorHashKeyWrappers()[0] instanceof 
VectorHashKeyWrapperGeneral) {

Review comment:
       @rbalamohan 
   The array that is returned from 
`keyWrappersBatch.getVectorHashKeyWrappers()` consists of only one type of 
wrappers, isn't it? So the first element is representative of all the elements 
in that array.
   
   We resort to this optimization only when the batch consists of 
VectorHashKeyWrapperGeneral. The other wrapper types have only one two 
primitive types. If needed, only thing we need to do is just override their 
copyKey(KeyWrapper) method and generalize this `instanceOf` check to cover them 
too. Right now, I dont think that is very important.
   
   So when the first element is not VectorHashKeyWrapperGeneral, the rest of 
the array are not either. In that case, we just skip reusing.




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



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

Reply via email to