-
Notifications
You must be signed in to change notification settings - Fork 6k
types: fix issue that we can insert negative value to unsinged float column sometimes #47946
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
Conversation
@@ -1012,9 +1012,6 @@ func ProduceFloatWithSpecifiedTp(f float64, target *FieldType, sc *stmtctx.State | |||
// If no D is set, we will handle it like origin float whether M is set or not. | |||
if target.GetFlen() != UnspecifiedLength && target.GetDecimal() != UnspecifiedLength { | |||
f, err = TruncateFloat(f, target.GetFlen(), target.GetDecimal()) | |||
if err = sc.HandleOverflow(err, err); err != nil { |
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.
HandleOverflow
seems useless now, because in cast expr like cast("1" as float(2, 1))
, target.GetDecimal()
always return UnspecifiedLength
...
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.
In mysql cast to float with decimal will fail:
mysql> select cast("1" as float(1, 0));
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ', 0))' at line 1
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## master #47946 +/- ##
================================================
+ Coverage 71.7764% 72.7981% +1.0217%
================================================
Files 1401 1424 +23
Lines 405664 412046 +6382
================================================
+ Hits 291171 299962 +8791
+ Misses 94750 93197 -1553
+ Partials 19743 18887 -856
Flags with carried forward coverage won't be shown. Click here to find out more.
|
/retest |
1 similar comment
/retest |
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
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
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: bb7133, XuHuaiyu, YangKeao The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
@lcwangchao: The following test failed, say
Full PR test history. Your PR dashboard. 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 kubernetes/test-infra repository. I understand the commands that are listed here. |
/retest |
In response to a cherrypick label: new pull request created to branch |
Signed-off-by: ti-chi-bot <[email protected]>
In response to a cherrypick label: new pull request created to branch |
Signed-off-by: ti-chi-bot <[email protected]>
In response to a cherrypick label: new pull request created to branch |
Signed-off-by: ti-chi-bot <[email protected]>
In response to a cherrypick label: new pull request created to branch |
Signed-off-by: ti-chi-bot <[email protected]>
In response to a cherrypick label: new pull request created to branch |
Signed-off-by: ti-chi-bot <[email protected]>
What problem does this PR solve?
Issue Number: close #47945
Problem Summary:
What is changed and how it works?
Check List
Tests
Side effects
Documentation
Release note
Please refer to Release Notes Language Style Guide to write a quality release note.