Search in sources :

Example 1 with CompletedWork

use of com.facebook.presto.operator.CompletedWork in project presto by prestodb.

the class InputPageProjection method project.

@Override
public Work<List<Block>> project(SqlFunctionProperties properties, DriverYieldSignal yieldSignal, Page page, SelectedPositions selectedPositions) {
    Block block = requireNonNull(page, "page is null").getBlock(0);
    requireNonNull(selectedPositions, "selectedPositions is null");
    Block result;
    if (selectedPositions.isList()) {
        result = new DictionaryBlock(selectedPositions.getOffset(), selectedPositions.size(), block.getLoadedBlock(), selectedPositions.getPositions(), false, DictionaryId.randomDictionaryId());
    } else if (selectedPositions.getOffset() == 0 && selectedPositions.size() == page.getPositionCount()) {
        result = block.getLoadedBlock();
    } else {
        result = block.getRegion(selectedPositions.getOffset(), selectedPositions.size());
    }
    return new CompletedWork<>(ImmutableList.of(result));
}
Also used : CompletedWork(com.facebook.presto.operator.CompletedWork) DictionaryBlock(com.facebook.presto.common.block.DictionaryBlock) DictionaryBlock(com.facebook.presto.common.block.DictionaryBlock) Block(com.facebook.presto.common.block.Block)

Aggregations

Block (com.facebook.presto.common.block.Block)1 DictionaryBlock (com.facebook.presto.common.block.DictionaryBlock)1 CompletedWork (com.facebook.presto.operator.CompletedWork)1