englefly opened a new pull request, #69225:
URL: https://github.com/apache/doris/pull/69225
### What problem does this PR solve?
Issue Number: None
Related PR: #69209
Problem Summary:
`ANALYZE ... WITH SAMPLE ... WITH HOT VALUE` was rejected by
`AnalyzeCommand.validate`. The
rejection was introduced together with `WITH HOT VALUE`: at that time a
sample analyze always
collected hot values, so the flag was redundant and rejecting it early kept
the command from
silently doing nothing.
After #69209 the linear estimator no longer collects hot values, but a
sample analyze still
collects them for every column the DUJ1 estimator serves - and which
estimator a column gets is
decided per column at execution time
(`OlapAnalysisTask.getSampleCollectInfo`: table row count,
sampled rows, single distribution / single key column, partition flags), so
the command layer
cannot tell whether the flag would be honored for a particular column.
Rejecting the combination
is therefore wrong for the columns that do collect hot values (the DUJ1
ones), while for the
linear ones the flag never could force collection anyway.
This PR accepts the combination. The flag keeps its only real meaning - it
selects the hot value
template of a full analyze - and has no effect on a sample analyze: hot
values still come from the
DUJ1 estimator, and a full analyze with `WITH HOT VALUE` remains the way to
collect them for a
linear-estimated column.
Before this PR, both command paths that reach the check (`ANALYZE TABLE` and
`ANALYZE DATABASE`)
returned:
```
ERROR 1105 (HY000): errCode = 2, detailMessage = Sample analyze does not
support WITH HOT VALUE
```
After it, the statement succeeds and the analyze runs with the estimator the
sample picks.
### Release note
`ANALYZE TABLE ... WITH SAMPLE ... WITH HOT VALUE` is no longer rejected.
The flag only affects a
full analyze; on a sample analyze hot values are still collected only for
the columns analyzed by
the DUJ1 estimator.
### Check List (For Author)
- Test
- [x] Unit Test
- `AnalyzeTableCommandTest#testSampleAnalyzeWithHotValueAccepted`
(the command validates
without the hot-value rejection, and the parsed statement is still
a sample analyze)
- [x] Regression test
- `test_full_analyze_hot_value`: Test 6 accepts the flag on a table
whose sample falls back
to the linear estimator (no hot value), Test 7 keeps the DUJ1 hot
value with the flag
present; needs a built FE + cluster, so it runs in CI
- [ ] Manual test (add detailed scripts or steps below)
- [ ] No need to test or manual test. Explain why:
- Behavior changed:
- [ ] No.
- [x] Yes. `ANALYZE ... WITH SAMPLE ... WITH HOT VALUE` no longer fails;
the flag is accepted
and has no effect on a sample analyze (hot values are decided by the
estimator).
- Does this need documentation?
- [ ] No.
- [x] Yes, ideally: the `ANALYZE` reference should say the flag is only
meaningful for a full
analyze. No docs PR yet.
### Check List (For Reviewer who merge this PR)
- [ ] Confirm the release note
- [ ] Confirm test cases
- [ ] Confirm document
- [ ] Add branch pick label
--
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]