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 bug when pruning columns for TableDual #11054

Merged
merged 7 commits into from
Jul 11, 2019

Conversation

winoros
Copy link
Member

@winoros winoros commented Jul 3, 2019

What problem does this PR solve?

Dual may not be from only one data source.
So check cols[0] is not enough.

What is changed and how it works?

Check the full slice.

Check List

Tests

  • Unit test

Related changes

  • Need to cherry-pick to the release branch

@winoros winoros added the type/bugfix This PR fixes a bug. label Jul 3, 2019
@winoros winoros requested review from eurekaka, alivxxx and lzmhhh123 July 3, 2019 09:15
@winoros
Copy link
Member Author

winoros commented Jul 3, 2019

/run-all-tests

@winoros winoros changed the title planner: fix bug when prune columns for TableDual planner: fix bug when pruning columns for TableDual Jul 3, 2019
@winoros
Copy link
Member Author

winoros commented Jul 3, 2019

/run-common-test
/run-unit-test

@codecov
Copy link

codecov bot commented Jul 3, 2019

Codecov Report

Merging #11054 into master will not change coverage.
The diff coverage is n/a.

@@             Coverage Diff             @@
##             master     #11054   +/-   ##
===========================================
  Coverage   81.2821%   81.2821%           
===========================================
  Files           423        423           
  Lines         90133      90133           
===========================================
  Hits          73262      73262           
  Misses        11571      11571           
  Partials       5300       5300

Copy link
Contributor

@alivxxx alivxxx left a comment

Choose a reason for hiding this comment

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

LGTM

@alivxxx alivxxx added the status/LGT1 Indicates that a PR has LGTM 1. label Jul 3, 2019
@imtbkcat
Copy link

imtbkcat commented Jul 3, 2019

/run-all-tests tidb-test=pr/847

@@ -262,8 +262,15 @@ func (p *LogicalTableDual) PruneColumns(parentUsedCols []*expression.Column) err
}
}
for k, cols := range p.schema.TblID2Handle {
if p.schema.ColumnIndex(cols[0]) == -1 {
for i := len(cols) - 1; i >= 0; i-- {
Copy link
Contributor

@eurekaka eurekaka Jul 4, 2019

Choose a reason for hiding this comment

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

The content of TblID2Handle looks weird for the above test case, i.e, t1.a and t2.a are all stored in single bucket of TblID2Handle[70] in my instance for example. Though t1 and t2 are two aliases for same table t, actually they should be 2 separate tables in the query. Would it have risk in executor when using TblID2Handle like this?

Copy link
Contributor

Choose a reason for hiding this comment

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

Is any situation that the handle has not only one column? I think TblID2Handle should be the map<id, *Column>.

Copy link
Contributor

Choose a reason for hiding this comment

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

Anyway. This is one of the chaos of Schema. Maybe temporarily fix bugs is OK.

Copy link
Member Author

@winoros winoros Jul 4, 2019

Choose a reason for hiding this comment

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

@lzmhhh123 @eurekaka
The only case that one table id maps to multiple Column is multi-table delete.

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. btw, should other logical plans in pruning columns need to be changed?

@lzmhhh123 lzmhhh123 added status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels Jul 4, 2019
@winoros
Copy link
Member Author

winoros commented Jul 4, 2019

@lzmhhh123 Currently, no. We can move this thing out of schema ASAP.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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.

5 participants