TiDB is an open-source, cloud-native, distributed, MySQL-Compatible database for elastic scale and real-time analytics. Try AI-powered Chat2Query free at : https://www.pingcap.com/tidb-serverless/
Please answer these questions before submitting your issue. Thanks!
1. Minimal reproduce step (Required)
create table t(d1 double, f float);
insert into t values(0, 0);
set session sql_mode = "NO_ZERO_IN_DATE,NO_ZERO_DATE";
select cast(d1 as datetime), cast(f as datetime) from t;
2. What did you expect to see? (Required)
+----------------------+---------------------+
| cast(d1 as datetime) | cast(f as datetime) |
+----------------------+---------------------+
| NULL | NULL |
+----------------------+---------------------+
3. What did you see instead (Required)
+----------------------+---------------------+
| cast(d1 as datetime) | cast(f as datetime) |
+----------------------+---------------------+
| 0000-00-00 00:00:00 | 0000-00-00 00:00:00 |
+----------------------+---------------------+
4. What is your TiDB version? (Required)
nightly
Other expressions like castDecimalAsTime, etc. may have the same problem.
Bug Report
Please answer these questions before submitting your issue. Thanks!
1. Minimal reproduce step (Required)
2. What did you expect to see? (Required)
3. What did you see instead (Required)
4. What is your TiDB version? (Required)
nightly
Other expressions like castDecimalAsTime, etc. may have the same problem.