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 cast function will ignore tht error for point-get key construction #22869

Merged
merged 10 commits into from
Mar 9, 2021

Conversation

AilinKid
Copy link
Contributor

Signed-off-by: ailinkid 314806019@qq.com

What problem does this PR solve?

Issue Number: close #22839

What is changed and how it works?

What's Changed:
For (batch) point get, the idxVals should exactly equal to the value in the index record. Cast errors like truncate/data-too-long will trim the idxVals value to the short another one, which will lead to unexpected results. Here we force the cast func to return all the errors.

Seems #17245 is doing the same thing, but it is only for the Overflow error.

Related changes

  • PR to update pingcap/docs/pingcap/docs-cn:
  • Need to cherry-pick to the release branch

Check List

Tests

  • Unit test
  • Integration test

Release note

  • executor: fix cast function will ignore the error for point get key construction

Signed-off-by: ailinkid <314806019@qq.com>
@AilinKid AilinKid requested a review from a team as a code owner February 22, 2021 09:32
@AilinKid AilinKid requested review from wshwsh12 and removed request for a team February 22, 2021 09:32
@AilinKid AilinKid requested a review from tangenta February 22, 2021 09:33
@github-actions github-actions bot added the sig/execution SIG execution label Feb 22, 2021
@ichn-hu ichn-hu mentioned this pull request Feb 22, 2021
Signed-off-by: ailinkid <314806019@qq.com>
@ti-chi-bot ti-chi-bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Feb 23, 2021
@XuHuaiyu XuHuaiyu added type/bugfix This PR fixes a bug. sig/planner SIG: Planner and removed sig/execution SIG execution labels Feb 26, 2021
@XuHuaiyu XuHuaiyu requested review from rebelice and qw4990 and removed request for wshwsh12 and tangenta February 26, 2021 02:57
@github-actions github-actions bot added the sig/execution SIG execution label Feb 26, 2021
@@ -424,8 +424,13 @@ func EncodeUniqueIndexValuesForKey(ctx sessionctx.Context, tblInfo *model.TableI
str, err = idxVals[i].ToString()
idxVals[i].SetString(str, colInfo.FieldType.Collate)
} else {
// Since this func is only used batch point get, the idxVals should be exactly equals to value in
Copy link
Contributor

Choose a reason for hiding this comment

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

If a truncated error or an overflow error is thrown when converting the type of `idxVal[i]` to the type of `colInfo`, the `idxVal` does not exist in the `idxInfo` for sure.

AilinKid added 2 commits March 5, 2021 17:10
Signed-off-by: ailinkid <314806019@qq.com>
@ti-chi-bot ti-chi-bot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Mar 5, 2021
@AilinKid
Copy link
Contributor Author

AilinKid commented Mar 5, 2021

/run-all-tests

@XuHuaiyu
Copy link
Contributor

XuHuaiyu commented Mar 9, 2021

/LGTM

@ti-chi-bot ti-chi-bot added the status/LGT1 Indicates that a PR has LGTM 1. label Mar 9, 2021
@guo-shaoge
Copy link
Collaborator

/LGTM

@ti-chi-bot
Copy link
Member

@guo-shaoge: /lgtm is only allowed for the reviewers in list.

In response to this:

/LGTM

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 ti-community-infra/tichi repository.

@wshwsh12
Copy link
Contributor

wshwsh12 commented Mar 9, 2021

/LGTM

@ti-chi-bot
Copy link
Member

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • XuHuaiyu
  • wshwsh12

To complete the pull request process, please ask the reviewers in the list to review by filling /cc @reviewer in the comment.
After your PR has acquired the required number of LGTMs, you can assign this pull request to the committer in the list by filling /assign @committer in the comment to help you merge this pull request.

The full list of commands accepted by this bot can be found here.

Reviewer can indicate their review by writing /lgtm in a comment.
Reviewer can cancel approval by writing /lgtm cancel in a comment.

@ti-chi-bot ti-chi-bot added status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels Mar 9, 2021
@wshwsh12
Copy link
Contributor

wshwsh12 commented Mar 9, 2021

/merge

@ti-chi-bot
Copy link
Member

This pull request has been accepted and is ready to merge.

Commit hash: 7a06aa6

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label Mar 9, 2021
@Rustin170506
Copy link
Member

/run-check_dev_2

@Rustin170506
Copy link
Member

/run-check_dev_2

1 similar comment
@Rustin170506
Copy link
Member

/run-check_dev_2

@Rustin170506
Copy link
Member

/run-unit-test

1 similar comment
@Rustin170506
Copy link
Member

/run-unit-test

@ti-chi-bot ti-chi-bot merged commit 284da11 into pingcap:master Mar 9, 2021
ti-srebot pushed a commit to ti-srebot/tidb that referenced this pull request Mar 9, 2021
Signed-off-by: ti-srebot <ti-srebot@pingcap.com>
@ti-srebot
Copy link
Contributor

cherry pick to release-4.0 in PR #23211

qw4990 pushed a commit that referenced this pull request Mar 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sig/execution SIG execution sig/planner SIG: Planner size/S Denotes a PR that changes 10-29 lines, ignoring generated files. 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.

wrong result in statement "bit(1) in (0x30)"
7 participants