[fix](Nereids) add logical project to prevent extra wrong column (#30459)
Issue Number: close #30264
This commit is contained in:
@ -45,6 +45,7 @@ import org.apache.doris.nereids.rules.analysis.ReplaceExpressionByChildOutput;
|
||||
import org.apache.doris.nereids.rules.analysis.ResolveOrdinalInOrderByAndGroupBy;
|
||||
import org.apache.doris.nereids.rules.analysis.SubqueryToApply;
|
||||
import org.apache.doris.nereids.rules.analysis.UserAuthentication;
|
||||
import org.apache.doris.nereids.rules.rewrite.MergeProjects;
|
||||
import org.apache.doris.nereids.rules.rewrite.SemiJoinCommute;
|
||||
|
||||
import java.util.List;
|
||||
@ -172,7 +173,8 @@ public class Analyzer extends AbstractBatchJobExecutor {
|
||||
new CollectJoinConstraint()
|
||||
),
|
||||
topDown(new LeadingJoin()),
|
||||
bottomUp(new SubqueryToApply())
|
||||
bottomUp(new SubqueryToApply()),
|
||||
topDown(new MergeProjects())
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -134,14 +134,8 @@ public class SubqueryToApply implements AnalysisRuleFactory {
|
||||
}
|
||||
Set<Expression> conjuncts = ImmutableSet.copyOf(newConjuncts.build());
|
||||
Plan newFilter = new LogicalFilter<>(conjuncts, applyPlan);
|
||||
if (conjuncts.stream().flatMap(c -> c.children().stream())
|
||||
.anyMatch(MarkJoinSlotReference.class::isInstance)) {
|
||||
return new LogicalProject<>(applyPlan.getOutput().stream()
|
||||
.filter(s -> !(s instanceof MarkJoinSlotReference))
|
||||
.collect(ImmutableList.toImmutableList()), newFilter);
|
||||
} else {
|
||||
return newFilter;
|
||||
}
|
||||
return new LogicalProject<>(filter.getOutput().stream().collect(ImmutableList.toImmutableList()),
|
||||
newFilter);
|
||||
})
|
||||
),
|
||||
RuleType.PROJECT_SUBQUERY_TO_APPLY.build(logicalProject().thenApply(ctx -> {
|
||||
|
||||
Reference in New Issue
Block a user