Skip to content

Commit

Permalink
fix comment
Browse files Browse the repository at this point in the history
  • Loading branch information
jackwener committed May 21, 2024
1 parent 5818991 commit 65a336c
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@
public class PlanPostProcessor extends DefaultPlanRewriter<CascadesContext> {
@Override
public Plan visit(Plan plan, CascadesContext context) {
return ((AbstractPhysicalPlan) super.visit(plan, context)).copyStatsAndGroupIdFrom((AbstractPhysicalPlan) plan);
AbstractPhysicalPlan newPlan = (AbstractPhysicalPlan) super.visit(plan, context);
return newPlan == plan ? plan : newPlan.copyStatsAndGroupIdFrom((AbstractPhysicalPlan) plan);
}

public Plan processRoot(Plan plan, CascadesContext ctx) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public List<PlanPostProcessor> getProcessors() {
// add processor if we need
Builder<PlanPostProcessor> builder = ImmutableList.builder();
builder.add(new PushDownFilterThroughProject());
builder.add(new ColumnPruningPostProcessor());
builder.add(new RemoveUselessProjectPostProcessor());
builder.add(new MergeProjectPostProcessor());
builder.add(new RecomputeLogicalPropertiesProcessor());
builder.add(new AddOffsetIntoDistribute());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
@DependsRules({
MergeProjectPostProcessor.class
})
public class ColumnPruningPostProcessor extends PlanPostProcessor {
public class RemoveUselessProjectPostProcessor extends PlanPostProcessor {
@Override
public Plan visitPhysicalProject(PhysicalProject<? extends Plan> project, CascadesContext ctx) {
project = (PhysicalProject<? extends Plan>) super.visit(project, ctx);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
import org.apache.doris.nereids.trees.plans.logical.LogicalJoin;
import org.apache.doris.nereids.trees.plans.logical.LogicalProject;

import java.util.ArrayList;
import com.google.common.collect.ImmutableList;

/**
* Pull up SemiJoin through Agg.
Expand All @@ -44,7 +44,7 @@ public Rule build() {
return null;
}
Plan newJoin = join.withChildren(agg.withChildren(project.withChildren(join.left())), join.right());
return new LogicalProject<>(new ArrayList<>(agg.getOutput()), newJoin);
return new LogicalProject<>(ImmutableList.copyOf(agg.getOutput()), newJoin);
})
.toRule(RuleType.TRANSPOSE_LOGICAL_AGG_SEMI_JOIN_PROJECT);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import org.apache.doris.nereids.trees.plans.visitor.CustomRewriter;
import org.apache.doris.nereids.trees.plans.visitor.DefaultPlanRewriter;

import java.util.ArrayList;
import com.google.common.collect.ImmutableList;

/**
* We need this rule to cast all filter and join conjunct's return type to boolean after rewrite.
Expand All @@ -39,6 +39,6 @@ public Plan rewriteRoot(Plan plan, JobContext jobContext) {
@Override
public Plan visitLogicalJoin(LogicalJoin<? extends Plan, ? extends Plan> join, Void context) {
join = (LogicalJoin<? extends Plan, ? extends Plan>) super.visit(join, context);
return new LogicalProject<>(new ArrayList<>(join.getOutput()), join);
return new LogicalProject<>(ImmutableList.copyOf(join.getOutput()), join);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,8 @@ public LogicalPlanBuilder project(List<Integer> slotsIndex) {
}

public LogicalPlanBuilder projectAll() {
LogicalProject<LogicalPlan> project = new LogicalProject<>(new ArrayList<>(this.plan.getOutput()), this.plan);
LogicalProject<LogicalPlan> project = new LogicalProject<>(ImmutableList.copyOf(this.plan.getOutput()),
this.plan);
return from(project);
}

Expand Down Expand Up @@ -205,8 +206,8 @@ public LogicalPlanBuilder aggGroupUsingIndex(List<Integer> groupByKeysIndex,
}

public LogicalPlanBuilder aggGroupUsingIndexAndSourceRepeat(List<Integer> groupByKeysIndex,
List<NamedExpression> outputExprsList,
Optional<LogicalRepeat<?>> sourceRepeat) {
List<NamedExpression> outputExprsList,
Optional<LogicalRepeat<?>> sourceRepeat) {
Builder<Expression> groupByBuilder = ImmutableList.builder();
for (Integer index : groupByKeysIndex) {
groupByBuilder.add(this.plan.getOutput().get(index));
Expand Down
1 change: 1 addition & 0 deletions regression-test/suites/query_p0/join/test_join.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -1272,6 +1272,7 @@ suite("test_join", "query,p0") {
B.FACTOR_FIN_VALUE, D.limit_id desc;"""
logger.info(ret.toString())
assertTrue(ret.toString().contains(" | join op: INNER JOIN(BROADCAST)"))
sql "SET disable_join_reorder=false"

sql "drop table if exists `t0`"
sql "drop table if exists `t1`"
Expand Down

0 comments on commit 65a336c

Please sign in to comment.