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

Window function panicked when range bound is time type #9777

Closed
winoros opened this issue Mar 18, 2019 · 3 comments
Closed

Window function panicked when range bound is time type #9777

winoros opened this issue Mar 18, 2019 · 3 comments
Assignees
Labels
sig/execution SIG execution type/bug The issue is confirmed as a bug. type/compatibility

Comments

@winoros
Copy link
Member

winoros commented Mar 18, 2019

Bug Report

Please answer these questions before submitting your issue. Thanks!

  1. What did you do?
    If possible, provide a recipe for reproducing the error.
CREATE TABLE `t_time` (
  `t` time DEFAULT NULL,
  `ts` timestamp NULL DEFAULT NULL
)
INSERT INTO t_time VALUES ('12:30', '2016-07-05 08:30:42');
SELECT t, FIRST_VALUE(t) OVER (ORDER BY t RANGE BETWEEN INTERVAL 2 HOUR PRECEDING AND INTERVAL 2 HOUR_MINUTE PRECEDING) FROM t_time;
  1. What did you expect to see?

Execute successfully.

  1. What did you see instead?

Panicked.

  1. What version of TiDB are you using (tidb-server -V or run select tidb_version(); on TiDB)?
@winoros winoros added type/bug The issue is confirmed as a bug. sig/execution SIG execution labels Mar 18, 2019
@winoros winoros self-assigned this Mar 18, 2019
@alivxxx
Copy link
Contributor

alivxxx commented Mar 18, 2019

It seems that there is something wrong with date_add.
In mysql:

MySQL [test]> select date_add(t, INTERVAL 2 HOUR) from t_time;
+------------------------------+
| date_add(t, INTERVAL 2 HOUR) |
+------------------------------+
| 14:30:00                     |
+------------------------------+
1 row in set (0.001 sec)

While in TiDB:

MySQL [test]> select date_add(t, INTERVAL 2 HOUR) from t_time;
+------------------------------+
| date_add(t, INTERVAL 2 HOUR) |
+------------------------------+
| 2019-03-18 14:30:00          |
+------------------------------+
1 row in set (0.002 sec)

@winoros
Copy link
Member Author

winoros commented Mar 19, 2019

wait #9813

@winoros
Copy link
Member Author

winoros commented Jun 20, 2019

#9813 and #9874 fixed this issue.

@winoros winoros closed this as completed Jun 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sig/execution SIG execution type/bug The issue is confirmed as a bug. type/compatibility
Projects
None yet
Development

No branches or pull requests

2 participants