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 batch point get return wrong result for in(null) #18851

Merged
merged 8 commits into from
Jul 30, 2020

Conversation

tiancaiamao
Copy link
Contributor

What problem does this PR solve?

Issue Number: close #18843

Problem Summary:

What is changed and how it works?

What's Changed:

When constucting point get index key, the datum is convert to the column type.
If the datum is null, convert it to string would construct the wrong index key.

How it Works:

Do not convert the datum if it's null.

Related changes

  • Need to cherry-pick to the release branch

Check List

Tests

  • Unit test

Release note

  • Fix bug batchPointGet returns wrong result with condition `in (null)` in some cases

@tiancaiamao tiancaiamao requested a review from a team as a code owner July 29, 2020 04:42
@tiancaiamao tiancaiamao requested review from SunRunAway and removed request for a team July 29, 2020 04:42
@tiancaiamao tiancaiamao requested a review from qw4990 July 29, 2020 04:42
Copy link
Contributor

@qw4990 qw4990 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 Jul 29, 2020
@qw4990
Copy link
Contributor

qw4990 commented Jul 29, 2020

PTAL @zz-jason

@tiancaiamao
Copy link
Contributor Author

4.0 PR #18848

@@ -339,6 +339,10 @@ func (e *PointGetExecutor) get(ctx context.Context, key kv.Key) ([]byte, error)
func EncodeUniqueIndexKey(ctx sessionctx.Context, tblInfo *model.TableInfo, idxInfo *model.IndexInfo, idxVals []types.Datum, tID int64) (_ []byte, err error) {
sc := ctx.GetSessionVars().StmtCtx
for i := range idxVals {
if idxVals[i].IsNull() {
Copy link
Member

Choose a reason for hiding this comment

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

I think is no the right place to fix the bug.
The idxVals should be skipped in higher level.

Copy link
Member

Choose a reason for hiding this comment

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

We should let the caller know the built key is not valid.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@codecov
Copy link

codecov bot commented Jul 29, 2020

Codecov Report

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

@@             Coverage Diff             @@
##             master     #18851   +/-   ##
===========================================
  Coverage   79.1582%   79.1582%           
===========================================
  Files           546        546           
  Lines        147718     147718           
===========================================
  Hits         116931     116931           
  Misses        21342      21342           
  Partials       9445       9445           

@imtbkcat imtbkcat added the priority/release-blocker This issue blocks a release. Please solve it ASAP. label Jul 29, 2020
@imtbkcat imtbkcat added this to the v4.0.4 milestone Jul 29, 2020
@coocood
Copy link
Member

coocood commented Jul 29, 2020

LGTM

@ti-srebot ti-srebot removed the status/LGT1 Indicates that a PR has LGTM 1. label Jul 29, 2020
@ti-srebot ti-srebot added the status/LGT2 Indicates that a PR has LGTM 2. label Jul 29, 2020
@coocood
Copy link
Member

coocood commented Jul 29, 2020

/merge

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

/run-all-tests

@ti-srebot
Copy link
Contributor

@tiancaiamao merge failed.

@coocood
Copy link
Member

coocood commented Jul 29, 2020

/run-check_dev_2

@imtbkcat imtbkcat modified the milestones: v4.0.4, v4.0.5 Jul 30, 2020
@imtbkcat
Copy link

/merge

@ti-srebot
Copy link
Contributor

/run-all-tests

Copy link

@imtbkcat imtbkcat 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 status/LGT3 The PR has already had 3 LGTM. and removed status/LGT2 Indicates that a PR has LGTM 2. labels Jul 30, 2020
@ti-srebot
Copy link
Contributor

@tiancaiamao merge failed.

@AndreMouche
Copy link
Contributor

LGTM

@ti-srebot
Copy link
Contributor

@AndreMouche,Thanks for your review. However, LGTM is restricted to Reviewers or higher roles.See the corresponding SIG page for more information. Related SIGs: execution(slack).

@tiancaiamao
Copy link
Contributor Author

/merge

@ti-srebot
Copy link
Contributor

/run-all-tests

@ti-srebot ti-srebot merged commit 4000174 into pingcap:master Jul 30, 2020
@tiancaiamao tiancaiamao deleted the issue-18843 branch July 30, 2020 09:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority/release-blocker This issue blocks a release. Please solve it ASAP. sig/execution SIG execution status/can-merge Indicates a PR has been approved by a committer. status/LGT3 The PR has already had 3 LGTM.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BatchPointGet returns wrong results with condition in (null) in some cases
7 participants