-
Notifications
You must be signed in to change notification settings - Fork 6.1k
planner/core: update missing virtual columns in update and insert (#58401)
#64752
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
base: release-8.5
Are you sure you want to change the base?
planner/core: update missing virtual columns in update and insert (#58401)
#64752
Conversation
|
This cherry pick PR is for a release branch and has not yet been approved by triage owners. To merge this cherry pick:
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. |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## release-8.5 #64752 +/- ##
================================================
Coverage ? 48.6535%
================================================
Files ? 1559
Lines ? 440344
Branches ? 0
================================================
Hits ? 214243
Misses ? 207018
Partials ? 19083
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
|
@ti-chi-bot: The following tests failed, say
Full PR test history. Your PR dashboard. 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. I understand the commands that are listed here. |
This is an automated cherry-pick of #58401
What problem does this PR solve?
Issue Number: close #58400
Problem Summary:
In #58494, we fixed a problem related to virtual columns. But we haven't completely fixed it yet. There still have problems with virtual columns.
For Update:
In
updatestatements, virtual columns will be added intoUpdateListsif their dependent columns have changed. #55829 has fixed nested generated column.tidb/pkg/planner/core/logical_plan_builder.go
Lines 5826 to 5837 in f2db9c4
However, we still ignore the columns with OnUpdateNow flag when checking dependency. Since these columns may be updated in the execution stage too.
For Insert:
For SQL like
INSERT INTO ... ON DUPLICATE KEY UPDATE ..., only virtual columns that directly depend on the assignments afterUPDATEwill be updated. Take the table in #58400 as example:The dependencies of each column are listed below. Only
j2and_V$_i1_0are updated since they depends onj1. We should handle it the same way as what we do in #55829.What changed and how does it work?
In summary, when extracting generated columns, we have to consider both chain dependencies and on-update-now flag too.
Check List
Tests
Side effects
Documentation
Release note
Please refer to Release Notes Language Style Guide to write a quality release note.