JOKERWING commented on issue #29826:
URL: https://github.com/apache/doris/issues/29826#issuecomment-1899740841

   > 我在2.0.1上测试的结果
   > 
   > ```sql
   > mysql> select * from test_date;
   > +------+------------+
   > | id   | date       |
   > +------+------------+
   > | 01   | 2023-02-01 |
   > | 03   | 2023-01-01 |
   > | 03   | 2023-03-01 |
   > | 03   | 2023-04-01 |
   > | 03   | 2023-05-01 |
   > | 03   | 2023-06-01 |
   > | 01   | 2023-11-01 |
   > | 03   | 2023-07-01 |
   > | 03   | 2023-08-01 |
   > | 03   | 2023-09-01 |
   > | 03   | 2023-10-01 |
   > | 03   | 2023-11-01 |
   > | 03   | 2023-12-01 |
   > | 0A   | 2023-12-01 |
   > | 04   | 2023-07-01 |
   > | 04   | 2023-08-01 |
   > | 04   | 2023-09-01 |
   > | 04   | 2023-10-01 |
   > | 04   | 2023-12-01 |
   > | 06   | 2024-01-01 |
   > | 07   | 2024-01-01 |
   > | 04   | 2023-06-01 |
   > | 02   | 2022-10-01 |
   > | 02   | 2022-11-01 |
   > | 02   | 2022-12-01 |
   > | 02   | 2023-11-01 |
   > | 01   | 2022-10-01 |
   > | 01   | 2022-11-01 |
   > | 01   | 2022-12-01 |
   > +------+------------+
   > 29 rows in set (0.03 sec)
   > 
   > mysql> SELECT distinct date FROM test_date  WHERE date = '2024-00-01';
   > Empty set (0.04 sec)
   > ```
   > 
   > 在最新版上会报错。所以错误的日期格式对于Doris来讲是未定义行为,尽量避免一下。
   > 
   > ```sql
   > mysql> SELECT distinct date FROM test_date  WHERE date = '2024-00-01';
   > ERROR 1105 (HY000): errCode = 2, detailMessage = Incorrect datetime value: 
CAST('2024-00-01' AS DATETIMEV2(0)) in expression: (CAST(`date` AS 
DATETIMEV2(0)) = CAST('2024-00-01' AS DATETIMEV2(0)))
   > ```
   
   好的,你没复现出来我的问题。但没事,我之后会使用正确的日期格式去执行sql的、
   谢谢您的回答~
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to