[ 
https://issues.apache.org/jira/browse/CALCITE-5757?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Ruben Q L reopened CALCITE-5757:
--------------------------------

> Incorrect return type for BigQuery TRUNC functions
> --------------------------------------------------
>
>                 Key: CALCITE-5757
>                 URL: https://issues.apache.org/jira/browse/CALCITE-5757
>             Project: Calcite
>          Issue Type: Bug
>            Reporter: Tanner Clary
>            Assignee: Tanner Clary
>            Priority: Major
>              Labels: pull-request-available
>
> This is written in Calcite terms, a Calcite {{TIMESTAMP}} is a BigQuery 
> {{DATETIME}} and a Calcite {{TIMESTAMP_LTZ}} is a BigQuery {{TIMESTAMP}}
> The four BigQuery {{TRUNC}} functions: {{{}DATE_TRUNC{}}}, 
> {{{}DATETIME_TRUNC{}}}, {{{}TIME_TRUNC{}}}, and {{TIMESTAMP_TRUNC}} have 
> varying return types based on (1) which function and (2) the supplied 
> datetime type. The return type can be inferred according to this chart:
> |FUNC/TYPE|DATE|TIMESTAMP|TIME|TS w/ LTZ|
> |DATE_TRUNC|DATE|TIMESTAMP|INVALID|TS w/ LTZ|
> |DATETIME_TRUNC|TIMESTAMP|TIMESTAMP|INVALID|TS w/ LTZ|
> |TIME_TRUNC|INVALID|INVALID|TIME|INVALID|
> |TIMESTAMP_TRUNC|TIMESTAMP|TIMESTAMP|INVALID|TS w/ LTZ|
>  The opened PR corrects the current implementations to match this chart, 
> primarily by adjusting the set return types in the operator table, and also 
> converting  {{DATES}} to {{TIMESTAMPS}} in the convertlet table for the 
> {{DATETIME_TRUNC}} and {{TIMESTAMP_TRUNC}} functions.
> [Relevant 
> Docs|https://cloud.google.com/bigquery/docs/reference/standard-sql/timestamp_functions#timestamp_trunc]



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

Reply via email to