Skip to content

Commit

Permalink
support set group commit backend
Browse files Browse the repository at this point in the history
  • Loading branch information
924060929 committed Oct 12, 2024
1 parent 1f84b76 commit 66c693a
Showing 1 changed file with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,8 @@ private BuildInsertExecutorResult planInsertExecutor(
// the key logical when use new coordinator:
// 1. use NereidsPlanner to generate PhysicalPlan
// 2. use PhysicalPlan to select InsertExecutorFactory, some InsertExecutors want to control
// which backend should be used
// which backend should be used, for example, OlapGroupCommitInsertExecutor need select
// a backend to do group commit
// 3. NereidsPlanner use PhysicalPlan and the provided backend to generate DistributePlan
// 4. ExecutorFactory use the DistributePlan to generate the NereidsSqlCoordinator and InsertExecutor

Expand All @@ -340,19 +341,21 @@ private BuildInsertExecutorResult planInsertExecutor(
NereidsPlanner planner = new NereidsPlanner(statementContext) {
@Override
protected void doDistribute(boolean canUseNereidsDistributePlanner) {
// after generate PhysicalPlan, we can select InsertExecutorFactory
// when enter this method, the step 1 already executed

// step 2
executorFactoryRef.set(
selectInsertExecutorFactory(this, ctx, stmtExecutor, targetTableIf)
);
// after select factory, we can do distribute, because the DistributePlan not generate
// step 3
super.doDistribute(canUseNereidsDistributePlanner);
}
};

// generate PhysicalPlan and DistributePlan
// step 1, 2, 3
planner.plan(logicalPlanAdapter, ctx.getSessionVariable().toThrift());

// after generate DistributePlan, we can build NereidsSqlCoordinator and InsertExecutor
// step 4
return executorFactoryRef.get().build();
}

Expand Down

0 comments on commit 66c693a

Please sign in to comment.