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

planner: fix a bug that can't find column in indexLookupJoin with virtual generated column #18516

Merged
merged 11 commits into from
Aug 25, 2020

Conversation

wjhuang2016
Copy link
Member

Signed-off-by: wjhuang2016 huangwenjun1997@gmail.com

What problem does this PR solve?

Issue Number: close #18515

Problem Summary:

ExpandVirtualColumn is missed.

What is changed and how it works?

  1. let finishCopTask handle ExpandVirtualColumn.
  2. Move (p PointGetPlan) Init to initialize.go

Related changes

  • Need to cherry-pick to the release branch

Check List

Tests

  • Unit test

Side effects

Release note

  • fix a bug that can't find column in indexLookupJoin with virtual generated column

Signed-off-by: wjhuang2016 <huangwenjun1997@gmail.com>
@wjhuang2016 wjhuang2016 requested review from a team as code owners July 13, 2020 11:47
@wjhuang2016 wjhuang2016 requested review from XuHuaiyu and removed request for a team July 13, 2020 11:47
@bb7133
Copy link
Member

bb7133 commented Jul 13, 2020

/run-all-tests

@bb7133
Copy link
Member

bb7133 commented Jul 14, 2020

 ==================
[2020-07-14T02:48:07.003Z] WARNING: DATA RACE
[2020-07-14T02:48:07.003Z] Write at 0x00c005674788 by goroutine 56:
[2020-07-14T02:48:07.003Z]   github.com/pingcap/tidb/executor.ResetContextOfStmt()
[2020-07-14T02:48:07.003Z]       /home/jenkins/agent/workspace/tidb_ghpr_unit_test/go/src/github.com/pingcap/tidb/executor/executor.go:1666 +0xe1d
[2020-07-14T02:48:07.003Z]   github.com/pingcap/tidb/session.(*session).ExecuteStmt()
[2020-07-14T02:48:07.003Z]       /home/jenkins/agent/workspace/tidb_ghpr_unit_test/go/src/github.com/pingcap/tidb/session/session.go:1140 +0x1f1
[2020-07-14T02:48:07.003Z]   github.com/pingcap/tidb/session.(*session).Execute()
[2020-07-14T02:48:07.003Z]       /home/jenkins/agent/workspace/tidb_ghpr_unit_test/go/src/github.com/pingcap/tidb/session/session.go:1081 +0x3ee
[2020-07-14T02:48:07.003Z]   github.com/pingcap/tidb/session.execRestrictedSQL()
[2020-07-14T02:48:07.003Z]       /home/jenkins/agent/workspace/tidb_ghpr_unit_test/go/src/github.com/pingcap/tidb/session/session.go:835 +0x15c
[2020-07-14T02:48:07.003Z]   github.com/pingcap/tidb/session.(*session).ExecRestrictedSQLWithContext()
[2020-07-14T02:48:07.003Z]       /home/jenkins/agent/workspace/tidb_ghpr_unit_test/go/src/github.com/pingcap/tidb/session/session.go:774 +0x25b
[2020-07-14T02:48:07.003Z]   github.com/pingcap/tidb/session.(*session).ExecRestrictedSQL()
[2020-07-14T02:48:07.003Z]       /home/jenkins/agent/workspace/tidb_ghpr_unit_test/go/src/github.com/pingcap/tidb/session/session.go:744 +0x92
[2020-07-14T02:48:07.003Z]   github.com/pingcap/tidb/statistics/handle.(*Handle).Update()
[2020-07-14T02:48:07.003Z]       /home/jenkins/agent/workspace/tidb_ghpr_unit_test/go/src/github.com/pingcap/tidb/statistics/handle/handle.go:162 +0x1eb
[2020-07-14T02:48:07.003Z]   github.com/pingcap/tidb/domain.(*Domain).loadStatsWorker()
[2020-07-14T02:48:07.003Z]       /home/jenkins/agent/workspace/tidb_ghpr_unit_test/go/src/github.com/pingcap/tidb/domain/domain.go:1096 +0x571
[2020-07-14T02:48:07.003Z] 
[2020-07-14T02:48:07.003Z] Previous read at 0x00c005674788 by goroutine 111:
[2020-07-14T02:48:07.003Z]   github.com/pingcap/tidb/executor.(*IndexLookUpExecutor).startIndexWorker.func1()
[2020-07-14T02:48:07.003Z]       /home/jenkins/agent/workspace/tidb_ghpr_unit_test/go/src/github.com/pingcap/tidb/executor/distsql.go:514 +0x477
[2020-07-14T02:48:07.003Z] 
[2020-07-14T02:48:07.003Z] Goroutine 56 (running) created at:
[2020-07-14T02:48:07.003Z]   github.com/pingcap/tidb/domain.(*Domain).UpdateTableStatsLoop()
[2020-07-14T02:48:07.003Z]       /home/jenkins/agent/workspace/tidb_ghpr_unit_test/go/src/github.com/pingcap/tidb/domain/domain.go:1041 +0x332
[2020-07-14T02:48:07.003Z]   github.com/pingcap/tidb/session.BootstrapSession()

