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

dayofyear/dayofweek return different value for zerodate between TiFlash and TiDB #4313

Closed
windtalker opened this issue Mar 16, 2022 · 0 comments · Fixed by #4314
Closed

dayofyear/dayofweek return different value for zerodate between TiFlash and TiDB #4313

windtalker opened this issue Mar 16, 2022 · 0 comments · Fixed by #4314
Assignees
Labels
severity/major type/bug The issue is confirmed as a bug.

Comments

@windtalker
Copy link
Contributor

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

mysql> create table datetime_test(id int, val datetime);
Query OK, 0 rows affected (0.13 sec)
mysql> alter table datetime_test set tiflash replica 1;
Query OK, 0 rows affected (0.09 sec)
mysql> set sql_mode='ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION';
Query OK, 0 rows affected (0.00 sec)
mysql> insert into datetime_test values(1,'0000-00-00 00:00:00');                                 
Query OK, 1 row affected (0.01 sec)
mysql> select dayofyear(val),dayofweek(val) from datetime_test;
+----------------+----------------+
| dayofyear(val) | dayofweek(val) |
+----------------+----------------+
|           NULL |           NULL |
+----------------+----------------+
1 row in set, 2 warnings (0.14 sec)
mysql> set tidb_enforce_mpp=1;
Query OK, 0 rows affected (0.00 sec)
mysql>  select dayofyear(val),dayofweek(val) from datetime_test;
+----------------+----------------+
| dayofyear(val) | dayofweek(val) |
+----------------+----------------+
|              0 |              7 |
+----------------+----------------+
1 row in set (0.11 sec)

2. What did you expect to see? (Required)

mysql> select dayofyear(val),dayofweek(val) from datetime_test;
+----------------+----------------+
| dayofyear(val) | dayofweek(val) |
+----------------+----------------+
|           NULL |           NULL |
+----------------+----------------+

3. What did you see instead (Required)

mysql>  select dayofyear(val),dayofweek(val) from datetime_test;
+----------------+----------------+
| dayofyear(val) | dayofweek(val) |
+----------------+----------------+
|              0 |              7 |
+----------------+----------------+

4. What is your TiFlash version? (Required)

master @ 921dd4d

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
severity/major type/bug The issue is confirmed as a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants