Search in sources :

Example 1 with LocalPlannerAware

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

the class LocalExecutionPlanner method plan.

public LocalExecutionPlan plan(Session session, PlanNode plan, List<Symbol> outputLayout, Map<Symbol, Type> types, OutputFactory outputOperatorFactory) {
    LocalExecutionPlanContext context = new LocalExecutionPlanContext(session, types);
    PhysicalOperation physicalOperation = plan.accept(new Visitor(session), context);
    Function<Page, Page> pagePreprocessor = enforceLayoutProcessor(outputLayout, physicalOperation.getLayout());
    List<Type> outputTypes = outputLayout.stream().map(types::get).collect(toImmutableList());
    context.addDriverFactory(context.isInputDriver(), true, ImmutableList.<OperatorFactory>builder().addAll(physicalOperation.getOperatorFactories()).add(outputOperatorFactory.createOutputOperator(context.getNextOperatorId(), plan.getId(), outputTypes, pagePreprocessor, new PagesSerdeFactory(blockEncodingSerde, isExchangeCompressionEnabled(session)))).build(), context.getDriverInstanceCount());
    addLookupOuterDrivers(context);
    // notify operator factories that planning has completed
    context.getDriverFactories().stream().map(DriverFactory::getOperatorFactories).flatMap(List::stream).filter(LocalPlannerAware.class::isInstance).map(LocalPlannerAware.class::cast).forEach(LocalPlannerAware::localPlannerComplete);
    return new LocalExecutionPlan(context.getDriverFactories());
}
Also used : PagesSerdeFactory(com.facebook.presto.execution.buffer.PagesSerdeFactory) Type(com.facebook.presto.spi.type.Type) PlanVisitor(com.facebook.presto.sql.planner.plan.PlanVisitor) DistinctLimitOperatorFactory(com.facebook.presto.operator.DistinctLimitOperator.DistinctLimitOperatorFactory) UnnestOperatorFactory(com.facebook.presto.operator.UnnestOperator.UnnestOperatorFactory) LimitOperatorFactory(com.facebook.presto.operator.LimitOperator.LimitOperatorFactory) JoinOperatorFactory(com.facebook.presto.operator.JoinOperatorFactory) MetadataDeleteOperatorFactory(com.facebook.presto.operator.MetadataDeleteOperator.MetadataDeleteOperatorFactory) TableScanOperatorFactory(com.facebook.presto.operator.TableScanOperator.TableScanOperatorFactory) HashBuilderOperatorFactory(com.facebook.presto.operator.HashBuilderOperator.HashBuilderOperatorFactory) SourceOperatorFactory(com.facebook.presto.operator.SourceOperatorFactory) MarkDistinctOperatorFactory(com.facebook.presto.operator.MarkDistinctOperator.MarkDistinctOperatorFactory) ExplainAnalyzeOperatorFactory(com.facebook.presto.operator.ExplainAnalyzeOperator.ExplainAnalyzeOperatorFactory) OperatorFactory(com.facebook.presto.operator.OperatorFactory) TableWriterOperatorFactory(com.facebook.presto.operator.TableWriterOperator.TableWriterOperatorFactory) NestedLoopBuildOperatorFactory(com.facebook.presto.operator.NestedLoopBuildOperator.NestedLoopBuildOperatorFactory) LocalExchangeSinkOperatorFactory(com.facebook.presto.operator.exchange.LocalExchangeSinkOperator.LocalExchangeSinkOperatorFactory) ExchangeOperatorFactory(com.facebook.presto.operator.ExchangeOperator.ExchangeOperatorFactory) LocalExchangeSourceOperatorFactory(com.facebook.presto.operator.exchange.LocalExchangeSourceOperator.LocalExchangeSourceOperatorFactory) NestedLoopJoinOperatorFactory(com.facebook.presto.operator.NestedLoopJoinOperator.NestedLoopJoinOperatorFactory) TopNOperatorFactory(com.facebook.presto.operator.TopNOperator.TopNOperatorFactory) ValuesOperatorFactory(com.facebook.presto.operator.ValuesOperator.ValuesOperatorFactory) AggregationOperatorFactory(com.facebook.presto.operator.AggregationOperator.AggregationOperatorFactory) TableFinishOperatorFactory(com.facebook.presto.operator.TableFinishOperator.TableFinishOperatorFactory) OrderByOperatorFactory(com.facebook.presto.operator.OrderByOperator.OrderByOperatorFactory) HashAggregationOperatorFactory(com.facebook.presto.operator.HashAggregationOperator.HashAggregationOperatorFactory) SetBuilderOperatorFactory(com.facebook.presto.operator.SetBuilderOperator.SetBuilderOperatorFactory) HashSemiJoinOperatorFactory(com.facebook.presto.operator.HashSemiJoinOperator.HashSemiJoinOperatorFactory) WindowOperatorFactory(com.facebook.presto.operator.WindowOperator.WindowOperatorFactory) DeleteOperatorFactory(com.facebook.presto.operator.DeleteOperator.DeleteOperatorFactory) DriverFactory(com.facebook.presto.operator.DriverFactory) Page(com.facebook.presto.spi.Page) LocalPlannerAware(com.facebook.presto.operator.LocalPlannerAware)

Aggregations

PagesSerdeFactory (com.facebook.presto.execution.buffer.PagesSerdeFactory)1 AggregationOperatorFactory (com.facebook.presto.operator.AggregationOperator.AggregationOperatorFactory)1 DeleteOperatorFactory (com.facebook.presto.operator.DeleteOperator.DeleteOperatorFactory)1 DistinctLimitOperatorFactory (com.facebook.presto.operator.DistinctLimitOperator.DistinctLimitOperatorFactory)1 DriverFactory (com.facebook.presto.operator.DriverFactory)1 ExchangeOperatorFactory (com.facebook.presto.operator.ExchangeOperator.ExchangeOperatorFactory)1 ExplainAnalyzeOperatorFactory (com.facebook.presto.operator.ExplainAnalyzeOperator.ExplainAnalyzeOperatorFactory)1 HashAggregationOperatorFactory (com.facebook.presto.operator.HashAggregationOperator.HashAggregationOperatorFactory)1 HashBuilderOperatorFactory (com.facebook.presto.operator.HashBuilderOperator.HashBuilderOperatorFactory)1 HashSemiJoinOperatorFactory (com.facebook.presto.operator.HashSemiJoinOperator.HashSemiJoinOperatorFactory)1 JoinOperatorFactory (com.facebook.presto.operator.JoinOperatorFactory)1 LimitOperatorFactory (com.facebook.presto.operator.LimitOperator.LimitOperatorFactory)1 LocalPlannerAware (com.facebook.presto.operator.LocalPlannerAware)1 MarkDistinctOperatorFactory (com.facebook.presto.operator.MarkDistinctOperator.MarkDistinctOperatorFactory)1 MetadataDeleteOperatorFactory (com.facebook.presto.operator.MetadataDeleteOperator.MetadataDeleteOperatorFactory)1 NestedLoopBuildOperatorFactory (com.facebook.presto.operator.NestedLoopBuildOperator.NestedLoopBuildOperatorFactory)1 NestedLoopJoinOperatorFactory (com.facebook.presto.operator.NestedLoopJoinOperator.NestedLoopJoinOperatorFactory)1 OperatorFactory (com.facebook.presto.operator.OperatorFactory)1 OrderByOperatorFactory (com.facebook.presto.operator.OrderByOperator.OrderByOperatorFactory)1 SetBuilderOperatorFactory (com.facebook.presto.operator.SetBuilderOperator.SetBuilderOperatorFactory)1