private Aggregation getCurrentAggregationBuffer( VectorAggregationBufferRow[] aggregationBufferSets, int aggregateIndex, int row) { VectorAggregationBufferRow mySet = aggregationBufferSets[row]; Aggregation myagg = (Aggregation) mySet.getAggregationBuffer(aggregateIndex); return myagg; }
/** * assigns the given aggregation buffer set to a given batch row (by row number). * populates the selection vector appropriately. This is where the versioning numbers * play a role in determining if the index cached on the aggregation buffer set is stale. */ public void mapAggregationBufferSet(VectorAggregationBufferRow bufferSet, int row) { if (version != bufferSet.getVersion()) { bufferSet.setVersionAndIndex(version, distinctCount); distinctAggregationBuffers[distinctCount] = bufferSet; ++distinctCount; } aggregationBuffers[row] = bufferSet; }
@Override public void endGroup() throws HiveException { if (inGroup && !first) { writeGroupRow(groupAggregators, buffer); groupAggregators.reset(); } inGroup = false; }
@Override public void doProcessBatch(VectorizedRowBatch batch, boolean isFirstGroupingSet, boolean[] currentGroupingSetsOverrideIsNulls) throws HiveException { if (first) { // Copy the group key to output batch now. We'll copy in the aggregates at the end of the group. first = false; // Evaluate the key expressions of just this first batch to get the correct key. for (int i = 0; i < outputKeyLength; i++) { keyExpressions[i].evaluate(batch); } groupKeyHelper.copyGroupKey(batch, outputBatch, buffer); } // Aggregate this batch. for (int i = 0; i < aggregators.length; ++i) { aggregators[i].aggregateInput(groupAggregators.getAggregationBuffer(i), batch); } if (isLastGroupBatch) { writeGroupRow(groupAggregators, buffer); groupAggregators.reset(); } }
VectorAggregateExpression.AggregationBuffer[] aggregationBuffers = new VectorAggregateExpression.AggregationBuffer[] { aggregationBuffer }; bufferRow = new VectorAggregationBufferRow(aggregationBuffers); vectorAggregationBufferRows[key] = bufferRow; vectorAggregationBufferRow.getAggregationBuffer(0); vecAggrExpr.assignRowColumn(outputBatch, outputBatch.size++, 0, aggregationBuffer);
/** * allocates a new aggregation buffer set. */ protected VectorAggregationBufferRow allocateAggregationBuffer() throws HiveException { VectorAggregateExpression.AggregationBuffer[] aggregationBuffers = new VectorAggregateExpression.AggregationBuffer[aggregators.length]; for (int i=0; i < aggregators.length; ++i) { aggregationBuffers[i] = aggregators[i].getNewAggregationBuffer(); aggregators[i].reset(aggregationBuffers[i]); } VectorAggregationBufferRow bufferSet = new VectorAggregationBufferRow(aggregationBuffers); return bufferSet; }
/** * Evaluates the aggregators on the current batch. * The aggregationBatchInfo must have been prepared * by calling {@link #prepareBatchAggregationBufferSets} first. */ protected void processAggregators(VectorizedRowBatch batch) throws HiveException { // We now have a vector of aggregation buffer sets to use for each row // We can start computing the aggregates. // If the number of distinct keys in the batch is 1 we can // use the optimized code path of aggregateInput VectorAggregationBufferRow[] aggregationBufferSets = aggregationBatchInfo.getAggregationBuffers(); if (aggregationBatchInfo.getDistinctBufferSetCount() == 1) { VectorAggregateExpression.AggregationBuffer[] aggregationBuffers = aggregationBufferSets[0].getAggregationBuffers(); for (int i = 0; i < aggregators.length; ++i) { aggregators[i].aggregateInput(aggregationBuffers[i], batch); } } else { for (int i = 0; i < aggregators.length; ++i) { aggregators[i].aggregateInputSelection( aggregationBufferSets, i, batch); } } }
/** * allocates a new aggregation buffer set. */ protected VectorAggregationBufferRow allocateAggregationBuffer() throws HiveException { VectorAggregateExpression.AggregationBuffer[] aggregationBuffers = new VectorAggregateExpression.AggregationBuffer[aggregators.length]; for (int i=0; i < aggregators.length; ++i) { aggregationBuffers[i] = aggregators[i].getNewAggregationBuffer(); aggregators[i].reset(aggregationBuffers[i]); } VectorAggregationBufferRow bufferSet = new VectorAggregationBufferRow(aggregationBuffers); return bufferSet; }
/** * Evaluates the aggregators on the current batch. * The aggregationBatchInfo must have been prepared * by calling {@link #prepareBatchAggregationBufferSets} first. */ protected void processAggregators(VectorizedRowBatch batch) throws HiveException { // We now have a vector of aggregation buffer sets to use for each row // We can start computing the aggregates. // If the number of distinct keys in the batch is 1 we can // use the optimized code path of aggregateInput VectorAggregationBufferRow[] aggregationBufferSets = aggregationBatchInfo.getAggregationBuffers(); if (aggregationBatchInfo.getDistinctBufferSetCount() == 1) { VectorAggregateExpression.AggregationBuffer[] aggregationBuffers = aggregationBufferSets[0].getAggregationBuffers(); for (int i = 0; i < aggregators.length; ++i) { aggregators[i].aggregateInput(aggregationBuffers[i], batch); } } else { for (int i = 0; i < aggregators.length; ++i) { aggregators[i].aggregateInputSelection( aggregationBufferSets, i, batch); } } }
private Aggregation getCurrentAggregationBuffer( VectorAggregationBufferRow[] aggregationBufferSets, int aggregrateIndex, int row) { VectorAggregationBufferRow mySet = aggregationBufferSets[row]; Aggregation myagg = (Aggregation) mySet.getAggregationBuffer(aggregrateIndex); return myagg; }
/** * assigns the given aggregation buffer set to a given batch row (by row number). * populates the selection vector appropriately. This is where the versioning numbers * play a role in determining if the index cached on the aggregation buffer set is stale. */ public void mapAggregationBufferSet(VectorAggregationBufferRow bufferSet, int row) { if (version != bufferSet.getVersion()) { bufferSet.setVersionAndIndex(version, distinctCount); distinctAggregationBuffers[distinctCount] = bufferSet; ++distinctCount; } aggregationBuffers[row] = bufferSet; }
/** * allocates a new aggregation buffer set. */ protected VectorAggregationBufferRow allocateAggregationBuffer() throws HiveException { VectorAggregateExpression.AggregationBuffer[] aggregationBuffers = new VectorAggregateExpression.AggregationBuffer[aggregators.length]; for (int i=0; i < aggregators.length; ++i) { aggregationBuffers[i] = aggregators[i].getNewAggregationBuffer(); aggregators[i].reset(aggregationBuffers[i]); } VectorAggregationBufferRow bufferSet = new VectorAggregationBufferRow(aggregationBuffers); return bufferSet; }
rowsToFlush[i].reset(); keysToFlush[i] = null; streamAggregationBufferRowPool.putInPool(rowsToFlush[i]);
/** * Evaluates the aggregators on the current batch. * The aggregationBatchInfo must have been prepared * by calling {@link #prepareBatchAggregationBufferSets} first. */ protected void processAggregators(VectorizedRowBatch batch) throws HiveException { // We now have a vector of aggregation buffer sets to use for each row // We can start computing the aggregates. // If the number of distinct keys in the batch is 1 we can // use the optimized code path of aggregateInput VectorAggregationBufferRow[] aggregationBufferSets = aggregationBatchInfo.getAggregationBuffers(); if (aggregationBatchInfo.getDistinctBufferSetCount() == 1) { VectorAggregateExpression.AggregationBuffer[] aggregationBuffers = aggregationBufferSets[0].getAggregationBuffers(); for (int i = 0; i < aggregators.length; ++i) { aggregators[i].aggregateInput(aggregationBuffers[i], batch); } } else { for (int i = 0; i < aggregators.length; ++i) { aggregators[i].aggregateInputSelection( aggregationBufferSets, i, batch); } } }
private Aggregation getCurrentAggregationBuffer( VectorAggregationBufferRow[] aggregationBufferSets, int aggregateIndex, int row) { VectorAggregationBufferRow mySet = aggregationBufferSets[row]; Aggregation myagg = (Aggregation) mySet.getAggregationBuffer(aggregateIndex); return myagg; }
/** * assigns the given aggregation buffer set to a given batch row (by row number). * populates the selection vector appropriately. This is where the versioning numbers * play a role in determining if the index cached on the aggregation buffer set is stale. */ public void mapAggregationBufferSet(VectorAggregationBufferRow bufferSet, int row) { if (version != bufferSet.getVersion()) { bufferSet.setVersionAndIndex(version, distinctCount); distinctAggregationBuffers[distinctCount] = bufferSet; ++distinctCount; } aggregationBuffers[row] = bufferSet; }
rowsToFlush[i].reset(); streamAggregationBufferRowPool.putInPool(rowsToFlush[i]);
private Aggregation getCurrentAggregationBuffer( VectorAggregationBufferRow[] aggregationBufferSets, int aggregrateIndex, int row) { VectorAggregationBufferRow mySet = aggregationBufferSets[row]; Aggregation myagg = (Aggregation) mySet.getAggregationBuffer(aggregrateIndex); return myagg; }
@Override public void endGroup() throws HiveException { if (inGroup && !first) { writeGroupRow(groupAggregators, buffer); groupAggregators.reset(); } inGroup = false; }
private Aggregation getCurrentAggregationBuffer( VectorAggregationBufferRow[] aggregationBufferSets, int bufferIndex, int row) { VectorAggregationBufferRow mySet = aggregationBufferSets[row]; Aggregation myagg = (Aggregation) mySet.getAggregationBuffer(bufferIndex); return myagg; }