Repository navigation
Add null_count statistics - #102356
Add null_count statistics#102356
null_count statistics#102356Conversation
|
cc @hanfei1991 |
|
Workflow [PR], commit [244fe17] Summary: ❌
AI ReviewSummaryThis PR adds Missing context
ClickHouse Rules
Final Verdict
|
| namespace | ||
| { | ||
| /// Helper to create ColumnStatistics with specified types for merge testing | ||
| ColumnStatisticsPtr createTestStats( |
There was a problem hiding this comment.
Add tests for one-sided NullCount merge behavior and V3 deserialization edge cases.
|
@hanfei1991 CI is green now. Could you please take some time to review this PR when you're free? Thanks! |
|
added null_count to test randomization, let's monitor the status of CI again :) |
|
@hanfei1991 I just resolved the conflicts, but since you recently updated |
hanfei1991
left a comment
There was a problem hiding this comment.
This PR contains two changes:
- add null_count statistics
- use null_count stats to prune parts during read
Can we make two PRs? For the first PR we can only add null_count.
And in ConditionSelectivityEstimator.cpp We can use getNonNullRowCount instead of getNumRows() in some case.
Got it. I'll undo the part pruning logic and only include the new |
|
@zoomxi I modified some code. Feel free to change them again if you have other ideas |
LLVM Coverage Report
Changed lines: 91.85% (597/650) | lost baseline coverage: 7 line(s) · Uncovered code |
hanfei1991
left a comment
There was a problem hiding this comment.
We need three-valued logic in estimator, but I would make it in another PR ...
17fb5f9
|
@zoomxi I just realized |
Yes,
So I'd suggest keeping |
|
Hi @zoomxi @hanfei1991 — while reviewing this PR I found the following:
Could you review the test PR and add the |
| SELECT 'Fallback selectivity uses non-null row count (b before a)'; | ||
| SELECT count() FROM ( | ||
| EXPLAIN actions=1 SELECT count() FROM test_fallback_selectivity WHERE a = 1 AND b = 1 | ||
| ) WHERE explain LIKE '%Prewhere filter column%b%a%'; |
There was a problem hiding this comment.
@groeneai could you add a test with attach/detach and check everything goes well? Maybe an upgrade and downgrade integration test would be nice too.
|
@zoomxi @zoomxi Kindly revert this PR and the two follow-up PRs #103949 #104214 (I would have done it by myself but the revert already has lots of merge conflicts) - it must not land in 26.5.
Setting |
|
|
||
| - `NullCount` | ||
|
|
||
| Tracks the number of `NULL` values in `Nullable` columns. Used for accurate selectivity estimation of `IS NULL`/`IS NOT NULL` predicates in PREWHERE optimization. |
There was a problem hiding this comment.
Not clear for readers if the value is exact or an estimation.
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Added NullCount statistics type for accurate NULL value counting in Nullable columns. This enables improved
PREWHEREoptimization and better part pruning.Documentation entry for user-facing changes