use of com.facebook.presto.operator.CursorProcessor 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);
}
}
Aggregations