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

*: add_date can return mysql.Time #9830

Merged
merged 13 commits into from
May 14, 2019
Merged

Conversation

winoros
Copy link
Member

@winoros winoros commented Mar 20, 2019

What problem does this PR solve?

to #9813

What is changed and how it works?

Implement things according to MySQL source code.

Check List

Tests

  • Unit test (still adding more)
  • Integration test(will add, if unit test is hard to cover some cases)

Side effects

  • Increased code complexity

Related changes

  • Need to be included in the release note

@winoros
Copy link
Member Author

winoros commented Mar 20, 2019

The overflow checking is not finished. And i think the previous add_date will cause overflow too...
I'm not sure whether to fix them together in next pr or fix this one first and leave the original add_date part to next pr...

@@ -30,11 +29,6 @@ import (
"github.com/pingcap/tidb/util/testleak"
)

func TestT(t *testing.T) {
Copy link
Member Author

Choose a reason for hiding this comment

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

It's a redundant one.

@codecov
Copy link

codecov bot commented Mar 21, 2019

Codecov Report

Merging #9830 into master will decrease coverage by 0.0596%.
The diff coverage is 56.0975%.

@@               Coverage Diff                @@
##             master      #9830        +/-   ##
================================================
- Coverage   77.1152%   77.0556%   -0.0597%     
================================================
  Files           412        412                
  Lines         86337      86457       +120     
================================================
+ Hits          66579      66620        +41     
- Misses        14672      14730        +58     
- Partials       5086       5107        +21

types/time.go Outdated Show resolved Hide resolved
return ZeroDuration, err
}
// MONTH must exceed the limit of mysql's duration. So just return overflow error.
return ZeroDuration, ErrDatetimeFunctionOverflow.GenWithStackByArgs("time")
Copy link
Contributor

Choose a reason for hiding this comment

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

So why not ignore line 1902~1905 ?

Copy link
Member Author

Choose a reason for hiding this comment

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

Oh, my concern is that though it must exceed the limit, should we raise the overflow error when the content cannot be formatted in fact?

Copy link
Member

Choose a reason for hiding this comment

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

is it controlled by a certain sql mode?

types/time.go Outdated Show resolved Hide resolved
types/time.go Outdated Show resolved Hide resolved
@zz-jason
Copy link
Member

zz-jason commented May 5, 2019

@winoros Please update this pr branch with the latest master

@qw4990 qw4990 self-requested a review May 6, 2019 09:00
expression/builtin_time.go Outdated Show resolved Hide resolved
types/time.go Outdated Show resolved Hide resolved
types/time.go Outdated Show resolved Hide resolved
@winoros
Copy link
Member Author

winoros commented May 7, 2019

Wait for #10329 merged first.

@winoros winoros requested a review from qw4990 May 13, 2019 08:02
@winoros
Copy link
Member Author

winoros commented May 13, 2019

/run-all-tests

@tiancaiamao
Copy link
Contributor

LGTM

@tiancaiamao tiancaiamao added status/all tests passed status/LGT1 Indicates that a PR has LGTM 1. labels May 13, 2019
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

@qw4990 qw4990 added status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels May 13, 2019
@zz-jason zz-jason marked this pull request as ready for review May 13, 2019 11:36
@tiancaiamao tiancaiamao merged commit 6a3a73a into pingcap:master May 14, 2019
winoros added a commit to winoros/tidb that referenced this pull request Jun 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants