Guillaume Massé created CALCITE-5902:
----------------------------------------
Summary: Add DATE_TRUNC function consistent with Apache Spark
Key: CALCITE-5902
URL: https://issues.apache.org/jira/browse/CALCITE-5902
Project: Calcite
Issue Type: New Feature
Components: core
Affects Versions: 1.35.0
Reporter: Guillaume Massé
Add DATE_TRUNC function consistent with Apache Spark. Per the specification,
the syntax is as follows:
DATE_TRUNC(<format string>, <datetime | timestamp string>)
{noformat}
fmt - the format representing the unit to be truncated to
"YEAR", "YYYY", "YY" - truncate to the first date of the year that the ts falls
in, the time part will be zero out
"QUARTER" - truncate to the first date of the quarter that the ts falls in, the
time part will be zero out
"MONTH", "MM", "MON" - truncate to the first date of the month that the ts
falls in, the time part will be zero out
"WEEK" - truncate to the Monday of the week that the ts falls in, the time part
will be zero out
"DAY", "DD" - zero out the time part
"HOUR" - zero out the minute and second with the fraction part
"MINUTE"- zero out the second with the fraction part
"SECOND" - zero out the second fraction part
"MILLISECOND" - zero out the microseconds
"MICROSECOND" - everything remains
{noformat}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)