Search in sources :

Example 31 with OperatorFactory

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

the class IndexBuildDriverFactoryProvider method createStreaming.

public DriverFactory createStreaming(PageBuffer pageBuffer, Page indexKeyTuple) {
    ImmutableList.Builder<OperatorFactory> operatorFactories = ImmutableList.<OperatorFactory>builder().addAll(coreOperatorFactories);
    if (dynamicTupleFilterFactory.isPresent()) {
        // Bind in a dynamic tuple filter if necessary
        operatorFactories.add(dynamicTupleFilterFactory.get().filterWithTuple(indexKeyTuple));
    }
    operatorFactories.add(new PageBufferOperatorFactory(outputOperatorId, planNodeId, pageBuffer));
    return new DriverFactory(pipelineId, inputDriver, false, operatorFactories.build(), OptionalInt.empty(), UNGROUPED_EXECUTION, Optional.empty());
}
Also used : ImmutableList(com.google.common.collect.ImmutableList) PageBufferOperatorFactory(com.facebook.presto.operator.index.PageBufferOperator.PageBufferOperatorFactory) OperatorFactory(com.facebook.presto.operator.OperatorFactory) PagesIndexBuilderOperatorFactory(com.facebook.presto.operator.index.PagesIndexBuilderOperator.PagesIndexBuilderOperatorFactory) DriverFactory(com.facebook.presto.operator.DriverFactory) PageBufferOperatorFactory(com.facebook.presto.operator.index.PageBufferOperator.PageBufferOperatorFactory)

Example 32 with OperatorFactory

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

the class LocalExecutionPlanner method plan.

@VisibleForTesting
public LocalExecutionPlan plan(TaskContext taskContext, StageExecutionDescriptor stageExecutionDescriptor, PlanNode plan, PartitioningScheme partitioningScheme, List<PlanNodeId> partitionedSourceOrder, OutputFactory outputOperatorFactory, Optional<OutputPartitioning> outputPartitioning, RemoteSourceFactory remoteSourceFactory, TableWriteInfo tableWriteInfo, boolean pageSinkCommitRequired) {
    List<VariableReferenceExpression> outputLayout = partitioningScheme.getOutputLayout();
    Session session = taskContext.getSession();
    LocalExecutionPlanContext context = new LocalExecutionPlanContext(taskContext, tableWriteInfo);
    PhysicalOperation physicalOperation = plan.accept(new Visitor(session, stageExecutionDescriptor, remoteSourceFactory, pageSinkCommitRequired), context);
    Function<Page, Page> pagePreprocessor = enforceLayoutProcessor(outputLayout, physicalOperation.getLayout());
    List<Type> outputTypes = outputLayout.stream().map(VariableReferenceExpression::getType).collect(toImmutableList());
    context.addDriverFactory(context.isInputDriver(), true, ImmutableList.<OperatorFactory>builder().addAll(physicalOperation.getOperatorFactories()).add(outputOperatorFactory.createOutputOperator(context.getNextOperatorId(), plan.getId(), outputTypes, pagePreprocessor, outputPartitioning, new PagesSerdeFactory(blockEncodingSerde, isExchangeCompressionEnabled(session), isExchangeChecksumEnabled(session)))).build(), context.getDriverInstanceCount(), physicalOperation.getPipelineExecutionStrategy(), createFragmentResultCacheContext(fragmentResultCacheManager, plan, partitioningScheme, session, objectMapper));
    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(), partitionedSourceOrder, stageExecutionDescriptor);
}
Also used : InternalPlanVisitor(com.facebook.presto.sql.planner.plan.InternalPlanVisitor) Page(com.facebook.presto.common.Page) LocalPlannerAware(com.facebook.presto.operator.LocalPlannerAware) PagesSerdeFactory(com.facebook.presto.execution.buffer.PagesSerdeFactory) Type(com.facebook.presto.common.type.Type) OperatorType(com.facebook.presto.common.function.OperatorType) VariableReferenceExpression(com.facebook.presto.spi.relation.VariableReferenceExpression) DistinctLimitOperatorFactory(com.facebook.presto.operator.DistinctLimitOperator.DistinctLimitOperatorFactory) LookupOuterOperatorFactory(com.facebook.presto.operator.LookupOuterOperator.LookupOuterOperatorFactory) LimitOperatorFactory(com.facebook.presto.operator.LimitOperator.LimitOperatorFactory) LocalMergeSourceOperatorFactory(com.facebook.presto.operator.exchange.LocalMergeSourceOperator.LocalMergeSourceOperatorFactory) JoinOperatorFactory(com.facebook.presto.operator.JoinOperatorFactory) UnnestOperatorFactory(com.facebook.presto.operator.unnest.UnnestOperator.UnnestOperatorFactory) ScanFilterAndProjectOperatorFactory(com.facebook.presto.operator.ScanFilterAndProjectOperator.ScanFilterAndProjectOperatorFactory) 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) StreamingAggregationOperatorFactory(com.facebook.presto.operator.StreamingAggregationOperator.StreamingAggregationOperatorFactory) ExplainAnalyzeOperatorFactory(com.facebook.presto.operator.ExplainAnalyzeOperator.ExplainAnalyzeOperatorFactory) OperatorFactory(com.facebook.presto.operator.OperatorFactory) StatisticsWriterOperatorFactory(com.facebook.presto.operator.StatisticsWriterOperator.StatisticsWriterOperatorFactory) TableWriterOperatorFactory(com.facebook.presto.operator.TableWriterOperator.TableWriterOperatorFactory) TableWriterMergeOperatorFactory(com.facebook.presto.operator.TableWriterMergeOperator.TableWriterMergeOperatorFactory) NestedLoopBuildOperatorFactory(com.facebook.presto.operator.NestedLoopBuildOperator.NestedLoopBuildOperatorFactory) LocalExchangeSinkOperatorFactory(com.facebook.presto.operator.exchange.LocalExchangeSinkOperator.LocalExchangeSinkOperatorFactory) LocalExchangeSourceOperatorFactory(com.facebook.presto.operator.exchange.LocalExchangeSourceOperator.LocalExchangeSourceOperatorFactory) FilterAndProjectOperatorFactory(com.facebook.presto.operator.FilterAndProjectOperator.FilterAndProjectOperatorFactory) 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) SpatialIndexBuilderOperatorFactory(com.facebook.presto.operator.SpatialIndexBuilderOperator.SpatialIndexBuilderOperatorFactory) TableFinishOperatorFactory(com.facebook.presto.operator.TableFinishOperator.TableFinishOperatorFactory) OrderByOperatorFactory(com.facebook.presto.operator.OrderByOperator.OrderByOperatorFactory) SpatialJoinOperatorFactory(com.facebook.presto.operator.SpatialJoinOperator.SpatialJoinOperatorFactory) HashAggregationOperatorFactory(com.facebook.presto.operator.HashAggregationOperator.HashAggregationOperatorFactory) SetBuilderOperatorFactory(com.facebook.presto.operator.SetBuilderOperator.SetBuilderOperatorFactory) DevNullOperatorFactory(com.facebook.presto.operator.DevNullOperator.DevNullOperatorFactory) HashSemiJoinOperatorFactory(com.facebook.presto.operator.HashSemiJoinOperator.HashSemiJoinOperatorFactory) WindowOperatorFactory(com.facebook.presto.operator.WindowOperator.WindowOperatorFactory) RemoteProjectOperatorFactory(com.facebook.presto.operator.RemoteProjectOperator.RemoteProjectOperatorFactory) DeleteOperatorFactory(com.facebook.presto.operator.DeleteOperator.DeleteOperatorFactory) DriverFactory(com.facebook.presto.operator.DriverFactory) Session(com.facebook.presto.Session) VisibleForTesting(com.google.common.annotations.VisibleForTesting)

