Search in sources :

Example 1 with ProjectionFunction

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

the class LocalQueryRunner method createHashProjectOperator.

public static OperatorFactory createHashProjectOperator(int operatorId, PlanNodeId planNodeId, List<Type> columnTypes) {
    ImmutableList.Builder<ProjectionFunction> projectionFunctions = ImmutableList.builder();
    for (int i = 0; i < columnTypes.size(); i++) {
        projectionFunctions.add(ProjectionFunctions.singleColumn(columnTypes.get(i), i));
    }
    projectionFunctions.add(new HashProjectionFunction(columnTypes));
    return new FilterAndProjectOperator.FilterAndProjectOperatorFactory(operatorId, planNodeId, () -> new GenericPageProcessor(FilterFunctions.TRUE_FUNCTION, projectionFunctions.build()), ImmutableList.copyOf(Iterables.concat(columnTypes, ImmutableList.of(BIGINT))));
}
Also used : ProjectionFunction(com.facebook.presto.operator.ProjectionFunction) ImmutableList(com.google.common.collect.ImmutableList) GenericPageProcessor(com.facebook.presto.operator.GenericPageProcessor) Constraint(com.facebook.presto.spi.Constraint)

Example 2 with ProjectionFunction

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

the class FunctionAssertions method interpretedFilterProject.

private Operator interpretedFilterProject(Expression filter, Expression projection, Session session) {
    FilterFunction filterFunction = new InterpretedInternalFilterFunction(filter, SYMBOL_TYPES, INPUT_MAPPING, metadata, SQL_PARSER, session);
    ProjectionFunction projectionFunction = new InterpretedProjectionFunction(projection, SYMBOL_TYPES, INPUT_MAPPING, metadata, SQL_PARSER, session);
    OperatorFactory operatorFactory = new FilterAndProjectOperator.FilterAndProjectOperatorFactory(0, new PlanNodeId("test"), () -> new GenericPageProcessor(filterFunction, ImmutableList.of(projectionFunction)), toTypes(ImmutableList.of(projectionFunction)));
    return operatorFactory.createOperator(createDriverContext(session));
}
Also used : PlanNodeId(com.facebook.presto.sql.planner.plan.PlanNodeId) ProjectionFunction(com.facebook.presto.operator.ProjectionFunction) InterpretedProjectionFunction(com.facebook.presto.sql.planner.InterpretedProjectionFunction) FilterFunction(com.facebook.presto.operator.FilterFunction) InterpretedInternalFilterFunction(com.facebook.presto.sql.planner.InterpretedInternalFilterFunction) SourceOperatorFactory(com.facebook.presto.operator.SourceOperatorFactory) OperatorFactory(com.facebook.presto.operator.OperatorFactory) InterpretedInternalFilterFunction(com.facebook.presto.sql.planner.InterpretedInternalFilterFunction) InterpretedProjectionFunction(com.facebook.presto.sql.planner.InterpretedProjectionFunction) GenericPageProcessor(com.facebook.presto.operator.GenericPageProcessor)

Aggregations

GenericPageProcessor (com.facebook.presto.operator.GenericPageProcessor)2 ProjectionFunction (com.facebook.presto.operator.ProjectionFunction)2 FilterFunction (com.facebook.presto.operator.FilterFunction)1 OperatorFactory (com.facebook.presto.operator.OperatorFactory)1 SourceOperatorFactory (com.facebook.presto.operator.SourceOperatorFactory)1 Constraint (com.facebook.presto.spi.Constraint)1 InterpretedInternalFilterFunction (com.facebook.presto.sql.planner.InterpretedInternalFilterFunction)1 InterpretedProjectionFunction (com.facebook.presto.sql.planner.InterpretedProjectionFunction)1 PlanNodeId (com.facebook.presto.sql.planner.plan.PlanNodeId)1 ImmutableList (com.google.common.collect.ImmutableList)1