englefly opened a new pull request, #70053:
URL: https://github.com/apache/doris/pull/70053
### What problem does this PR solve?
Related PR: #68211 (branch-4.2), #60601 (master)
Problem Summary:
#68211 introduced the multi-mode CTE inline strategy and made
`cte_inline_mode = 0` (selective inline) the default. With that default the
plan shapes of TPC-DS queries 4/11/74 change, and the optimizer chooses
between several equal-cost alternatives, so the corresponding `shape_check`
baselines are no longer stable and depend on the environment.
This PR restores the default to `-1` (the CBO inline alternative is
disabled), keeping the new modes opt-in:
- `<0` (new default): no CBO inline alternative is generated;
- `=0`: selective inline, only UNION ALL CTEs whose branches can be pruned
by consumer filters;
- `>=1`: materialized and inlined alternatives are both added to the Memo
and compared by the CBO.
The `shape_check` baselines of tpcds q4/q11/q74 in `tpcds_sf100`,
`tpcds_sf1000`, `tpcds_sf1000_constraints` and `tpcds_sf10t_orc` were
regenerated with `-forceGenOut` on branch-4.2 and are identical to the
materialized plans used before #68211.
### Release note
CTE inline is disabled by default again: `cte_inline_mode` defaults to `-1`
instead of `0`. It can still be enabled per session with
`SET cte_inline_mode = 0` (selective) or `SET cte_inline_mode = 1`
(CBO comparison).
### Check List (For Author)
- Test <!-- At least one of them must be included. -->
- [x] Regression test
- [ ] Unit Test
- [ ] Manual test (add detailed scripts or steps below)
- [ ] No need to test or manual test. Explain why:
- Behavior changed:
- [ ] No.
- [x] Yes. `cte_inline_mode` now defaults to -1 (inline disabled), which
restores the pre-#68211 plan shapes for TPC-DS q4/11/74.
- Does this need documentation?
- [x] No.
- [ ] Yes. <!-- The session variable `cte_inline_mode` added in #68211 is
not documented yet; a separate doc PR can cover it. -->
### Check List (For Reviewer who merge this PR)
- [ ] Confirm the release note
- [ ] Confirm test cases
- [ ] Confirm document
- [ ] Add branch pick label <!-- Add branch pick label that this PR should
merge into -->
--
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]