Skip to content
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

executor: fix update join result when join table order changed #7571

Merged
merged 2 commits into from
Sep 3, 2018
Merged

executor: fix update join result when join table order changed #7571

merged 2 commits into from
Sep 3, 2018

Conversation

lysu
Copy link
Contributor

@lysu lysu commented Aug 31, 2018

What problem does this PR solve?

this question is introduced by #7177

create two simple table and one of them have primary key.

create table t6 (id int, v longtext);
create table t7 (x int, id int, v longtext, primary key(id);
insert into t6 values (1, NULL);
insert into t7 values (5, 1, 'a')

execute this

update t6, t7 set t6.v = t7.v where t6.id = t7.id

will make t6.v be a.

but with

update t6, t7 set t6.v = t7.v where t6.id = t7.id and t7.x = 5;

will update nothing.

because added t7.x = 5 will change plan from t6 join t7 to t7 join t6 and in update there are no projection stage like select stmt.

one of new added code doesn't take care about it and use updateExec.schema to build handle identity map, but use update.selectExec.schema to query map, so meet error.

What is changed and how it works?

build identity map using update.SelectPlan instead of updatePlan, oneline change.

Check List

Tests

  • Unit test
  • Integration test

Code changes

  • bug fix

Side effects

  • no

Related changes

  • no

This change is Reviewable

@lysu lysu added type/bugfix This PR fixes a bug. sig/execution SIG execution labels Aug 31, 2018
@lysu
Copy link
Contributor Author

lysu commented Aug 31, 2018

/run-all-tests

@zz-jason
Copy link
Member

zz-jason commented Sep 3, 2018

LGTM

Copy link
Contributor

@eurekaka eurekaka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Member

@winoros winoros left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@lysu lysu merged commit 3d891d9 into pingcap:master Sep 3, 2018
@lysu lysu deleted the fix_update_projection branch September 3, 2018 06:12
@lysu lysu added the status/LGT2 Indicates that a PR has LGTM 2. label Sep 3, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sig/execution SIG execution status/LGT2 Indicates that a PR has LGTM 2. type/bugfix This PR fixes a bug.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants