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 STR_TO_DATE handling for %h, %r (#18171) (#18428) #18727

Merged
merged 3 commits into from
Jul 28, 2020

Conversation

ti-srebot
Copy link
Contributor

cherry-pick #18428 to release-4.0


What problem does this PR solve?

Issue Number: close #18171

Problem Summary: Behavior of function STR_TO_DATE is not compatible with MySQL.

  • '%h:%i:%s' parses '12:mm:ss' into '12:mm:ss', which should be '00:mm:ss'.
  • '%r' parses '12:mm:ss AM' into '12:mm:ss' and parses '12:hh:ss PM' into 'NULL'.

What is changed and how it works?

What's Changed:

  • The hour part will change to 0 if '%h' matches 12 and no AM or PM occurs.
  • The hour part will subtract 12 if '%r' matches pattern '12:mm:ss AM' or '12:mm:ss PM'.

How it Works:

  • Function mysqlTimeFix inspects the occurrence of '%h', '%p' and whether the hour part is 12.
  • Function time12Hour now fixes the time when the hour part is 12.

Tests

  • Unit test
  • Manual test

Side effects

No.

Release note

  • types: fix STR_TO_DATE's handling for format token '%r', '%h'

@ti-srebot
Copy link
Contributor Author

/run-all-tests

@ti-srebot
Copy link
Contributor Author

@dyzsr please accept the invitation then you can push to the cherry-pick pull requests.

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

@ti-srebot ti-srebot added the status/LGT1 Indicates that a PR has LGTM 1. label Jul 22, 2020
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

@ti-srebot ti-srebot added status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels Jul 22, 2020
@zz-jason
Copy link
Member

/merge

@ti-srebot
Copy link
Contributor Author

Sorry @zz-jason, you don't have permission to trigger auto merge event on this branch.
The version releasement is in progress.

@imtbkcat imtbkcat modified the milestones: v4.0.4, v4.0.5 Jul 28, 2020
@zz-jason
Copy link
Member

/merge

@ti-srebot ti-srebot added the status/can-merge Indicates a PR has been approved by a committer. label Jul 28, 2020
@ti-srebot
Copy link
Contributor Author

Your auto merge job has been accepted, waiting for:

  • 18368
  • 17926
  • 17823
  • 18531
  • 18667
  • 18806
  • 18413
  • 18434
  • 18280
  • 18121
  • 18122
  • 18027
  • 18234
  • 18529

@zz-jason
Copy link
Member

/merge

@ti-srebot
Copy link
Contributor Author

Your auto merge job has been accepted, waiting for:

  • 18280
  • 18121
  • 18122
  • 18027
  • 18234
  • 18529
  • 18583
  • 18513
  • 17972
  • 17231
  • 18692
  • 17988
  • 18683
  • 18159
  • 17863
  • 17823
  • 18531
  • 18413
  • 18434
  • 18280
  • 18121
  • 18122
  • 18027
  • 18234
  • 18529

@ti-srebot
Copy link
Contributor Author

/run-all-tests

@ti-srebot
Copy link
Contributor Author

@ti-srebot merge failed.

@zz-jason
Copy link
Member

/merge

@ti-srebot
Copy link
Contributor Author

Your auto merge job has been accepted, waiting for:

  • 18683
  • 18159
  • 17863
  • 17823
  • 18531
  • 18413
  • 18434
  • 18280
  • 18121
  • 18122
  • 18027
  • 18234
  • 18529
  • 18583
  • 18513
  • 17972
  • 17231
  • 18692
  • 17988
  • 18234
  • 18529

@ti-srebot
Copy link
Contributor Author

/run-all-tests

@ti-srebot
Copy link
Contributor Author

@ti-srebot merge failed.

@zz-jason zz-jason merged commit 54c30d1 into pingcap:release-4.0 Jul 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/expression status/can-merge Indicates a PR has been approved by a committer. status/LGT2 Indicates that a PR has LGTM 2. type/compatibility type/4.0-cherry-pick
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants