Skip to content

Commit

Permalink
rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
924060929 committed Nov 22, 2024
1 parent 1b6854e commit 5ca3ffd
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,10 @@
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;
Expand Down Expand Up @@ -350,8 +352,6 @@ private BuildInsertExecutorResult planInsertExecutor(
// 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
Expand Down Expand Up @@ -466,6 +466,8 @@ public BuildInsertExecutorResult(NereidsPlanner planner, AbstractInsertExecutor
}

private static class InsertByInlineTablePlanner extends NereidsPlanner {
private static final Rule toPhysicalOlapTableSink = new LogicalOlapTableSinkToPhysicalOlapTableSink()
.build();
private AtomicReference<Group> rootGroupRef = new AtomicReference<>();

public InsertByInlineTablePlanner(StatementContext statementContext) {
Expand Down Expand Up @@ -527,6 +529,7 @@ public Plan visitLogicalProject(LogicalProject<? extends Plan> project, Void con
@Override
protected void optimize() {
DefaultPlanRewriter<Void> optimizer = new DefaultPlanRewriter<Void>() {

@Override
public Plan visitLogicalUnion(LogicalUnion logicalUnion, Void context) {
logicalUnion = (LogicalUnion) super.visitLogicalUnion(logicalUnion, context);
Expand Down Expand Up @@ -557,20 +560,9 @@ public Plan visitLogicalOlapTableSink(LogicalOlapTableSink<? extends Plan> olapT
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);
}
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
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;
Expand Down

0 comments on commit 5ca3ffd

Please sign in to comment.