-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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: allow queries on virtual columns to use index #10802
Conversation
Codecov Report
@@ Coverage Diff @@
## master #10802 +/- ##
================================================
- Coverage 81.2832% 81.2779% -0.0053%
================================================
Files 424 424
Lines 91004 91096 +92
================================================
+ Hits 73971 74041 +70
- Misses 11704 11726 +22
Partials 5329 5329 |
/run-all-tests |
Waiting for https://github.com/pingcap/tidb-test/pull/841; |
PTAL @lamxTyler @winoros @crazycs520 |
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
d8d83a6
to
ccd39b0
Compare
Some new problems and corner cases are found when a virtual column is in the inner child of an |
What problem does this PR solve?
Fix #5189, allow queries on virtual columns to use index.
What is changed and how it works?
Before this PR, virtual columns are replaced with corresponding physical columns when building the basic logical plan, which happens before the optimization.
Therefore, when the optimizer gets the replaced logical plan, there is no virtual column in it, so the optimizer will not use the corresponding virtual index to optimize this plan.
In this PR, we postpone replacing the virtual column until the optimization is finished, so the optimizer will take virtual columns into account and virtual indices will be used.
Check List
Tests