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

*: fix bugs that creating index on clustered index table or table with the virtual generated column #18114

Merged
merged 13 commits into from
Jun 19, 2020

Conversation

wjhuang2016
Copy link
Member

@wjhuang2016 wjhuang2016 commented Jun 18, 2020

What problem does this PR solve?

Issue Number: close #18061

Problem Summary:
I wrongly remove the handle's decode logic in #18045.
Anyway, the previously handle's decode logic didn't consider common handle, it's not completely correct.

What is changed and how it works?

  1. Add the handle's decode logic back in DecodeAndEvalRowWithMap() and implement the common handle part.
  2. Fix the wrong decode logic for common handle in decodeOldRowValToChunk(), point_get.go
  3. Remove the handle's decode logic after the DecodeAndEvalRowWithMap() , do it in DecodeAndEvalRowWithMap().
  4. Wrap two functions TryGetCommonPkColumnIds and TryGetCommonPkColumns.

Related changes

Check List

Tests

  • Unit test

Side effects

Release note

  • No release note

Signed-off-by: wjhuang2016 <huangwenjun1997@gmail.com>
Signed-off-by: wjhuang2016 <huangwenjun1997@gmail.com>
Signed-off-by: wjhuang2016 <huangwenjun1997@gmail.com>
Signed-off-by: wjhuang2016 <huangwenjun1997@gmail.com>
Signed-off-by: wjhuang2016 <huangwenjun1997@gmail.com>
@wjhuang2016 wjhuang2016 requested review from a team as code owners June 18, 2020 07:49
@wjhuang2016 wjhuang2016 requested review from XuHuaiyu and removed request for a team June 18, 2020 07:50
@github-actions github-actions bot added sig/sql-infra SIG: SQL Infra sig/execution SIG execution labels Jun 18, 2020
@wjhuang2016 wjhuang2016 added the type/bugfix This PR fixes a bug. label Jun 18, 2020
ddl/db_test.go Outdated Show resolved Hide resolved
ddl/db_test.go Outdated Show resolved Hide resolved
@codecov
Copy link

codecov bot commented Jun 18, 2020

Codecov Report

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

@@             Coverage Diff             @@
##             master     #18114   +/-   ##
===========================================
  Coverage   79.9567%   79.9567%           
===========================================
  Files           526        526           
  Lines        145535     145535           
===========================================
  Hits         116365     116365           
  Misses        20000      20000           
  Partials       9170       9170           

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

@tangenta tangenta left a comment

Choose a reason for hiding this comment

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

LGTM

@tangenta
Copy link
Contributor

/label LGT1

@ti-srebot ti-srebot added the LGT1 label Jun 18, 2020
@tangenta
Copy link
Contributor

/unlabel LGT1
/label status/LGT1

@ti-srebot ti-srebot added the status/LGT1 Indicates that a PR has LGTM 1. label Jun 18, 2020
@tangenta tangenta removed the LGT1 label Jun 18, 2020
@wjhuang2016 wjhuang2016 changed the title * fix bugs that creating index on clustered index table or table with the virtual generated column *: fix bugs that creating index on clustered index table or table with the virtual generated column Jun 19, 2020
return row, nil
}

pkCols := tables.TryGetCommonPkColumnIds(tbl)
Copy link
Member

Choose a reason for hiding this comment

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

The RowDecoder already has a table field, we show create pkCols in NewRowDecoder.

Signed-off-by: wjhuang2016 <huangwenjun1997@gmail.com>
// DecodeAndEvalRowWithMap decodes a byte slice into datums and evaluates the generated column value.
func (rd *RowDecoder) DecodeAndEvalRowWithMap(ctx sessionctx.Context, handle kv.Handle, b []byte, decodeLoc, sysLoc *time.Location, row map[int64]types.Datum) (map[int64]types.Datum, error) {
func (rd *RowDecoder) DecodeAndEvalRowWithMap(ctx sessionctx.Context, handle kv.Handle, b []byte, decodeLoc, sysLoc *time.Location, row map[int64]types.Datum, tbl *model.TableInfo) (map[int64]types.Datum, error) {
Copy link
Member

Choose a reason for hiding this comment

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

The tbl arg can be removed.

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

coocood commented Jun 19, 2020

LGTM

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

coocood commented Jun 19, 2020

/merge

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

/run-all-tests

@ti-srebot
Copy link
Contributor

@wjhuang2016 merge failed.

@wjhuang2016
Copy link
Member Author

/merge

@ti-srebot
Copy link
Contributor

/run-all-tests

@ti-srebot
Copy link
Contributor

@wjhuang2016 merge failed.

@coocood coocood merged commit 7daa4a7 into pingcap:master Jun 19, 2020
@wjhuang2016 wjhuang2016 deleted the fix_cluster_virtual_index branch November 17, 2022 11:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sig/execution SIG execution sig/sql-infra SIG: SQL Infra status/can-merge Indicates a PR has been approved by a committer. status/LGT1 Indicates that a PR has LGTM 1. type/bugfix This PR fixes a bug.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

cannot create index on virtual generated column.
4 participants