-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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
expression: fix cast json to decimal bug. #8030
Conversation
Please add some integration test cases |
return res, errors.Trace(err) | ||
} | ||
err = res.FromFloat64(f64) | ||
return res, errors.Trace(err) |
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.
What about create two new function NewDecFromFloat
and NewDecFromString
and call it here?
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.
MyDecimal
already have FromFloat64
and FromString
methods. What is the difference between NewDecFromFloat
and FromFloat64
?
@XuHuaiyu done. PTAL |
LGTM |
@crazycs520 Should we cherrypick this commit to release-2.1 and release-2.0? |
@zz-jason OK, I will do cherrypick after this merge. |
/run-all-tests |
@winoros @lamxTyler PTAL |
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.
LGTM
What problem does this PR solve?
sql
Original TiDB return
Now:
As you can see, original TiDB will lose precision and can‘t resolving big decimal number.
What is changed and how it works?
Add
ConvertJSONToDecimal
function, UseMyDecimal.FromStrin
to parse json when json type is string.Check List
Tests
Code changes