xy720 opened a new pull request, #67354:
URL: https://github.com/apache/doris/pull/67354
### What problem does this PR solve?
Root cause chain:
1. Analyze sample round hot_values with `ROUND(t2.`count` /
${rowCount2}, 2))`.
A value with true ratio 0.1858% is rounded as 0.00.
2. FilterEstimation.estimateColumnEqualToConstant unconditionally
overwrites 1/ndv with the 0.00 hot value ratio.
3. Filter output rowCount collapses to 0.
4. InitJoinOrder's `left > 0` guard rejects the swap.
5. JoinEstimation floors row count back to 1 via Math.max(1, ...).
6. Plan generated wrong join order, the huge side becomes hash build
side and the mv refresh failed.
Triggered this bug by enabling force_sample_analyze=true globally in our
customers cluster,
which manual ANALYZE through the sample path that collects hot values.
Fix (three-in-one, all minimal):
- Analyze: ROUND scale 2 -> 4 in both LINEAR and DUJ1 templates.
- FilterEstimation: guard against hot_value ratio == 0.0 rounding
artifact, fall back
to the uniform 1/ndv estimate.
- InitJoinOrder: relax `left > 0` to `left >= 0`; the downstream
Math.max(1, ..)
in JoinEstimation already prevents any loop from truly-negative
estimates.
### Release note
None
### Check List (For Author)
- Test <!-- At least one of them must be included. -->
- [ ] Regression test
- [x] Unit Test
- [ ] Manual test (add detailed scripts or steps below)
- [ ] No need to test or manual test. Explain why:
- [ ] This is a refactor/code format and no logic has been changed.
- [ ] Previous test can cover this change.
- [ ] No code files have been changed.
- [ ] Other reason <!-- Add your reason? -->
- Behavior changed:
- [x] No.
- [ ] Yes. <!-- Explain the behavior change -->
- Does this need documentation?
- [x] No.
- [ ] Yes. <!-- Add document PR link here. eg:
https://github.com/apache/doris-website/pull/1214 -->
### 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]