Search in sources :

Example 6 with BufferAggregator

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];
}
Also used : ColumnSelectorFactory(io.druid.segment.ColumnSelectorFactory) AggregatorFactory(io.druid.query.aggregation.AggregatorFactory) BufferAggregator(io.druid.query.aggregation.BufferAggregator)

Aggregations

BufferAggregator (io.druid.query.aggregation.BufferAggregator)6 ByteBuffer (java.nio.ByteBuffer)4 AggregatorFactory (io.druid.query.aggregation.AggregatorFactory)3 ISE (io.druid.java.util.common.ISE)1 ParseException (io.druid.java.util.common.parsers.ParseException)1 ColumnSelectorFactory (io.druid.segment.ColumnSelectorFactory)1 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)1