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());
}
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);
}
Aggregations