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: fix a bug in decimal multiplication #7208

Merged
merged 3 commits into from
Jul 31, 2018
Merged

types: fix a bug in decimal multiplication #7208

merged 3 commits into from
Jul 31, 2018

Conversation

winkyao
Copy link
Contributor

@winkyao winkyao commented Jul 31, 2018

What have you changed? (mandatory)

Before this PR, we got the result from select 0.5999991229316*0.918755041726043 is not correct:

mysql> select 0.5999991229316*0.918755041726043;
+-----------------------------------+
| 0.5999991229316*0.918755041726043 |
+-----------------------------------+
|    0.551252217)0-++'-+4062276588 |
+-----------------------------------+
1 row in set (0.00 sec)

This is because we don't handle the overflow in DecimalMul, after this PR, we got:

mysql> select 0.5999991229316*0.918755041726043;
+-----------------------------------+
| 0.5999991229316*0.918755041726043 |
+-----------------------------------+
|    0.5512522192246113614062276588 |
+-----------------------------------+
1 row in set (0.08 sec)

What is the type of the changes? (mandatory)

  • Bug fix (non-breaking change which fixes an issue)

How has this PR been tested? (mandatory)

UT

Does this PR affect documentation (docs/docs-cn) update? (mandatory)

NO

Does this PR affect tidb-ansible update? (mandatory)

NO

Does this PR need to be added to the release notes? (mandatory)

yes

fix a bug in decimal multiplication.

Refer to a related PR or issue link (optional)

Benchmark result if necessary (optional)

Add a few positive/negative examples (optional)

@winkyao winkyao added type/bugfix This PR fixes a bug. priority/release-blocker This issue blocks a release. Please solve it ASAP. labels Jul 31, 2018
@winkyao
Copy link
Contributor Author

winkyao commented Jul 31, 2018

@coocood @lysu PTAL

@coocood
Copy link
Member

coocood commented Jul 31, 2018

@winkyao
Can we replace all the add with add2?

@lysu
Copy link
Contributor

lysu commented Jul 31, 2018

/run-all-tests

@winkyao
Copy link
Contributor Author

winkyao commented Jul 31, 2018

@coocood In MySQL, the ADD2 is only used in decimal_mul, I think we should keep the logic.

Copy link
Contributor

@lysu lysu left a comment

Choose a reason for hiding this comment

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

LGTM

@lysu lysu added the status/LGT1 Indicates that a PR has LGTM 1. label Jul 31, 2018
Copy link
Member

@coocood coocood left a comment

Choose a reason for hiding this comment

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

LGTM

@coocood coocood added status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels Jul 31, 2018
@winkyao winkyao merged commit e5f26cd into pingcap:master Jul 31, 2018
@winkyao winkyao deleted the fix_decimal_mul branch July 31, 2018 14:15
@winkyao winkyao added the release-note Denotes a PR that will be considered when it comes time to generate release notes. label Jul 31, 2018
@lysu
Copy link
Contributor

lysu commented Aug 1, 2018

@AndreMouche maybe coprocess need fix this question too?

@AndreMouche
Copy link
Contributor

AndreMouche commented Aug 6, 2018

no,we needn't @lysu

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. release-note Denotes a PR that will be considered when it comes time to generate release notes. 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.

4 participants