You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Others: Optimizer block-filter planning for composite primary keys and composite cluster keys.
Actual Behavior
When composite-key predicate rewriting replaces predicates on physical key parts with a predicate on the hidden compound key, later ReCalcNodeStats rebuilds BlockFilterList from the rewritten FilterList. The physical-part predicates are then lost.
This preserves query results but removes valid zonemap pruning opportunities for each constituent key column. A high-cost/AP stats pass can repeat the loss after an earlier pass had retained the part filters.
Expected Behavior
The block-filter list should retain both:
the compound-key predicate, for sorted-key/read-filter pruning; and
every consumed, zonemappable predicate on a constituent key column, for independent zonemap pruning.
Repeated stats recalculation must neither lose nor duplicate these predicates.
Steps to Reproduce
Create a table with a composite primary key or composite cluster key.
Run a query such as WHERE c1 = 5 AND c2 > 3 AND c2 < 100.
Inspect EXPLAIN before the fix: only the hidden compound-key predicate appears in Block Filter Cond.
Trigger a plan path with repeated stats recalculation; the part-column predicates remain absent.
Additional Information
The fix preserves consumed constituent predicates across stats recalculation, retains the generated compound predicate, and deduplicates equivalent filters. Regression coverage includes unit tests and test/distributed/cases/optimizer/blockfilter.test.
Activity
fix: strengthen filter pushdown and PK pruning (#25596)
XuPeng-SH commentedon Jul 12, 2026
@Ariznawlll
Ariznawlll commentedon Jul 13, 2026
已在最新
main@2865ed6cc8a39727b8b274bb52b88fe441d0b30c验证通过。de6438665/ fix: strengthen filter pushdown and PK pruning #25596。-race -count=10通过,覆盖复合 PK/cluster key、disable hint、in-place predicate mutation、folded IN vector、重复 stats/rewrite 和跨 planner representation 去重。未发现 part-column zonemap filter 再次丢失或重复,修复有效。
fix: strengthen filter pushdown and PK pruning (matrixorigin#25596)
fix: strengthen filter pushdown and PK pruning (matrixorigin#25596)
fix: strengthen filter pushdown and PK pruning (matrixorigin#25596)