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));
}
Aggregations