-
Notifications
You must be signed in to change notification settings - Fork 5.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
expression: fix TIMESTAMP func get wrong result with decimal (#15185)
The TIMESTAMP function deal with argument of decimal/float will get wrong result. This commit fix that issue by redirect method call of parseDateTime() to ParseDatetimeFromNum() when the flag "isFloat" is true. The reason is that the parse logic of datetime is different when dealing with strings and numbers. In short, when dealing with numbers, if number length are not 6, 8, 12, 14, the parse logic should padded with leading zeros to the closest length. But when dealing with strings, the parse logic will interpreted from left to right to find year, month, day, hour... for as many parts as are present in the string. For more details, see https://dev.mysql.com/doc/refman/5.7/en/date-and-time-literals.html.
- Loading branch information
LENSHOOD
committed
Sep 21, 2020
1 parent
cc3d9db
commit d431b13
Showing
4 changed files
with
96 additions
and
8 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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