Aggregations

OperatorFactory (com.facebook.presto.operator.OperatorFactory)32 PlanNodeId (com.facebook.presto.spi.plan.PlanNodeId)23 Type (com.facebook.presto.common.type.Type)13 MaterializedResult (com.facebook.presto.testing.MaterializedResult)11 Page (com.facebook.presto.common.Page)8 DriverContext (com.facebook.presto.operator.DriverContext)8 DriverFactory (com.facebook.presto.operator.DriverFactory)7 ImmutableList (com.google.common.collect.ImmutableList)7 Test (org.testng.annotations.Test)7 BlockAssertions.createMapType (com.facebook.presto.block.BlockAssertions.createMapType)6 ArrayType (com.facebook.presto.common.type.ArrayType)6 DecimalType.createDecimalType (com.facebook.presto.common.type.DecimalType.createDecimalType)6 RowType (com.facebook.presto.common.type.RowType)6 AggregationOperatorFactory (com.facebook.presto.operator.AggregationOperator.AggregationOperatorFactory)6 SourceOperatorFactory (com.facebook.presto.operator.SourceOperatorFactory)6 SpatialIndexBuilderOperatorFactory (com.facebook.presto.operator.SpatialIndexBuilderOperator.SpatialIndexBuilderOperatorFactory)6 SpatialJoinOperatorFactory (com.facebook.presto.operator.SpatialJoinOperator.SpatialJoinOperatorFactory)6 MetadataManager (com.facebook.presto.metadata.MetadataManager)5 MetadataManager.createTestMetadataManager (com.facebook.presto.metadata.MetadataManager.createTestMetadataManager)5 HashBuilderOperatorFactory (com.facebook.presto.operator.HashBuilderOperator.HashBuilderOperatorFactory)5