This is an automated email from the ASF dual-hosted git repository. huajianlan pushed a commit to branch opt_insert_into_values in repository https://gitbox.apache.org/repos/asf/doris.git
commit 532bd7e450fb5536935acdeebc2a87ed3830561d Author: 924060929 <lanhuaj...@selectdb.com> AuthorDate: Fri Nov 22 11:46:55 2024 +0800 rebase --- .../commands/insert/InsertIntoTableCommand.java | 24 ++++++++-------------- .../trees/plans/commands/insert/InsertUtils.java | 1 - 2 files changed, 8 insertions(+), 17 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 a147a900f02..bdb7eb573fd 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 @@ -38,8 +38,10 @@ import org.apache.doris.nereids.glue.LogicalPlanAdapter; import org.apache.doris.nereids.memo.Group; import org.apache.doris.nereids.memo.GroupId; import org.apache.doris.nereids.properties.PhysicalProperties; +import org.apache.doris.nereids.rules.Rule; import org.apache.doris.nereids.rules.RuleType; import org.apache.doris.nereids.rules.analysis.BindSink; +import org.apache.doris.nereids.rules.implementation.LogicalOlapTableSinkToPhysicalOlapTableSink; import org.apache.doris.nereids.rules.rewrite.MergeProjects; import org.apache.doris.nereids.trees.expressions.Slot; import org.apache.doris.nereids.trees.plans.Explainable; @@ -350,8 +352,6 @@ public class InsertIntoTableCommand extends Command implements ForwardWithSync, // 3. NereidsPlanner use PhysicalPlan and the provided backend to generate DistributePlan // 4. ExecutorFactory use the DistributePlan to generate the NereidsSqlCoordinator and InsertExecutor - StatementContext statementContext = ctx.getStatementContext(); - AtomicReference<ExecutorFactory> executorFactoryRef = new AtomicReference<>(); InsertByInlineTablePlanner planner = new InsertByInlineTablePlanner(ctx.getStatementContext()) { @Override @@ -466,6 +466,8 @@ public class InsertIntoTableCommand extends Command implements ForwardWithSync, } private static class InsertByInlineTablePlanner extends NereidsPlanner { + private static final Rule toPhysicalOlapTableSink = new LogicalOlapTableSinkToPhysicalOlapTableSink() + .build(); private AtomicReference<Group> rootGroupRef = new AtomicReference<>(); public InsertByInlineTablePlanner(StatementContext statementContext) { @@ -527,6 +529,7 @@ public class InsertIntoTableCommand extends Command implements ForwardWithSync, @Override protected void optimize() { DefaultPlanRewriter<Void> optimizer = new DefaultPlanRewriter<Void>() { + @Override public Plan visitLogicalUnion(LogicalUnion logicalUnion, Void context) { logicalUnion = (LogicalUnion) super.visitLogicalUnion(logicalUnion, context); @@ -557,20 +560,9 @@ public class InsertIntoTableCommand extends Command implements ForwardWithSync, Void context) { olapTableSink = (LogicalOlapTableSink) super.visitLogicalOlapTableSink(olapTableSink, context); - - return new PhysicalOlapTableSink<>( - olapTableSink.getDatabase(), - olapTableSink.getTargetTable(), - olapTableSink.getCols(), - olapTableSink.getPartitionIds(), - olapTableSink.getOutputExprs(), - getCascadesContext().getConnectContext().getSessionVariable().isEnableSingleReplicaInsert(), - olapTableSink.isPartialUpdate(), - olapTableSink.getDmlCommandType(), - Optional.empty(), - olapTableSink.getLogicalProperties(), - olapTableSink.child() - ); + return toPhysicalOlapTableSink + .transform(olapTableSink, getCascadesContext()) + .get(0); } }; diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/insert/InsertUtils.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/insert/InsertUtils.java index ba67d7d5ac4..570011d3b7c 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/insert/InsertUtils.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/insert/InsertUtils.java @@ -34,7 +34,6 @@ import org.apache.doris.nereids.analyzer.UnboundAlias; import org.apache.doris.nereids.analyzer.UnboundHiveTableSink; import org.apache.doris.nereids.analyzer.UnboundIcebergTableSink; import org.apache.doris.nereids.analyzer.UnboundJdbcTableSink; -import org.apache.doris.nereids.analyzer.UnboundOneRowRelation; import org.apache.doris.nereids.analyzer.UnboundTableSink; import org.apache.doris.nereids.exceptions.AnalysisException; import org.apache.doris.nereids.parser.NereidsParser; --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org