Tanner Clary created CALCITE-5469:
-------------------------------------
Summary: Implement BigQuery DATETIME_ADD/DATETIME_DIFF
Key: CALCITE-5469
URL: https://issues.apache.org/jira/browse/CALCITE-5469
Project: Calcite
Issue Type: Sub-task
Reporter: Tanner Clary
Assignee: Tanner Clary
Add support for BigQuery's {{DATETIME_ADD/DATETIME_DIFF}} functions.
{{DATETIME_ADD(datetime, interval)}} can accept a timestamp (or a datetime,
which is an alias for timestamp) for its first argument and an interval for its
second. The output is the datetime that occurs {{interval}} after the provided
{{datetime}}.
{{DATETIME_DIFF(datetime, datetime2, timeUnit)}} returns the whole number of
{{timeUnit}} between {{datetime}} and {{datetime2}}, with the result being
negative if {{datetime}} occurs before {{datetime2}}
Examples:
{{DATETIME_ADD(TIMESTAMP '2008-12-25 15:30:00', INTERVAL 5 MINUTE)}} would
return: '2008-12-25 15:35:00'.
{{DATETIME_DIFF(DATETIME '2008-12-25 15:30:00', DATETIME '2008-12-26 15:30:00',
DAY)}} would return: -1.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)