use of com.facebook.presto.operator.PageProcessor in project presto by prestodb.
the class BenchmarkDecimalOperators method execute.
private List<Page> execute(BaseState state) {
ImmutableList.Builder<Page> pages = ImmutableList.builder();
Page inputPage = state.getInputPage();
PageBuilder pageBuilder = state.getPageBuilder();
PageProcessor processor = state.getProcessor();
int currentPosition = 0;
while (currentPosition < PAGE_SIZE) {
pageBuilder.reset();
currentPosition = processor.process(null, inputPage, currentPosition, inputPage.getPositionCount(), pageBuilder);
pages.add(pageBuilder.build());
}
return pages.build();
}
use of com.facebook.presto.operator.PageProcessor in project presto by prestodb.
the class FunctionAssertions method compileScanFilterProject.
private SourceOperatorFactory compileScanFilterProject(Expression filter, Expression projection, ExpressionCompiler compiler) {
filter = new SymbolToInputRewriter(INPUT_MAPPING).rewrite(filter);
projection = new SymbolToInputRewriter(INPUT_MAPPING).rewrite(projection);
IdentityLinkedHashMap<Expression, Type> expressionTypes = getExpressionTypesFromInput(TEST_SESSION, metadata, SQL_PARSER, INPUT_TYPES, ImmutableList.of(filter, projection), emptyList());
try {
Supplier<CursorProcessor> cursorProcessor = compiler.compileCursorProcessor(toRowExpression(filter, expressionTypes), ImmutableList.of(toRowExpression(projection, expressionTypes)), SOURCE_ID);
Supplier<PageProcessor> pageProcessor = compiler.compilePageProcessor(toRowExpression(filter, expressionTypes), ImmutableList.of(toRowExpression(projection, expressionTypes)));
return new ScanFilterAndProjectOperator.ScanFilterAndProjectOperatorFactory(0, new PlanNodeId("test"), SOURCE_ID, PAGE_SOURCE_PROVIDER, cursorProcessor, pageProcessor, ImmutableList.of(), ImmutableList.of(expressionTypes.get(projection)));
} catch (Throwable e) {
if (e instanceof UncheckedExecutionException) {
e = e.getCause();
}
throw new RuntimeException("Error compiling " + projection + ": " + e.getMessage(), e);
}
}
use of com.facebook.presto.operator.PageProcessor in project presto by prestodb.
the class FunctionAssertions method compileFilterWithNoInputColumns.
private OperatorFactory compileFilterWithNoInputColumns(Expression filter, ExpressionCompiler compiler) {
filter = new SymbolToInputRewriter(ImmutableMap.of()).rewrite(filter);
IdentityLinkedHashMap<Expression, Type> expressionTypes = getExpressionTypesFromInput(TEST_SESSION, metadata, SQL_PARSER, INPUT_TYPES, ImmutableList.of(filter), emptyList());
try {
Supplier<PageProcessor> processor = compiler.compilePageProcessor(toRowExpression(filter, expressionTypes), ImmutableList.of());
return new FilterAndProjectOperator.FilterAndProjectOperatorFactory(0, new PlanNodeId("test"), processor, ImmutableList.of());
} catch (Throwable e) {
if (e instanceof UncheckedExecutionException) {
e = e.getCause();
}
throw new RuntimeException("Error compiling " + filter + ": " + e.getMessage(), e);
}
}
use of com.facebook.presto.operator.PageProcessor in project presto by prestodb.
the class FunctionAssertions method compileFilterProject.
private OperatorFactory compileFilterProject(Expression filter, Expression projection, ExpressionCompiler compiler) {
filter = new SymbolToInputRewriter(INPUT_MAPPING).rewrite(filter);
projection = new SymbolToInputRewriter(INPUT_MAPPING).rewrite(projection);
IdentityLinkedHashMap<Expression, Type> expressionTypes = getExpressionTypesFromInput(TEST_SESSION, metadata, SQL_PARSER, INPUT_TYPES, ImmutableList.of(filter, projection), emptyList());
try {
List<RowExpression> projections = ImmutableList.of(toRowExpression(projection, expressionTypes));
Supplier<PageProcessor> processor = compiler.compilePageProcessor(toRowExpression(filter, expressionTypes), projections);
return new FilterAndProjectOperator.FilterAndProjectOperatorFactory(0, new PlanNodeId("test"), processor, ImmutableList.of(expressionTypes.get(projection)));
} catch (Throwable e) {
if (e instanceof UncheckedExecutionException) {
e = e.getCause();
}
throw new RuntimeException("Error compiling " + projection + ": " + e.getMessage(), e);
}
}
use of com.facebook.presto.operator.PageProcessor in project presto by prestodb.
the class DynamicTupleFilterFactory method filterWithTuple.
public OperatorFactory filterWithTuple(Page tuplePage) {
Page normalizedTuplePage = normalizeTuplePage(tuplePage);
Supplier<PageProcessor> processor = () -> new TupleFilterProcessor(normalizedTuplePage, outputTypes, outputFilterChannels);
return new FilterAndProjectOperatorFactory(filterOperatorId, planNodeId, processor, outputTypes);
}
Aggregations