[enhance](function) support two special format for str_to_date (#29823)

This commit is contained in:
zclllyybb
2024-01-11 13:59:41 +08:00
committed by yiguolei
parent eed72a101e
commit 4d97f8ea75
6 changed files with 77 additions and 20 deletions

View File

@ -1536,6 +1536,14 @@ public class DateLiteral extends LiteralExpr {
getDateFromDaynr(days);
}
if (!timePartUsed && year > 0) {
if (format.equals("%Y")) {
month = day = 1;
} else if (format.equals("%Y-%m")) {
day = 1;
}
}
// Compute timestamp type
// TODO(Gabriel): we still use old version datetime/date and change this to new version when
// we think it's stable enough