englefly opened a new pull request, #71345:
URL: https://github.com/apache/doris/pull/71345
### Background
Doris chooses a sampling estimator for each column. The linear estimator
previously ran an extra aggregation over the sample to collect hot values,
including when an OLAP sample fell back to a full scan. DUJ1 already groups the
sample for its NDV estimate and can reuse those groups.
### What problem does this PR solve?
Issue Number: None
Related PR: #69209 (remove hot-value aggregation from the linear estimator),
#69225 (accept `WITH HOT VALUE` on sample analyze)
PR Type: Enhancement
Problem Summary:
Backport both changes to `branch-4.2`. The linear estimator returns a NULL
`hot_value` in the existing result column. DUJ1 continues to collect hot values
from its grouped sample. Table and database `ANALYZE` commands accept `WITH
SAMPLE ... WITH HOT VALUE`, with hot-value collection still determined by the
estimator.
### Details
- **Before and after** — Linear sampling avoids an extra pass over the
sample. Accepting the options together lets callers use the same syntax for
both estimators.
- **Configs and defaults** — Uses the existing hot-value collection setting
for DUJ1 and the explicit full-analyze path.
- **Impact on existing users** — Use a full analyze with `WITH HOT VALUE` to
collect hot values for a column that uses the linear estimator when sampled.
Partition-level analysis still uses its existing per-partition statistics.
### Testing
- FE Checkstyle and `git diff --check` passed.
- `./run-fe-ut.sh --run` passed all 40 tests in `HMSAnalysisTaskTest`,
`OlapAnalysisTaskTest`, and `AnalyzeTableCommandTest`.
- The backport includes the upstream regression updates for linear and DUJ1
sampling, explicit full analyze, and the aggregation plan that depends on hot
values. Local regression verification is pending.
### Notes for Reviewers
This branch implements Hive sampling in `HMSAnalysisTask`. The backport
applies the same estimator-specific SQL parameters there and keeps the branch's
JMockit setup in the FE tests. The linear template represents the missing
hot-value statistics as NULL in the existing result column.
### Release note
Sample analyze skips hot-value collection for columns that use the linear
estimator. Table and database sample analyze accept `WITH HOT VALUE`. DUJ1
continues to collect hot values automatically.
### Check List (For Author)
- Test
- [ ] Regression test
- [x] Unit Test
- Behavior changed
- [x] Yes, as described above.
- Does this need documentation?
- [x] No separate documentation change in this backport.
- Pre-submission status
- Partially verified. FE unit tests and Checkstyle passed. Regression
verification is pending.
### Check List (For Reviewer who merge this PR)
- [ ] Confirm the release note
- [ ] Confirm test cases
- [ ] Confirm document
### AI Disclosure
- Tool: Codex.
- Generated: 4.2 conflict resolutions, test adaptations, and this
description.
- Human review: Pending.
--
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]