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

Conversation

@winkyao
Copy link
Member

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

This comment has been minimized.

Copy link
Member Author

commented Jul 31, 2018

@coocood

This comment has been minimized.

Copy link
Member

commented Jul 31, 2018

@winkyao
Can we replace all the add with add2?

@lysu

This comment has been minimized.

Copy link
Member

commented Jul 31, 2018

/run-all-tests

@winkyao

This comment has been minimized.

Copy link
Member Author

commented Jul 31, 2018

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

@lysu
lysu approved these changes Jul 31, 2018
Copy link
Member

left a comment

LGTM

@lysu lysu added the status/LGT1 label Jul 31, 2018
Copy link
Member

left a comment

LGTM

@coocood coocood added status/LGT2 and removed status/LGT1 labels Jul 31, 2018
@winkyao winkyao merged commit e5f26cd into pingcap:master Jul 31, 2018
4 checks passed
4 checks passed
ci/circleci Your tests passed on CircleCI!
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
jenkins-ci-tidb/build Jenkins job succeeded.
Details
license/cla Contributor License Agreement is signed.
Details
@winkyao winkyao deleted the winkyao:fix_decimal_mul branch Jul 31, 2018
winkyao added a commit to winkyao/tidb that referenced this pull request Jul 31, 2018
winkyao added a commit that referenced this pull request Jul 31, 2018
@lysu

This comment has been minimized.

Copy link
Member

commented Aug 1, 2018

@AndreMouche maybe coprocess need fix this question too?

@AndreMouche

This comment has been minimized.

Copy link
Member

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
Projects
None yet
4 participants
You can’t perform that action at this time.