RowExpression traslatedFilter = SqlToRowExpressionTranslator.translate(rewrittenFilter, expressionTypes, metadata, session, true);
List<RowExpression> translatedProjections = SqlToRowExpressionTranslator.translate(rewrittenProjections, expressionTypes, metadata, session, true);
if (columns != null) {
CursorProcessor cursorProcessor = compiler.compileCursorProcessor(traslatedFilter, translatedProjections, sourceNode.getId());
PageProcessor pageProcessor = compiler.compilePageProcessor(traslatedFilter, translatedProjections);
SourceOperatorFactory operatorFactory = new ScanFilterAndProjectOperator.ScanFilterAndProjectOperatorFactory(
context.getNextOperatorId(),
sourceNode.getId(),
dataStreamProvider,
cursorProcessor,
pageProcessor,
columns,
Lists.transform(rewrittenProjections, forMap(expressionTypes)));
return new PhysicalOperation(operatorFactory, outputMappings);
}
else {
PageProcessor processor = compiler.compilePageProcessor(traslatedFilter, translatedProjections);
OperatorFactory operatorFactory = new FilterAndProjectOperator.FilterAndProjectOperatorFactory(
context.getNextOperatorId(),
processor,
Lists.transform(rewrittenProjections, forMap(expressionTypes)));