-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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
codec: Don't convert set or enum datum to float64 when encoding them #32308
Conversation
Signed-off-by: ekexium <ekexium@gmail.com>
[REVIEW NOTIFICATION] This pull request has been approved by:
To complete the pull request process, please ask the reviewers in the list to review by filling The full list of commands accepted by this bot can be found here. Reviewer can indicate their review by submitting an approval review. |
Code Coverage Details: https://codecov.io/github/pingcap/tidb/commit/4d9cc43d071f05a495d71a4818bf771ffe53f278 |
/run-all-tests |
func (s *testSerialSuite) TestEncodingSet(c *C) { | ||
tk := testkit.NewTestKit(c, s.store) | ||
tk.MustExec("use test") | ||
tk.MustExec("CREATE TABLE `enum-set` (`set` SET(" + |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could cover KindMysqlEnum
in the same case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's hard to cover enum in the test. I don't even know whether the bug exist for enum, because MySQL limits the maximum number of elements of a enum at 65535. I guess it's not large enough to produce a precision loss.
/merge |
This pull request has been accepted and is ready to merge. Commit hash: 06e1154
|
Signed-off-by: ti-srebot <ti-srebot@pingcap.com>
cherry pick to release-4.0 in PR #32350 |
Signed-off-by: ti-srebot <ti-srebot@pingcap.com>
cherry pick to release-5.0 in PR #32351 |
Signed-off-by: ti-srebot <ti-srebot@pingcap.com>
cherry pick to release-5.1 in PR #32352 |
Signed-off-by: ti-srebot <ti-srebot@pingcap.com>
cherry pick to release-5.2 in PR #32353 |
Signed-off-by: ti-srebot <ti-srebot@pingcap.com>
cherry pick to release-5.3 in PR #32354 |
Signed-off-by: ti-srebot <ti-srebot@pingcap.com>
cherry pick to release-5.4 in PR #32355 |
Signed-off-by: ekexium ekexium@gmail.com
What problem does this PR solve?
Issue Number: close #32302
Problem Summary:
When a enum or a set datum is encoded, it's uint64 value is converted to float64 and then converted back to uint64, resulting in the loss of lower bits.
What is changed and how it works?
Use the original
Value
, don't convert.Check List
Tests
Side effects
Documentation
Release note