When executing the DATE_FORMAT function, TiDB returns unexpected results
- Dominant language
- Go
- Stars
- 40.5k
- Forks
- 6.2k
- PR merge metrics
- PR metrics pending
Description
## Bug Report
Please answer these questions before submitting your issue. Thanks!
### 1. Minimal reproduce step (Required)
```SQL
CREATE TABLE t0 (
c0 double NOT NULL,
UNIQUE (c0)
);
INSERT INTO t0 VALUES (0), (0.06771666817351274), (748334112), (1747356538);
SELECT t0.c0 FROM t0 GROUP BY t0.c0 HAVING DATE_FORMAT(t0.c0, t0.c0) IS NULL;
```
### 2. What did you expect to see? (Required)
```SQL
+------------+
| c0 |
+------------+
| 748334112 |
| 1747356538 |
+------------+
```
### 3. What did you see instead (Required)
```SQL
MySQL> SELECT t0.c0 FROM t0 GROUP BY t0.c0 HAVING DATE_FORMAT(t0.c0, t0.c0) IS NULL;
+---------------------+
| c0 |
+---------------------+
| 0.06771666817351274 |
| 748334112 |
| 1747356538 |
| 0 |
+---------------------+
4 rows in set, 7 warnings (0.003 sec)
```
### 4. What is your TiDB version? (Required)
```SQL
MySQL> select tidb_version();
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| tidb_version() |
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Release Version: v8.0.0
Edition: Community
Git Commit Hash: 8ba1fa452b1ccdbfb85879ea94b9254aabba2916
Git Branch: HEAD
UTC Build Time: 2024-03-28 14:22:04
GoVersion: go1.21.6
Race Enabled: false
Check Table Before Drop: false
Store: tikv |
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.002 sec)
```
Contributor guide
Assessment
This issue has not been assessed yet.