LiBinfeng-01 opened a new pull request, #41869: URL: https://github.com/apache/doris/pull/41869
pick: #35925 #39715 Add feat of force use/nouse cbo rule hint and fix pr introduce when not using this hint, cbo rules like INFER_SET_OPERATOR_DISTINCT would generate two plans and compare their cost and nereids optimizer would decide which is better. But when we want to control the behavior of cbo rules we could use this force cbo rule hint usage example explain shape plan select /*+ USE_CBO_RULE(INFER_SET_OPERATOR_DISTINCT) */ * from t1 union select * from t2; the USE_CBO_RULE(INFER_SET_OPERATOR_DISTINCT) hint would force rule INFER_SET_OPERATOR_DISTINCT to be used and generate plan like, which hashAgg below union is generated by this rule: -- !with_hint_union_distinct -- ----hashAgg[GLOBAL] --------hashAgg[LOCAL] ----------PhysicalUnion --------------hashAgg[LOCAL] ----------------PhysicalOlapScan[t1] --------------hashAgg[LOCAL] ----------------PhysicalOlapScan[t2] Hint log: Used: INFER_SET_OPERATOR_DISTINCT UnUsed: SyntaxError: When we want to force disable this rule, we could use explain shape plan select /*+ NO_USE_CBO_RULE(INFER_SET_OPERATOR_DISTINCT) */ * from t1 union select * from t2; which would generate plan with this rule: -- !with_hint_no_union_distinct -- ----hashAgg[GLOBAL] --------hashAgg[LOCAL] ----------PhysicalUnion --------------PhysicalOlapScan[t1] --------------PhysicalOlapScan[t2] Hint log: Used: NO_INFER_SET_OPERATOR_DISTINCT UnUsed: SyntaxError: change sessionvariable enableNereidsRules to varType.remove -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
