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 parse DATETIME/TIME from string incompatible with MySQL #14547

Merged
merged 7 commits into from
Jan 23, 2020
Merged

types: fix parse DATETIME/TIME from string incompatible with MySQL #14547

merged 7 commits into from
Jan 23, 2020

Conversation

lonng
Copy link
Contributor

@lonng lonng commented Jan 20, 2020

Signed-off-by: Lonng heng@lonng.org

What problem does this PR solve?

This PR fixes the issue that the result of parse string to DATETIME/TIME incompatible with MySQL.

MySQL result:

mysql> select convert('4710072', DATEtime);
+------------------------------+
| convert('4710072', DATEtime) |
+------------------------------+
| 2047-10-07 02:00:00          |
+------------------------------+
1 row in set (0.00 sec)

mysql> select convert('4294967295 0:59:59', time);
+-------------------------------------+
| convert('4294967295 0:59:59', time) |
+-------------------------------------+
| 838:59:59                           |
+-------------------------------------+
1 row in set, 1 warning (0.00 sec)

What is changed and how it works?

  1. Support parse YYMMDDH format string.
  2. Check the overflow of duration hours.

Check List

Tests

  • Unit test

Release note

  • Fixes the issue that the result of parse string to DATETIME/TIME incompatible with MySQL.

@lonng lonng added the type/bugfix This PR fixes a bug. label Jan 20, 2020
@lonng lonng requested a review from a team as a code owner January 20, 2020 05:12
@ghost ghost requested review from qw4990 and XuHuaiyu and removed request for a team January 20, 2020 05:12
@bb7133 bb7133 added this to the v4.0.0-beta.1 milestone Jan 20, 2020
@bb7133
Copy link
Member

bb7133 commented Jan 20, 2020

Do we need to cherry-pick this PR to 3.0/2.1?

Copy link
Member

@zz-jason zz-jason left a comment

Choose a reason for hiding this comment

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

LGTM

@zz-jason zz-jason added the status/LGT1 Indicates that a PR has LGTM 1. label Jan 20, 2020
@zz-jason zz-jason removed the request for review from qw4990 January 20, 2020 13:50
Copy link
Contributor

@AilinKid AilinKid left a comment

Choose a reason for hiding this comment

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

LGTM

@AilinKid AilinKid added status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels Jan 23, 2020
@AilinKid
Copy link
Contributor

/run-all-tests

@lonng
Copy link
Contributor Author

lonng commented Jan 23, 2020

/run-unit-test

1 similar comment
@lonng
Copy link
Contributor Author

lonng commented Jan 23, 2020

/run-unit-test

@lonng lonng merged commit c88ceca into pingcap:master Jan 23, 2020
@lonng lonng deleted the fix-parse-datetime branch January 23, 2020 08:53
@sre-bot
Copy link
Contributor

sre-bot commented Jan 23, 2020

cherry pick to release-2.1 failed

@sre-bot
Copy link
Contributor

sre-bot commented Jan 23, 2020

cherry pick to release-3.0 in PR #14570

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status/LGT2 Indicates that a PR has LGTM 2. type/bugfix This PR fixes a bug.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants