planner,expression: use constraint propagation in partition pruning#8885
planner,expression: use constraint propagation in partition pruning#8885tiancaiamao merged 26 commits intopingcap:masterfrom
Conversation
|
@tiancaiamao Please add some proper labels. For example, component, type. |
Codecov Report
@@ Coverage Diff @@
## master #8885 +/- ##
=========================================
Coverage ? 67.14%
=========================================
Files ? 372
Lines ? 76968
Branches ? 0
=========================================
Hits ? 51679
Misses ? 20657
Partials ? 4632
Continue to review full report at Codecov.
|
| } | ||
| } | ||
|
|
||
| if partCol == nil { |
There was a problem hiding this comment.
can we check partCol == nil first when entering this function?
There was a problem hiding this comment.
Do you mean check partCol == nil at the beginning of this function and return false? No we can't do that.
In to_days(c) > xx and c < yy, partCol is nil, but I want to handle it.
If this branch moved to the beginning, the canBePruned will return immediately.
There was a problem hiding this comment.
Got it. Could you add a comment about this to let others know why we intentionally put this check after solver.Solve()?
|
/run-all-tests |
|
/run-unit-test |
|
/run-all-tests |
|
PTAL @winoros |
|
/run-all-tests |
What problem does this PR solve?
Fix #7516
Now we can prune some of the
to_daysfunction:The partition expression is
TO_DAYS(b) < XXX and TO_DAYS(b) >= YYY, it has a functionto_days.From the result we can see that
p20090404,p20090405is pruned.What is changed and how it works?
Fix those two restrictions mentioned in the issue:
Now prune will consider both push down conditions and the filter conditions in the
selection.Leverage the constraint propagate rule in #8640
to handle expressions (function) that can't calculate range.
There are still two minor problems, but they are not introduced by this commit:
col < const or col is null, current partition pruning can't pruneor col is nullCheck List
Tests
This change is