Failed UT case

@bb7133
Copy link
Member

bb7133 commented Jul 14, 2020

/run-unit-test

@codecov
Copy link

codecov bot commented Jul 14, 2020

Codecov Report

Merging #18516 into master will decrease coverage by 0.0207%.
The diff coverage is 100.0000%.

@@               Coverage Diff                @@
##             master     #18516        +/-   ##
================================================
- Coverage   79.0884%   79.0677%   -0.0208%     
================================================
  Files           549        549                
  Lines        149047     149210       +163     
================================================
+ Hits         117879     117977        +98     
- Misses        21659      21702        +43     
- Partials       9509       9531        +22     

@wjhuang2016
Copy link
Member Author

/run-all-tests

@wjhuang2016
Copy link
Member Author

/run-common-test

1 similar comment
@wjhuang2016
Copy link
Member Author

/run-common-test

Signed-off-by: wjhuang2016 <huangwenjun1997@gmail.com>
@wjhuang2016
Copy link
Member Author

/run-common-test

@wjhuang2016
Copy link
Member Author

/run-all-tests

@qw4990
Copy link
Contributor

qw4990 commented Jul 24, 2020

PTAL @wjhuang2016 Please resolve conflicts.

if t.tablePlan != nil {
tp := t.tablePlan
for len(tp.Children()) > 0 {
tp = tp.Children()[0]
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
tp = tp.Children()[0]
if len(tp.Children()) == 1 {
tp = tp.Children()[0]
} else {
join := tp.(*PhysicalBroadCastJoin)
tp = join.children[1-join.InnerChildIdx]
}

We should consider broadcast join in cop task. And by the way, this check can be moved to https://github.com/pingcap/tidb/pull/18516/files#diff-2f445d8cb9c2f7d8ec4fb0586ae1f510R730

Signed-off-by: wjhuang2016 <huangwenjun1997@gmail.com>
Signed-off-by: wjhuang2016 <huangwenjun1997@gmail.com>
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

@ti-srebot ti-srebot added the status/LGT1 Indicates that a PR has LGTM 1. label Aug 18, 2020
Copy link
Contributor

@lzmhhh123 lzmhhh123 left a comment

Choose a reason for hiding this comment

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

LGTM

@ti-srebot ti-srebot removed the status/LGT1 Indicates that a PR has LGTM 1. label Aug 18, 2020
@ti-srebot ti-srebot added the status/LGT2 Indicates that a PR has LGTM 2. label Aug 18, 2020
@lzmhhh123
Copy link
Contributor

/merge

@ti-srebot ti-srebot added the status/can-merge Indicates a PR has been approved by a committer. label Aug 18, 2020
@ti-srebot
Copy link
Contributor

Your auto merge job has been accepted, waiting for:

  • 18732
  • 18846
  • 19237
  • 19237
  • 19237
  • 19202
  • 18970
  • 19035

@ti-srebot
Copy link
Contributor

/run-all-tests

@ti-srebot
Copy link
Contributor

@wjhuang2016 merge failed.

@wjhuang2016
Copy link
Member Author

/run-all-tests

@zz-jason
Copy link
Member

/merge

@ti-srebot
Copy link
Contributor

Your auto merge job has been accepted, waiting for:

  • 19266
  • 19248
  • 19210
  • 19255
  • 19242

@ti-srebot
Copy link
Contributor

/run-all-tests

@ti-srebot
Copy link
Contributor

@wjhuang2016 merge failed.

@wjhuang2016
Copy link
Member Author

/run-all-tests

@wjhuang2016 wjhuang2016 merged commit 977449f into pingcap:master Aug 25, 2020
ti-srebot pushed a commit to ti-srebot/tidb that referenced this pull request Aug 25, 2020
Signed-off-by: ti-srebot <ti-srebot@pingcap.com>
@ti-srebot
Copy link
Contributor

cherry pick to release-4.0 in PR #19439

ti-srebot added a commit that referenced this pull request Sep 1, 2020
…tual generated column (#18516) (#19439)

Signed-off-by: ti-srebot <ti-srebot@pingcap.com>
Signed-off-by: wjhuang2016 <huangwenjun1997@gmail.com>
@wjhuang2016 wjhuang2016 deleted the fix_expandVirtualColumn branch November 17, 2022 11:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/expression status/can-merge Indicates a PR has been approved by a committer. 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.

IndexLookup Join can't find column with virtual generated column
7 participants