From 66c693a1135d758ea63c57b28ca7e5684337a543 Mon Sep 17 00:00:00 2001 From: 924060929 <924060929@qq.com> Date: Sat, 12 Oct 2024 21:01:08 +0800 Subject: [PATCH] support set group commit backend --- .../commands/insert/InsertIntoTableCommand.java | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/insert/InsertIntoTableCommand.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/insert/InsertIntoTableCommand.java index ddc7cdf3bae9235..22b83b7f7dc8d86 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/insert/InsertIntoTableCommand.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/insert/InsertIntoTableCommand.java @@ -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 @@ -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(); }