expression: fix getIntervalFromDecimal in DATE_ADD()#11297
Merged
Conversation
Contributor
Author
|
/run-all-tests |
zz-jason
reviewed
Jul 17, 2019
SunRunAway
previously requested changes
Jul 18, 2019
Contributor
There was a problem hiding this comment.
It will be an incorrect result in case "SECOND" and default parts in the switch statement above.
4919bda to
5cb495c
Compare
Contributor
Author
|
@SunRunAway PTAL |
Codecov Report
@@ Coverage Diff @@
## master #11297 +/- ##
===========================================
Coverage 81.6571% 81.6571%
===========================================
Files 423 423
Lines 91818 91818
===========================================
Hits 74976 74976
Misses 11531 11531
Partials 5311 5311 |
SunRunAway
reviewed
Jul 18, 2019
Contributor
There was a problem hiding this comment.
It would be better not to do the extra revise code in these paths.
Also, would you like to add a unit test to cover it?
Contributor
Author
|
/run-all-tests |
Contributor
Author
|
@SunRunAway PTAL |
cbf8901 to
ff0eb51
Compare
Member
|
/run-all-tests |
e5a3e2b to
34496d0
Compare
Contributor
Author
|
/run-all-tests |
zz-jason
approved these changes
Jul 18, 2019
SunRunAway
approved these changes
Jul 18, 2019
Contributor
|
cherry pick to release-2.1 failed |
Contributor
|
cherry pick to release-3.0 in PR #11325 |
wshwsh12
added a commit
to wshwsh12/tidb
that referenced
this pull request
Jul 18, 2019
zz-jason
pushed a commit
that referenced
this pull request
Jul 18, 2019
zz-jason
pushed a commit
that referenced
this pull request
Jul 18, 2019
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What problem does this PR solve?
#11286
Before this pr:
This pr:
What is changed and how it works?
When use
getIntervalFromDecimalto get interval, It will convert the Decimal to Interval(the type is string).Before the pr, the func don't consider that the decimal may be a negative number. It get a wrong result.
e.g.
1 DAY_MICROSECOND=>0 00:00:1-2.2 DAY_MICROSECOND=>0 00:00:-2.2(wrong)This pr, before the converting, I judge whether the decimal is negative first.
-2.2 DAY_MICROSECOND=>-0 00:00:2.2Check List
Tests
Code changes
Side effects
Related changes