This is an automated email from the ASF dual-hosted git repository. dataroaring pushed a commit to branch branch-3.0 in repository https://gitbox.apache.org/repos/asf/doris.git
commit 03e7e521ec91276fa4a80e47f6aa9a6cae5cf76e Author: LiBinfeng <46676950+libinfeng...@users.noreply.github.com> AuthorDate: Fri Aug 23 11:37:09 2024 +0800 [Fix](Nereids) fix use cbo rule hint unused because of logic reverse (#39715) use_cbo_rule_hint show used but it does not be used intro by: #35925 --- .../nereids/jobs/rewrite/CostBasedRewriteJob.java | 2 +- .../infer_set_operator_distinct.out | 230 +++++++++++++-------- 2 files changed, 141 insertions(+), 91 deletions(-) diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/jobs/rewrite/CostBasedRewriteJob.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/jobs/rewrite/CostBasedRewriteJob.java index 619eae1b16d..dc13412031a 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/jobs/rewrite/CostBasedRewriteJob.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/jobs/rewrite/CostBasedRewriteJob.java @@ -85,7 +85,7 @@ public class CostBasedRewriteJob implements RewriteJob { } if (checkHint.first) { checkHint.second.setStatus(Hint.HintStatus.SUCCESS); - if (((UseCboRuleHint) checkHint.second).isNotUseCboRule()) { + if (!((UseCboRuleHint) checkHint.second).isNotUseCboRule()) { currentCtx.setRewritePlan(applyCboRuleCtx.getRewritePlan()); } return; diff --git a/regression-test/data/nereids_rules_p0/infer_set_operator_distinct/infer_set_operator_distinct.out b/regression-test/data/nereids_rules_p0/infer_set_operator_distinct/infer_set_operator_distinct.out index e10fe4bbc26..06f9705caa1 100644 --- a/regression-test/data/nereids_rules_p0/infer_set_operator_distinct/infer_set_operator_distinct.out +++ b/regression-test/data/nereids_rules_p0/infer_set_operator_distinct/infer_set_operator_distinct.out @@ -333,9 +333,11 @@ PhysicalResultSink --------hashAgg[LOCAL] ----------PhysicalUnion ------------PhysicalDistribute[DistributionSpecExecutionAny] ---------------PhysicalOlapScan[t1] +--------------hashAgg[LOCAL] +----------------PhysicalOlapScan[t1] ------------PhysicalDistribute[DistributionSpecExecutionAny] ---------------PhysicalOlapScan[t2] +--------------hashAgg[LOCAL] +----------------PhysicalOlapScan[t2] Hint log: Used: use_INFER_SET_OPERATOR_DISTINCT @@ -350,11 +352,13 @@ PhysicalResultSink --------hashAgg[LOCAL] ----------PhysicalUnion ------------PhysicalDistribute[DistributionSpecExecutionAny] ---------------filter((t1.score > 10)) -----------------PhysicalOlapScan[t1] +--------------hashAgg[LOCAL] +----------------filter((t1.score > 10)) +------------------PhysicalOlapScan[t1] ------------PhysicalDistribute[DistributionSpecExecutionAny] ---------------filter((t2.name = 'Test')) -----------------PhysicalOlapScan[t2] +--------------hashAgg[LOCAL] +----------------filter((t2.name = 'Test')) +------------------PhysicalOlapScan[t2] Hint log: Used: use_INFER_SET_OPERATOR_DISTINCT @@ -369,11 +373,14 @@ PhysicalResultSink --------hashAgg[LOCAL] ----------PhysicalUnion ------------PhysicalDistribute[DistributionSpecExecutionAny] ---------------PhysicalOlapScan[t1] +--------------hashAgg[LOCAL] +----------------PhysicalOlapScan[t1] ------------PhysicalDistribute[DistributionSpecExecutionAny] ---------------PhysicalOlapScan[t2] +--------------hashAgg[LOCAL] +----------------PhysicalOlapScan[t2] ------------PhysicalDistribute[DistributionSpecExecutionAny] ---------------PhysicalOlapScan[t3] +--------------hashAgg[LOCAL] +----------------PhysicalOlapScan[t3] Hint log: Used: use_INFER_SET_OPERATOR_DISTINCT @@ -385,9 +392,11 @@ PhysicalResultSink --PhysicalDistribute[DistributionSpecGather] ----PhysicalExcept ------PhysicalDistribute[DistributionSpecHash] ---------PhysicalOlapScan[t1] +--------hashAgg[LOCAL] +----------PhysicalOlapScan[t1] ------PhysicalDistribute[DistributionSpecHash] ---------PhysicalOlapScan[t2] +--------hashAgg[LOCAL] +----------PhysicalOlapScan[t2] Hint log: Used: use_INFER_SET_OPERATOR_DISTINCT @@ -399,11 +408,13 @@ PhysicalResultSink --PhysicalDistribute[DistributionSpecGather] ----PhysicalExcept ------PhysicalDistribute[DistributionSpecHash] ---------filter((t1.id > 100)) -----------PhysicalOlapScan[t1] +--------hashAgg[LOCAL] +----------filter((t1.id > 100)) +------------PhysicalOlapScan[t1] ------PhysicalDistribute[DistributionSpecHash] ---------filter((t2.id < 50)) -----------PhysicalOlapScan[t2] +--------hashAgg[LOCAL] +----------filter((t2.id < 50)) +------------PhysicalOlapScan[t2] Hint log: Used: use_INFER_SET_OPERATOR_DISTINCT @@ -415,9 +426,11 @@ PhysicalResultSink --PhysicalDistribute[DistributionSpecGather] ----PhysicalIntersect ------PhysicalDistribute[DistributionSpecHash] ---------PhysicalOlapScan[t1] +--------hashAgg[LOCAL] +----------PhysicalOlapScan[t1] ------PhysicalDistribute[DistributionSpecHash] ---------PhysicalOlapScan[t2] +--------hashAgg[LOCAL] +----------PhysicalOlapScan[t2] Hint log: Used: use_INFER_SET_OPERATOR_DISTINCT @@ -451,19 +464,24 @@ SyntaxError: PhysicalResultSink --PhysicalDistribute[DistributionSpecGather] ----PhysicalIntersect -------PhysicalExcept ---------hashAgg[GLOBAL] +------hashAgg[LOCAL] +--------PhysicalExcept +----------hashAgg[GLOBAL] +------------PhysicalDistribute[DistributionSpecHash] +--------------hashAgg[LOCAL] +----------------PhysicalUnion +------------------PhysicalDistribute[DistributionSpecExecutionAny] +--------------------hashAgg[LOCAL] +----------------------PhysicalOlapScan[t1] +------------------PhysicalDistribute[DistributionSpecExecutionAny] +--------------------hashAgg[LOCAL] +----------------------PhysicalOlapScan[t2] ----------PhysicalDistribute[DistributionSpecHash] ------------hashAgg[LOCAL] ---------------PhysicalUnion -----------------PhysicalDistribute[DistributionSpecExecutionAny] -------------------PhysicalOlapScan[t1] -----------------PhysicalDistribute[DistributionSpecExecutionAny] -------------------PhysicalOlapScan[t2] ---------PhysicalDistribute[DistributionSpecHash] -----------PhysicalOlapScan[t3] +--------------PhysicalOlapScan[t3] ------PhysicalDistribute[DistributionSpecHash] ---------PhysicalOlapScan[t4] +--------hashAgg[LOCAL] +----------PhysicalOlapScan[t4] Hint log: Used: use_INFER_SET_OPERATOR_DISTINCT @@ -478,13 +496,15 @@ PhysicalResultSink --------hashAgg[LOCAL] ----------PhysicalUnion ------------PhysicalDistribute[DistributionSpecExecutionAny] ---------------PhysicalProject -----------------hashJoin[INNER_JOIN broadcast] hashCondition=((t1.id = t2.id)) otherCondition=() -------------------PhysicalOlapScan[t1] -------------------PhysicalProject ---------------------PhysicalOlapScan[t2] +--------------hashAgg[LOCAL] +----------------PhysicalProject +------------------hashJoin[INNER_JOIN broadcast] hashCondition=((t1.id = t2.id)) otherCondition=() +--------------------PhysicalOlapScan[t1] +--------------------PhysicalProject +----------------------PhysicalOlapScan[t2] ------------PhysicalDistribute[DistributionSpecExecutionAny] ---------------PhysicalOlapScan[t3] +--------------hashAgg[LOCAL] +----------------PhysicalOlapScan[t3] Hint log: Used: use_INFER_SET_OPERATOR_DISTINCT @@ -499,11 +519,13 @@ PhysicalResultSink --------hashAgg[LOCAL] ----------PhysicalUnion ------------PhysicalDistribute[DistributionSpecExecutionAny] ---------------filter((t1.score > 10)) -----------------PhysicalOlapScan[t1] +--------------hashAgg[LOCAL] +----------------filter((t1.score > 10)) +------------------PhysicalOlapScan[t1] ------------PhysicalDistribute[DistributionSpecExecutionAny] ---------------filter((t2.score < 5)) -----------------PhysicalOlapScan[t2] +--------------hashAgg[LOCAL] +----------------filter((t2.score < 5)) +------------------PhysicalOlapScan[t2] Hint log: Used: use_INFER_SET_OPERATOR_DISTINCT @@ -518,13 +540,17 @@ PhysicalResultSink --------hashAgg[LOCAL] ----------PhysicalUnion ------------PhysicalDistribute[DistributionSpecExecutionAny] ---------------PhysicalOlapScan[t1] +--------------hashAgg[LOCAL] +----------------PhysicalOlapScan[t1] ------------PhysicalDistribute[DistributionSpecExecutionAny] ---------------PhysicalOlapScan[t2] +--------------hashAgg[LOCAL] +----------------PhysicalOlapScan[t2] ------------PhysicalDistribute[DistributionSpecExecutionAny] ---------------PhysicalOlapScan[t3] +--------------hashAgg[LOCAL] +----------------PhysicalOlapScan[t3] ------------PhysicalDistribute[DistributionSpecExecutionAny] ---------------PhysicalOlapScan[t4] +--------------hashAgg[LOCAL] +----------------PhysicalOlapScan[t4] Hint log: Used: use_INFER_SET_OPERATOR_DISTINCT @@ -539,12 +565,15 @@ PhysicalResultSink --------hashAgg[LOCAL] ----------PhysicalUnion ------------PhysicalDistribute[DistributionSpecExecutionAny] ---------------PhysicalOlapScan[t1] -------------PhysicalDistribute[DistributionSpecExecutionAny] ---------------PhysicalTopN[MERGE_SORT] -----------------PhysicalDistribute[DistributionSpecGather] -------------------PhysicalTopN[LOCAL_SORT] ---------------------PhysicalOlapScan[t2] +--------------hashAgg[LOCAL] +----------------PhysicalOlapScan[t1] +------------hashAgg[GLOBAL] +--------------PhysicalDistribute[DistributionSpecHash] +----------------hashAgg[LOCAL] +------------------PhysicalTopN[MERGE_SORT] +--------------------PhysicalDistribute[DistributionSpecGather] +----------------------PhysicalTopN[LOCAL_SORT] +------------------------PhysicalOlapScan[t2] Hint log: Used: use_INFER_SET_OPERATOR_DISTINCT @@ -559,13 +588,15 @@ PhysicalResultSink --------hashAgg[LOCAL] ----------PhysicalUnion ------------PhysicalDistribute[DistributionSpecExecutionAny] ---------------PhysicalProject -----------------hashJoin[INNER_JOIN broadcast] hashCondition=((t1.id = t2.id)) otherCondition=() -------------------PhysicalOlapScan[t1] -------------------PhysicalProject ---------------------PhysicalOlapScan[t2] +--------------hashAgg[LOCAL] +----------------PhysicalProject +------------------hashJoin[INNER_JOIN broadcast] hashCondition=((t1.id = t2.id)) otherCondition=() +--------------------PhysicalOlapScan[t1] +--------------------PhysicalProject +----------------------PhysicalOlapScan[t2] ------------PhysicalDistribute[DistributionSpecExecutionAny] ---------------PhysicalOlapScan[t3] +--------------hashAgg[LOCAL] +----------------PhysicalOlapScan[t3] Hint log: Used: use_INFER_SET_OPERATOR_DISTINCT @@ -580,13 +611,15 @@ PhysicalResultSink --------hashAgg[LOCAL] ----------PhysicalUnion ------------PhysicalDistribute[DistributionSpecExecutionAny] ---------------PhysicalProject -----------------hashJoin[LEFT_OUTER_JOIN broadcast] hashCondition=((t1.id = t2.id)) otherCondition=() -------------------PhysicalOlapScan[t1] -------------------PhysicalProject ---------------------PhysicalOlapScan[t2] +--------------hashAgg[LOCAL] +----------------PhysicalProject +------------------hashJoin[LEFT_OUTER_JOIN broadcast] hashCondition=((t1.id = t2.id)) otherCondition=() +--------------------PhysicalOlapScan[t1] +--------------------PhysicalProject +----------------------PhysicalOlapScan[t2] ------------PhysicalDistribute[DistributionSpecExecutionAny] ---------------PhysicalOlapScan[t3] +--------------hashAgg[LOCAL] +----------------PhysicalOlapScan[t3] Hint log: Used: use_INFER_SET_OPERATOR_DISTINCT @@ -600,14 +633,17 @@ PhysicalResultSink ------PhysicalDistribute[DistributionSpecHash] --------hashAgg[LOCAL] ----------PhysicalUnion -------------PhysicalDistribute[DistributionSpecExecutionAny] ---------------PhysicalProject -----------------hashJoin[LEFT_OUTER_JOIN broadcast] hashCondition=((t1.id = t2.id)) otherCondition=() +------------hashAgg[GLOBAL] +--------------PhysicalDistribute[DistributionSpecHash] +----------------hashAgg[LOCAL] ------------------PhysicalProject ---------------------PhysicalOlapScan[t2] -------------------PhysicalOlapScan[t1] +--------------------hashJoin[LEFT_OUTER_JOIN broadcast] hashCondition=((t1.id = t2.id)) otherCondition=() +----------------------PhysicalProject +------------------------PhysicalOlapScan[t2] +----------------------PhysicalOlapScan[t1] ------------PhysicalDistribute[DistributionSpecExecutionAny] ---------------PhysicalOlapScan[t3] +--------------hashAgg[LOCAL] +----------------PhysicalOlapScan[t3] Hint log: Used: use_INFER_SET_OPERATOR_DISTINCT @@ -621,13 +657,17 @@ PhysicalResultSink ------PhysicalDistribute[DistributionSpecHash] --------hashAgg[LOCAL] ----------PhysicalUnion -------------PhysicalProject ---------------hashJoin[FULL_OUTER_JOIN shuffle] hashCondition=((t1.id = t2.id)) otherCondition=() -----------------PhysicalOlapScan[t1] -----------------PhysicalProject -------------------PhysicalOlapScan[t2] +------------hashAgg[GLOBAL] +--------------PhysicalDistribute[DistributionSpecHash] +----------------hashAgg[LOCAL] +------------------PhysicalProject +--------------------hashJoin[FULL_OUTER_JOIN shuffle] hashCondition=((t1.id = t2.id)) otherCondition=() +----------------------PhysicalOlapScan[t1] +----------------------PhysicalProject +------------------------PhysicalOlapScan[t2] ------------PhysicalDistribute[DistributionSpecExecutionAny] ---------------PhysicalOlapScan[t3] +--------------hashAgg[LOCAL] +----------------PhysicalOlapScan[t3] Hint log: Used: use_INFER_SET_OPERATOR_DISTINCT @@ -642,12 +682,14 @@ PhysicalResultSink --------hashAgg[LOCAL] ----------PhysicalUnion ------------PhysicalDistribute[DistributionSpecExecutionAny] ---------------hashJoin[LEFT_SEMI_JOIN broadcast] hashCondition=((t1.id = t2.id)) otherCondition=() -----------------PhysicalOlapScan[t1] -----------------PhysicalProject -------------------PhysicalOlapScan[t2] +--------------hashAgg[LOCAL] +----------------hashJoin[LEFT_SEMI_JOIN broadcast] hashCondition=((t1.id = t2.id)) otherCondition=() +------------------PhysicalOlapScan[t1] +------------------PhysicalProject +--------------------PhysicalOlapScan[t2] ------------PhysicalDistribute[DistributionSpecExecutionAny] ---------------PhysicalOlapScan[t3] +--------------hashAgg[LOCAL] +----------------PhysicalOlapScan[t3] Hint log: Used: use_INFER_SET_OPERATOR_DISTINCT @@ -659,10 +701,12 @@ PhysicalResultSink --PhysicalDistribute[DistributionSpecGather] ----PhysicalExcept ------PhysicalDistribute[DistributionSpecHash] ---------PhysicalOlapScan[t1] +--------hashAgg[LOCAL] +----------PhysicalOlapScan[t1] ------PhysicalDistribute[DistributionSpecHash] ---------filter((t2.score > 10)) -----------PhysicalOlapScan[t2] +--------hashAgg[LOCAL] +----------filter((t2.score > 10)) +------------PhysicalOlapScan[t2] Hint log: Used: use_INFER_SET_OPERATOR_DISTINCT @@ -673,12 +717,16 @@ SyntaxError: PhysicalResultSink --PhysicalDistribute[DistributionSpecGather] ----PhysicalIntersect -------PhysicalDistribute[DistributionSpecHash] ---------PhysicalProject -----------PhysicalOlapScan[t1] -------PhysicalDistribute[DistributionSpecHash] ---------PhysicalProject -----------PhysicalOlapScan[t2] +------hashAgg[GLOBAL] +--------PhysicalDistribute[DistributionSpecHash] +----------hashAgg[LOCAL] +------------PhysicalProject +--------------PhysicalOlapScan[t1] +------hashAgg[GLOBAL] +--------PhysicalDistribute[DistributionSpecHash] +----------hashAgg[LOCAL] +------------PhysicalProject +--------------PhysicalOlapScan[t2] Hint log: Used: use_INFER_SET_OPERATOR_DISTINCT @@ -731,12 +779,14 @@ PhysicalResultSink --PhysicalDistribute[DistributionSpecGather] ----PhysicalExcept ------PhysicalDistribute[DistributionSpecHash] ---------PhysicalProject -----------PhysicalOlapScan[t1] +--------hashAgg[LOCAL] +----------PhysicalProject +------------PhysicalOlapScan[t1] ------PhysicalDistribute[DistributionSpecHash] ---------PhysicalProject -----------filter((t2.score > 20)) -------------PhysicalOlapScan[t2] +--------hashAgg[LOCAL] +----------PhysicalProject +------------filter((t2.score > 20)) +--------------PhysicalOlapScan[t2] Hint log: Used: use_INFER_SET_OPERATOR_DISTINCT --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org