You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Tanner Clary (Jira)" <ji...@apache.org> on 2022/12/15 19:03:00 UTC

[jira] [Commented] (CALCITE-5436) Implement DATE, TIME, TIMESTAMP Subtraction Functions (compatible w/ BigQuery)

    [ https://issues.apache.org/jira/browse/CALCITE-5436?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17648211#comment-17648211 ] 

Tanner Clary commented on CALCITE-5436:
---------------------------------------

Before I start work on this, I'm wondering whether there is a way to map these functions to their addition counterparts to avoid unnecessary implementation. For example, would it be feasible to map the TIME_SUB example above to {{TIME_ADD(TIME '15:30:00', INTERVAL -10 MINUTE)}}? [~julianhyde]
'

> Implement DATE, TIME, TIMESTAMP Subtraction Functions (compatible w/ BigQuery)
> ------------------------------------------------------------------------------
>
>                 Key: CALCITE-5436
>                 URL: https://issues.apache.org/jira/browse/CALCITE-5436
>             Project: Calcite
>          Issue Type: Sub-task
>            Reporter: Tanner Clary
>            Priority: Major
>
> Implement BigQuery's {{TIME_SUB}}, {{TIMESTAMP_SUB}}, and {{DATE_SUB}} functions. Each of these functions follows similar behavior, the primary difference being whether the specified interval is being subtracted from a {{TIME}}, {{TIMESTAMP}}, or {{DATE}} expression. Examples for each are provided below:
> [TIME_SUB|https://cloud.google.com/bigquery/docs/reference/standard-sql/time_functions#time_sub]: {{TIME_SUB(TIME '15:30:00', INTERVAL 10 MINUTE)}} would output '15:20:00'.
> [TIMESTAMP_SUB|https://cloud.google.com/bigquery/docs/reference/standard-sql/timestamp_functions#timestamp_sub]: {{TIMESTAMP_SUB(TIMESTAMP '2008-12-25 15:30:00, INTERVAL 1 HOUR)}} would output '2008-12-25 14:30:00'.
> [DATE_SUB|https://cloud.google.com/bigquery/docs/reference/standard-sql/date_functions#date_sub]: {{DATE_SUB(DATE '2008-12-25', INTERVAL 2 DAY)}} would output '2008-12-27'.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)