Skip to content

[fix](statistics) Avoid re-estimating pruned partition predicates in stats#63764

Open
foxtail463 wants to merge 1 commit into
apache:masterfrom
foxtail463:fix/pruned-partition-filter-stats
Open

[fix](statistics) Avoid re-estimating pruned partition predicates in stats#63764
foxtail463 wants to merge 1 commit into
apache:masterfrom
foxtail463:fix/pruned-partition-filter-stats

Conversation

@foxtail463
Copy link
Copy Markdown
Contributor

Problem Summary:

For OLAP scans, partition pruning can already reduce the scan row count to the selected partitions. However, the original partition predicate is intentionally kept in the filter until post-processing so MV rewrite can still match the original query predicate.

During CBO stats calculation, this means the filter estimator may apply the same partition predicate again on top of the already-pruned scan row count, causing row count underestimation. For example, after pruning to one partition, id = 1 may already be reflected in the scan cardinality, but computeFilter still estimates selectivity for id = 1.

This change reuses the recorded PartitionPrunablePredicate on OLAP scans and skips those already-pruned conjuncts during filter statistics estimation, while preserving the existing plan shape and post-processing behavior.

@hello-stephen
Copy link
Copy Markdown
Contributor

Thank you for your contribution to Apache Doris.
Don't know what should be done next? See How to process your PR.

Please clearly describe your PR:

  1. What problem was fixed (it's best to include specific error reporting information). How it was fixed.
  2. Which behaviors were modified. What was the previous behavior, what is it now, why was it modified, and what possible impacts might there be.
  3. What features were added. Why was this function added?
  4. Which code was refactored and why was this part of the code refactored?
  5. Which functions were optimized and what is the difference before and after the optimization?

@foxtail463
Copy link
Copy Markdown
Contributor Author

run buildall

@foxtail463 foxtail463 changed the title [fix](fe) Avoid re-estimating pruned partition predicates in stats [fix](statistics) Avoid re-estimating pruned partition predicates in stats May 27, 2026
@foxtail463 foxtail463 force-pushed the fix/pruned-partition-filter-stats branch from 79c9f8e to 84aed36 Compare May 27, 2026 13:36
@foxtail463
Copy link
Copy Markdown
Contributor Author

run buildall

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants