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

types, expression: handle uint64 correctly in JSON #21621

Merged
merged 5 commits into from
Dec 12, 2020

Conversation

morgo
Copy link
Contributor

@morgo morgo commented Dec 10, 2020

What problem does this PR solve?

Issue Number: fixes #21619

Problem Summary:

MySQL extends the JSON standard to support unsigned 64-bit integers. TiDB previously interpreted these as double values, leading to incorrect results.

What is changed and how it works?

Values which exceed the range of int64 are now attempted to be handled as uint64. If that fails, then they are handled as double. This matches the observed behavior in MySQL.

Related changes

  • Need to cherry-pick to the release branch

(JSON is considered experimental. I think it is still worth backporting, assuming low merge conflicts.)

Check List

Tests

  • Integration test

Side effects

  • None

Release note

  • The JSON type now correctly handles bigint unsigned values.

@morgo morgo requested a review from a team as a code owner December 10, 2020 00:34
@morgo morgo requested review from SunRunAway and removed request for a team December 10, 2020 00:34
@XuHuaiyu XuHuaiyu added the type/bugfix This PR fixes a bug. label Dec 10, 2020
Copy link
Contributor

@XuHuaiyu XuHuaiyu 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 Dec 10, 2020
@ichn-hu ichn-hu mentioned this pull request Dec 11, 2020
@XuHuaiyu XuHuaiyu requested a review from lzmhhh123 December 11, 2020 09:40
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 Dec 11, 2020
@ti-srebot ti-srebot added the status/LGT2 Indicates that a PR has LGTM 2. label Dec 11, 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 Dec 11, 2020
@ti-srebot
Copy link
Contributor

Your auto merge job has been accepted, waiting for:

  • 21672
  • 21286

@ti-srebot
Copy link
Contributor

/run-all-tests

@ti-srebot
Copy link
Contributor

@morgo merge failed.

@ngaut ngaut merged commit 06cd92e into pingcap:master Dec 12, 2020
XuHuaiyu added a commit that referenced this pull request Dec 14, 2020
@morgo morgo deleted the fix-json-unsigned branch January 29, 2021 17:36
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.

Cast int string to JSON results in wrong type
5 participants