pick from master #39640 otherwise: push limit through union could generate plan: limit +-- union |-- limit | +-- empty relation +-- limit +-- project and then eliminate union will generate plan: +-- limit +- project +-- limit +-- project it could not be processed by tranlator correctly
This commit is contained in:
@ -114,6 +114,7 @@ import org.apache.doris.nereids.rules.rewrite.PushDownFilterThroughProject;
|
||||
import org.apache.doris.nereids.rules.rewrite.PushDownLimit;
|
||||
import org.apache.doris.nereids.rules.rewrite.PushDownLimitDistinctThroughJoin;
|
||||
import org.apache.doris.nereids.rules.rewrite.PushDownLimitDistinctThroughUnion;
|
||||
import org.apache.doris.nereids.rules.rewrite.PushDownProjectThroughLimit;
|
||||
import org.apache.doris.nereids.rules.rewrite.PushDownTopNDistinctThroughJoin;
|
||||
import org.apache.doris.nereids.rules.rewrite.PushDownTopNDistinctThroughUnion;
|
||||
import org.apache.doris.nereids.rules.rewrite.PushDownTopNThroughJoin;
|
||||
@ -416,7 +417,17 @@ public class Rewriter extends AbstractBatchJobExecutor {
|
||||
topic("eliminate",
|
||||
// SORT_PRUNING should be applied after mergeLimit
|
||||
custom(RuleType.ELIMINATE_SORT, EliminateSort::new),
|
||||
bottomUp(new EliminateEmptyRelation())
|
||||
bottomUp(
|
||||
new EliminateEmptyRelation(),
|
||||
// after eliminate empty relation under union, we could get
|
||||
// limit
|
||||
// +-- project
|
||||
// +-- limit
|
||||
// + project
|
||||
// so, we need push project through limit to satisfy translator's assumptions
|
||||
new PushDownFilterThroughProject(),
|
||||
new PushDownProjectThroughLimit(),
|
||||
new MergeProjects())
|
||||
),
|
||||
topic("agg rewrite",
|
||||
// these rules should be put after mv optimization to avoid mv matching fail
|
||||
|
||||
Reference in New Issue
Block a user