-
Notifications
You must be signed in to change notification settings - Fork 5.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
planner,expression: use constraint propagation in partition pruning #8885
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.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
} | ||
} | ||
|
||
if partCol == nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we check partCol == nil
first when entering this function?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it. Could you add a comment about this to let others know why we intentionally put this check after solver.Solve()
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
/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_days
function: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
,p20090405
is 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 null
Check List
Tests
This change is