-
Notifications
You must be signed in to change notification settings - Fork 6k
planner: enhance partition prune when comparing partition key with constant of different types #59155
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: enhance partition prune when comparing partition key with constant of different types #59155
Conversation
Hi @L-maple. Thanks for your PR. I'm waiting for a pingcap member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
Hi @L-maple. Thanks for your PR. PRs from untrusted users cannot be marked as trusted with I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
7a2d704
to
5abd231
Compare
@Defined2014 Hi,I find a problem incompatible with MySQL. Could you help me review the PR please? |
/assign @L-maple |
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.
Will this work also with RANGE COLUMNS partitioning and non numeric data types?
/retest a new trigger command to refresh issue triage status. |
5abd231
to
b923f16
Compare
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.
Please check the integration tests and fix this one:
% cd tests/integrationtest
% ./run-tests.sh -s ../../bin/tidb-server -t planner/core/casetest/partition/partition_pruner
You can probably just record the new output with:
./run-tests.sh -s ../../bin/tidb-server -r planner/core/casetest/partition/partition_pruner
b923f16
to
002fec5
Compare
002fec5
to
60fc457
Compare
|
||
// case 4: range columns partition | ||
tk.MustExec(`CREATE TABLE t_range_col(a int, b int) | ||
PARTITION BY RANGE COLUMNS(a) ( |
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.
I would use a different datatype if testing COLUMNS partitioning, since that is the main usage (apart from partitioning on multiple columns, which is not as useful).
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.
I will complete the task,thanks for your advice!
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, thank you for your contribution and good work!
edcd8bd
to
7e4a001
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #59155 +/- ##
================================================
+ Coverage 73.0975% 73.4783% +0.3807%
================================================
Files 1689 1690 +1
Lines 467025 471169 +4144
================================================
+ Hits 341384 346207 +4823
+ Misses 104677 103867 -810
- Partials 20964 21095 +131
Flags with carried forward coverage won't be shown. Click here to find out more.
|
7e4a001
to
e58964b
Compare
@mjonss @Defined2014 It seems fast_test_tiprow fails because of bazel. How should I update tidb bazel file? |
cc @hawkingrei |
e58964b
to
5cc5872
Compare
…ant of different types
5cc5872
to
48f5dfe
Compare
[LGTM Timeline notifier]Timeline:
|
/retest |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: Defined2014, hawkingrei, mjonss The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
…nstant of different types (pingcap#59155) close pingcap#59123
Theoretically speaking, if we have an extra function upon the partition column, it is not safe to do the partition prune, for example: if the filter is
|
I suggest we should revert this pr first, and if we still want to do similar optimization, we need a more rigorous implementation @hawkingrei @fixdb cc @L-maple |
…ant of different types
What problem does this PR solve?
Issue Number: close #59123
Problem Summary:
What changed and how does it work?
SQL is a weak type language, and users always ignore constant types when comparing partition key.
When try to prune partitions, try more types of constant. For now, we should consider real and decimal, which are regularly used.
Check List
Tests
Side effects
Documentation
Release note
Please refer to Release Notes Language Style Guide to write a quality release note.