Search in sources :

Example 1 with SpillableHashAggregationBuilder

use of com.facebook.presto.operator.aggregation.builder.SpillableHashAggregationBuilder in project presto by prestodb.

the class HashAggregationOperator method addInput.

@Override
public void addInput(Page page) {
    checkState(unfinishedWork == null, "Operator has unfinished work");
    checkState(!finishing, "Operator is already finishing");
    requireNonNull(page, "page is null");
    inputProcessed = true;
    if (aggregationBuilder == null) {
        if (step.isOutputPartial() || !spillEnabled) {
            aggregationBuilder = new InMemoryHashAggregationBuilder(accumulatorFactories, step, expectedGroups, groupByTypes, groupByChannels, hashChannel, operatorContext, maxPartialMemory, joinCompiler, true, useSystemMemory);
        } else {
            verify(!useSystemMemory, "using system memory in spillable aggregations is not supported");
            aggregationBuilder = new SpillableHashAggregationBuilder(accumulatorFactories, step, expectedGroups, groupByTypes, groupByChannels, hashChannel, operatorContext, memoryLimitForMerge, memoryLimitForMergeWithMemory, spillerFactory, joinCompiler);
        }
    // assume initial aggregationBuilder is not full
    } else {
        checkState(!aggregationBuilder.isFull(), "Aggregation buffer is full");
    }
    // process the current page; save the unfinished work if we are waiting for memory
    unfinishedWork = aggregationBuilder.processPage(page);
    if (unfinishedWork.process()) {
        unfinishedWork = null;
    }
    aggregationBuilder.updateMemory();
}
Also used : InMemoryHashAggregationBuilder(com.facebook.presto.operator.aggregation.builder.InMemoryHashAggregationBuilder) SpillableHashAggregationBuilder(com.facebook.presto.operator.aggregation.builder.SpillableHashAggregationBuilder)

Aggregations

InMemoryHashAggregationBuilder (com.facebook.presto.operator.aggregation.builder.InMemoryHashAggregationBuilder)1 SpillableHashAggregationBuilder (com.facebook.presto.operator.aggregation.builder.SpillableHashAggregationBuilder)1