Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify addDriverFactory params #18292

Merged
merged 1 commit into from
Jul 14, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -636,7 +636,6 @@ public LocalExecutionPlan plan(
.collect(toImmutableList());

context.addDriverFactory(
context.isInputDriver(),
true,
new PhysicalOperation(
outputOperatorFactory.createOutputOperator(
Expand All @@ -646,7 +645,7 @@ public LocalExecutionPlan plan(
pagePreprocessor,
new PagesSerdeFactory(plannerContext.getBlockEncodingSerde(), isExchangeCompressionEnabled(session))),
physicalOperation),
context.getDriverInstanceCount());
context);

// notify operator factories that planning has completed
context.getDriverFactories().stream()
Expand Down Expand Up @@ -697,8 +696,10 @@ private LocalExecutionPlanContext(
this.nextPipelineId = nextPipelineId;
}

public void addDriverFactory(boolean inputDriver, boolean outputDriver, PhysicalOperation physicalOperation, OptionalInt driverInstances)
public void addDriverFactory(boolean outputDriver, PhysicalOperation physicalOperation, LocalExecutionPlanContext context)
{
boolean inputDriver = context.isInputDriver();
OptionalInt driverInstances = context.getDriverInstanceCount();
List<OperatorFactoryWithTypes> operatorFactoriesWithTypes = physicalOperation.getOperatorFactoriesWithTypes();
addLookupOuterDrivers(outputDriver, toOperatorFactories(operatorFactoriesWithTypes));
List<OperatorFactory> operatorFactories;
Expand Down Expand Up @@ -2663,10 +2664,9 @@ private PhysicalOperation createNestedLoopJoin(JoinNode node, Set<DynamicFilterI
}

context.addDriverFactory(
buildContext.isInputDriver(),
false,
new PhysicalOperation(nestedLoopBuildOperatorFactory, buildSource),
buildContext.getDriverInstanceCount());
buildContext);

// build output mapping
ImmutableMap.Builder<Symbol, Integer> outputMappings = ImmutableMap.builder();
Expand Down Expand Up @@ -2794,10 +2794,9 @@ private PagesSpatialIndexFactory createPagesSpatialIndexFactory(
pagesIndexFactory);

context.addDriverFactory(
buildContext.isInputDriver(),
false,
new PhysicalOperation(builderOperatorFactory, buildSource),
buildContext.getDriverInstanceCount());
buildContext);

return builderOperatorFactory.getPagesSpatialIndexFactory();
}
Expand Down Expand Up @@ -2942,10 +2941,9 @@ private PhysicalOperation createLookupJoin(
taskConcurrency / partitionCount));

context.addDriverFactory(
buildContext.isInputDriver(),
false,
new PhysicalOperation(hashBuilderOperatorFactory, buildSource),
buildContext.getDriverInstanceCount());
buildContext);

JoinOperatorType joinType = JoinOperatorType.ofJoinNodeType(node.getType(), outputSingleMatch, waitForBuild);
operator = operatorFactories.spillingJoin(
Expand Down Expand Up @@ -2995,10 +2993,9 @@ private PhysicalOperation createLookupJoin(
taskConcurrency / partitionCount));

context.addDriverFactory(
buildContext.isInputDriver(),
false,
new PhysicalOperation(hashBuilderOperatorFactory, buildSource),
buildContext.getDriverInstanceCount());
buildContext);

JoinOperatorType joinType = JoinOperatorType.ofJoinNodeType(node.getType(), outputSingleMatch, waitForBuild);
operator = operatorFactories.join(
Expand Down Expand Up @@ -3241,10 +3238,9 @@ public PhysicalOperation visitSemiJoin(SemiJoinNode node, LocalExecutionPlanCont
blockTypeOperators);
SetSupplier setProvider = setBuilderOperatorFactory.getSetProvider();
context.addDriverFactory(
buildContext.isInputDriver(),
false,
new PhysicalOperation(setBuilderOperatorFactory, buildSource),
buildContext.getDriverInstanceCount());
buildContext);

// Source channels are always laid out first, followed by the boolean output symbol
Map<Symbol, Integer> outputMappings = ImmutableMap.<Symbol, Integer>builder()
Expand Down Expand Up @@ -3635,7 +3631,6 @@ private PhysicalOperation createLocalMerge(ExchangeNode node, LocalExecutionPlan
List<Symbol> expectedLayout = node.getInputs().get(0);
Function<Page, Page> pagePreprocessor = enforceLoadedLayoutProcessor(expectedLayout, source.getLayout());
context.addDriverFactory(
subContext.isInputDriver(),
false,
new PhysicalOperation(
new LocalExchangeSinkOperatorFactory(
Expand All @@ -3644,7 +3639,7 @@ private PhysicalOperation createLocalMerge(ExchangeNode node, LocalExecutionPlan
node.getId(),
pagePreprocessor),
source),
subContext.getDriverInstanceCount());
subContext);
// the main driver is not an input... the exchange sources are the input for the plan
context.setInputDriver(false);

Expand Down Expand Up @@ -3717,7 +3712,6 @@ else if (context.getDriverInstanceCount().isPresent()) {
Function<Page, Page> pagePreprocessor = enforceLoadedLayoutProcessor(expectedLayout, source.getLayout());

context.addDriverFactory(
subContext.isInputDriver(),
false,
new PhysicalOperation(
new LocalExchangeSinkOperatorFactory(
Expand All @@ -3726,7 +3720,7 @@ else if (context.getDriverInstanceCount().isPresent()) {
node.getId(),
pagePreprocessor),
source),
subContext.getDriverInstanceCount());
subContext);
}

// the main driver is not an input... the exchange sources are the input for the plan
Expand Down