Repository navigation
Support statistics uniqHLL12 - #95474
hanfei1991 wants to merge 9 commits into
Conversation
|
Workflow [PR], commit [e74e290] Summary: ❌
AI ReviewSummaryThis PR adds PR Metadata
Missing context
Findings
ClickHouse Rules
Performance & Safety
Final Verdict
|
| /// function state layout depends on the argument type, so merging mismatched | ||
| /// states would read garbage. A subsequent MUTATE rebuilds statistics | ||
| /// consistently, so it is safe to skip the merge here. | ||
| if (!collector->haveSameStateRepresentation(*other->collector)) |
There was a problem hiding this comment.
Returning early here keeps rows merged (done in ColumnStatistics::merge) but leaves uniq/uniqHLL12 state unmerged. That produces internally inconsistent statistics (rows from both parts, cardinality from one part), which can badly skew selectivity/cardinality estimates until a later rebuild.
Instead of silently skipping, please invalidate this statistic when representations differ (e.g. remove this type from the merged stats map or reset to an empty stat) so we fail closed and don't feed inconsistent estimates into the optimizer.
There was a problem hiding this comment.
It's okay, smapling a small part of data will still helpful. For cardinality it's not likely too skew
|
Fuzzer found a LOGICAL ERROR #104376 But I will not fix it in this PR, because it's unrelate |
LLVM Coverage Report
Changed lines: 92.50% (74/80) | lost baseline coverage: 8 line(s) · Uncovered code |
I will test the perforcemance before this PR is ready to review.
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
uniqHLL12 will be lightweighter than
uniqaggregator. It's an alternative ofuniqif we want to enable auto statistics by default.Documentation entry for user-facing changes