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

expression, types: fix Mod(%), Multiple(*), Minus(-) operators meets inconsistent 0 results. #11251

Merged
merged 6 commits into from
Jul 19, 2019

Conversation

wjhuang2016
Copy link
Member

@wjhuang2016 wjhuang2016 commented Jul 15, 2019

What problem does this PR solve?

Fix #11211

What is changed and how it works?

Add a method zeroMyDecimalWithFrac() to get the zero of MyDecimal with the specified result fraction digits

Check List

Tests

  • Integration test
  • Unit test

Code changes

Side effects

Related changes

@codecov
Copy link

codecov bot commented Jul 15, 2019

Codecov Report

Merging #11251 into master will not change coverage.
The diff coverage is n/a.

@@             Coverage Diff             @@
##             master     #11251   +/-   ##
===========================================
  Coverage   81.4578%   81.4578%           
===========================================
  Files           423        423           
  Lines         90885      90885           
===========================================
  Hits          74033      74033           
  Misses        11544      11544           
  Partials       5308       5308

@SunRunAway
Copy link
Contributor

Hi, after seeing your pull request, it may have other problems with zeroMyDecimal like SELECT 1.111-1.111;

Could you take a review and fix them too?

*to = zeroMyDecimal
to.resultFrac = resultFrac
Copy link
Contributor

Choose a reason for hiding this comment

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

Please add a comment here to explain these three lines.
And it's better to add a unit test in mydecimal_test.go

This comment was marked as resolved.

@SunRunAway SunRunAway added component/expression contribution This PR is from a community contributor. type/compatibility labels Jul 16, 2019
@wjhuang2016
Copy link
Member Author

Hi, after seeing your pull request, it may have other problems with zeroMyDecimal like SELECT 1.111-1.111;

Could you take a review and fix them too?

OK

@wjhuang2016 wjhuang2016 changed the title expression: fix Mod(%) operator meets inconsistent 0 results. expression: fix Mod(%), Multiple(*), Minus(-) operators meets inconsistent 0 results. Jul 16, 2019
@wjhuang2016 wjhuang2016 changed the title expression: fix Mod(%), Multiple(*), Minus(-) operators meets inconsistent 0 results. expression, types: fix Mod(%), Multiple(*), Minus(-) operators meets inconsistent 0 results. Jul 16, 2019
@SunRunAway
Copy link
Contributor

Hi, @wjhuang2016
Is it ok to review?

@wjhuang2016
Copy link
Member Author

Hi, @wjhuang2016
Is it ok to review?

yeah

Copy link
Contributor

@SunRunAway SunRunAway left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@SunRunAway SunRunAway added the status/LGT1 Indicates that a PR has LGTM 1. label Jul 17, 2019
@SunRunAway
Copy link
Contributor

Hi, @wjhuang2016
Although it works as expected, could you add some tests covering cases like(-1.11)+ (1.11)?

@SunRunAway SunRunAway removed the status/LGT1 Indicates that a PR has LGTM 1. label Jul 17, 2019
@SunRunAway
Copy link
Contributor

/run-all-tests tidb-test=pr/862

@wjhuang2016
Copy link
Member Author

Hi, @wjhuang2016
Although it works as expected, could you add some tests covering cases like(-1.11)+ (1.11)?

It covers -1234.1234 + 1234.1234 and 0.000 / 0.1 now.

Copy link
Contributor

@SunRunAway SunRunAway left a comment

Choose a reason for hiding this comment

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

LGTM

@SunRunAway SunRunAway added the status/LGT1 Indicates that a PR has LGTM 1. label Jul 17, 2019
@qw4990 qw4990 self-requested a review July 18, 2019 05:45
Copy link
Contributor

@qw4990 qw4990 left a comment

Choose a reason for hiding this comment

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

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/expression contribution This PR is from a community contributor. status/LGT1 Indicates that a PR has LGTM 1. type/compatibility
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Mod(%) operator meets inconsistent 0 results.
3 participants