feiniaofeiafei opened a new pull request, #62347:
URL: https://github.com/apache/doris/pull/62347

   ### What problem does this PR solve?
   
   Issue Number: N/A
   
   Problem Summary: The `NO_USE_CBO_RULE` hint was silently ignored during 
analysis. In `EliminateLogicalSelectHint#build()`, the if-else chain handled 
`USE_CBO_RULE` but had no branch for `NO_USE_CBO_RULE`, causing the hint to 
fall through to the default warning log and never register a `UseCboRuleHint` 
in `StatementContext`. As a result, `CostBasedRewriteJob` could not find the 
hint and the CBO rule was never suppressed.
   
   **Root cause**: Missing `NO_USE_CBO_RULE` case in 
`EliminateLogicalSelectHint`.
   
   **Fix**: Add a `NO_USE_CBO_RULE` branch that delegates to the same 
`extractRule()` helper, which correctly creates a `UseCboRuleHint` with 
`isNotUseCboRule=true`.
   
   **Reproduce**:
   ```sql
   explain physical plan
   SELECT /*+ no_use_cbo_rule(INFER_SET_OPERATOR_DISTINCT)*/ ka, kb, kc FROM t1 
INTERSECT SELECT ka, kb, kc FROM t2
   ```
   Before fix: hint is ignored, CBO rule still applied.
   After fix: hint is respected, CBO rule is suppressed.
   
   ### Release note
   
   Fix `NO_USE_CBO_RULE` hint not taking effect when used in SELECT hint 
comments (e.g., `/*+ no_use_cbo_rule(INFER_SET_OPERATOR_DISTINCT) */`).
   
   ### Check List (For Author)
   
   - Test: FE Unit Test — added `EliminateLogicalSelectHintTest` to verify the 
hint is correctly registered in `StatementContext` after analysis; also covers 
`USE_CBO_RULE` positive case.
   - Behavior changed: Yes — `NO_USE_CBO_RULE` hint now correctly suppresses 
the targeted CBO rule instead of being silently ignored.
   - Does this need documentation: No


-- 
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]

Reply via email to