[fix](Nereids): DefaultPlanRewriter visit plan children. (#21395)

This commit is contained in:
jakevin
2023-07-03 13:20:01 +08:00
committed by GitHub
parent 17af099dc3
commit 9fa2dac352
3 changed files with 4 additions and 4 deletions

View File

@ -109,7 +109,8 @@ public class AggScalarSubQueryToWindowFunction extends DefaultPlanRewriter<JobCo
* is used to project apply output to original output, it is not affect this rule at all. so we ignore it.
*/
@Override
public Plan visitLogicalFilter(LogicalFilter<? extends Plan> filter, JobContext context) {
public Plan visitLogicalFilter(LogicalFilter<? extends Plan> plan, JobContext context) {
LogicalFilter<? extends Plan> filter = visitChildren(this, plan, context);
return findApply(filter)
.filter(a -> check(filter, a))
.map(a -> rewrite(filter, a))

View File

@ -32,7 +32,6 @@ import java.util.stream.Collectors;
/**
* The rule add an explicit project at the top join to ensure the output of whole plan is stable
* and avoid generate circle in memo.
*
*/
public class EnsureProjectOnTopJoin extends DefaultPlanRewriter<Void> implements CustomRewriter {

View File

@ -61,7 +61,7 @@ public class InferPredicates extends DefaultPlanRewriter<JobContext> implements
@Override
public Plan visitLogicalJoin(LogicalJoin<? extends Plan, ? extends Plan> join, JobContext context) {
join = (LogicalJoin<? extends Plan, ? extends Plan>) super.visit(join, context);
join = visitChildren(this, join, context);
Plan left = join.left();
Plan right = join.right();
Set<Expression> expressions = getAllExpressions(left, right, join.getOnClauseCondition());
@ -91,7 +91,7 @@ public class InferPredicates extends DefaultPlanRewriter<JobContext> implements
@Override
public Plan visitLogicalFilter(LogicalFilter<? extends Plan> filter, JobContext context) {
filter = (LogicalFilter<? extends Plan>) super.visit(filter, context);
filter = visitChildren(this, filter, context);
Set<Expression> filterPredicates = pullUpPredicates(filter);
filterPredicates.removeAll(pullUpPredicates(filter.child()));
filter.getConjuncts().forEach(filterPredicates::remove);