Skip to content

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

Merged
qw4990 merged 6 commits into
pingcap:masterfrom
wjhuang2016:fix_11211
Jul 19, 2019
Merged

expression, types: fix Mod(%), Multiple(*), Minus(-) operators meets inconsistent 0 results.#11251
qw4990 merged 6 commits into
pingcap:masterfrom
wjhuang2016:fix_11211

Conversation

@wjhuang2016
Copy link
Copy Markdown
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
Copy Markdown

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
Copy Markdown
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?

Comment thread types/mydecimal.go Outdated
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Contributor

Hi, @wjhuang2016
Is it ok to review?

@wjhuang2016
Copy link
Copy Markdown
Member Author

Hi, @wjhuang2016
Is it ok to review?

yeah

Copy link
Copy Markdown
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 requested review from coocood, lysu and winkyao July 17, 2019 01:53
@SunRunAway SunRunAway added the status/LGT1 Indicates that a PR has LGTM 1. label Jul 17, 2019
@SunRunAway
Copy link
Copy Markdown
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
Copy Markdown
Contributor

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

@wjhuang2016
Copy link
Copy Markdown
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
Copy Markdown
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
Comment thread types/mydecimal.go
Copy link
Copy Markdown
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