-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Description
Describe the bug
On FE, str_to_date() is implemented by joda.DateTimeFormatter,
and on BE, it is implemented by Doris it self.
These 2 implementations are inconsistent in some cases:
-
FE can not to the constant folding for
str_to_date("2020-08-08", "%Y-%m-%d %H:%i:%s")
It falls to BE and return2020-08-08, but in mysql, it returns2020-08-08 00:00:00. -
select str_to_date("20-09-01", "%Y-%m-%d");
FE return0020-09-01, but BE return2020-09-01, which is same as MySQL. -
Some BI will generate predicate like
DATE_ADD(DATE_ADD(str_to_date(DATE_FORMAT(NOW(),'%Y-%m-%d'),'%Y-%m-%d %H:%i:%s'),INTERVAL 1 DAY),INTERVAL -1 SECOND)It should be able to do the constant folding, but failed on
str_to_date.
Resolution
We should keep the behavior on BE and FE consistency.