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

the function of timediff has errors in boundary and type #1570

Closed
manannan2017 opened this issue Aug 1, 2019 · 2 comments
Closed

the function of timediff has errors in boundary and type #1570

manannan2017 opened this issue Aug 1, 2019 · 2 comments

Comments

@manannan2017
Copy link
Contributor

the function of timediff has errors,such as boundary and type

the list of errors is:
1、select timediff(CAST('1944-02-25 00:00:00' as datetime), CAST('1944-2-26' as datetime));
+----------------------------------------------------------------------------------+
| timediff(CAST('1944-02-25 00:00:00' AS DATETIME), CAST('1944-2-26' AS DATETIME)) |
+----------------------------------------------------------------------------------+
| 00:00:00 |
+----------------------------------------------------------------------------------+
except:
+----------------------------------------------------------------------------------+
| timediff(CAST('1944-02-25 00:00:00' as datetime), CAST('1944-2-26' as datetime)) |
+----------------------------------------------------------------------------------+
| -24:00:00 |
+----------------------------------------------------------------------------------+
1 row in set (0.47 sec)

2、boundary
SELECT TIMEDIFF('2019-01-01 00:00:00', '2009-01-01 00:00:00');
+--------------------------------------------------------+
| timediff('2019-01-01 00:00:00', '2009-01-01 00:00:00') |
+--------------------------------------------------------+
| 87648:00:00 |
+---------------------------
except:
SELECT TIMEDIFF('2019-01-01 00:00:00', '2009-01-01 00:00:00');
+--------------------------------------------------------+
| TIMEDIFF('2019-01-01 00:00:00', '2009-01-01 00:00:00') |
+--------------------------------------------------------+
| 838:59:59 |
+--------------------------------------------------------+

@HangyuanLiu
Copy link
Contributor

The first case:
because timediff internally use timestamps to indicate that date
date earlier than 1970 cannot be supported, I will modify it in next PR.
The second case is not a problem. Timediff results are not have boundary

@manannan2017
Copy link
Contributor Author

Verification passed。thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants