use of io.druid.query.aggregation.BufferAggregator in project druid by druid-io.
the class OffheapIncrementalIndex method initAggs.
@Override
protected BufferAggregator[] initAggs(AggregatorFactory[] metrics, Supplier<InputRow> rowSupplier, boolean deserializeComplexMetrics) {
selectors = Maps.newHashMap();
aggOffsetInBuffer = new int[metrics.length];
for (int i = 0; i < metrics.length; i++) {
AggregatorFactory agg = metrics[i];
ColumnSelectorFactory columnSelectorFactory = makeColumnSelectorFactory(agg, rowSupplier, deserializeComplexMetrics);
selectors.put(agg.getName(), new OnheapIncrementalIndex.ObjectCachingColumnSelectorFactory(columnSelectorFactory));
if (i == 0) {
aggOffsetInBuffer[i] = 0;
} else {
aggOffsetInBuffer[i] = aggOffsetInBuffer[i - 1] + metrics[i - 1].getMaxIntermediateSize();
}
}
aggsTotalSize = aggOffsetInBuffer[metrics.length - 1] + metrics[metrics.length - 1].getMaxIntermediateSize();
return new BufferAggregator[metrics.length];
}
Aggregations