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

Oliver Lee updated CALCITE-5499:
--------------------------------
    Description: 
BigQuery documentation shows that TIMESTAMP_TRUNC supports an optional 3rd 
argument, time zone
Docs: 
[https://cloud.google.com/bigquery/docs/reference/standard-sql/timestamp_functions#timestamp_trunc]

 

The current implementation does not support that.
{quote}SELECT
  timestamp_value AS timestamp_value,
  TIMESTAMP_TRUNC(timestamp_value, WEEK(MONDAY), "UTC") AS utc_truncated,
  TIMESTAMP_TRUNC(timestamp_value, WEEK(MONDAY), "Pacific/Auckland") AS 
nzdt_truncated
FROM (SELECT TIMESTAMP("2017-11-06 00:00:00+12") AS timestamp_value);

-- Display of results may differ, depending upon the environment and time zone 
where this query was executed.
+-------------------------+-------------------------+-------------------------+
| timestamp_value         | utc_truncated           | nzdt_truncated          |
+-------------------------+-------------------------+-------------------------+
| 2017-11-05 12:00:00 UTC | 2017-10-30 00:00:00 UTC | 2017-11-05 11:00:00 UTC |
+-------------------------+-------------------------+-------------------------+

 
{quote}
 

  was:
BigQuery documentation shows that TIMESTAMP_TRUNC supports an optional 3rd 
argument, time zone
Docs: 
[https://cloud.google.com/bigquery/docs/reference/standard-sql/timestamp_functions#timestamp_trunc]

 

The current implementation does not support that.
{quote} 
{quote}  
{quote}
SELECT
  timestamp_value AS timestamp_value,
  TIMESTAMP_TRUNC(timestamp_value, WEEK(MONDAY), "UTC") AS utc_truncated,
  TIMESTAMP_TRUNC(timestamp_value, WEEK(MONDAY), "Pacific/Auckland") AS 
nzdt_truncated
FROM (SELECT TIMESTAMP("2017-11-06 00:00:00+12") AS timestamp_value);

– Display of results may differ, depending upon the environment and time zone 
where this query was executed.
{+}-----------------------{-}{{-}}{-}{-}{+}---------------------{-}{{-}}++{{-}}{-}-----------------------
|timestamp_value        |utc_truncated          |nzdt_truncated          |

{+}-----------------------{-}{{-}}{-}{-}{+}---------------------{-}{{-}}++{{-}}{-}-----------------------
|2017-11-05 12:00:00 UTC|2017-10-30 00:00:00 UTC|2017-11-05 11:00:00 UTC|

{+}-----------------------{-}{{-}}{-}{-}{+}---------------------{-}{{-}}++{{-}}{-}-----------------------
{quote}
 


> BigQuery TIMESTAMP_TRUNC() not fully implemented
> ------------------------------------------------
>
>                 Key: CALCITE-5499
>                 URL: https://issues.apache.org/jira/browse/CALCITE-5499
>             Project: Calcite
>          Issue Type: Bug
>            Reporter: Oliver Lee
>            Priority: Minor
>
> BigQuery documentation shows that TIMESTAMP_TRUNC supports an optional 3rd 
> argument, time zone
> Docs: 
> [https://cloud.google.com/bigquery/docs/reference/standard-sql/timestamp_functions#timestamp_trunc]
>  
> The current implementation does not support that.
> {quote}SELECT
>   timestamp_value AS timestamp_value,
>   TIMESTAMP_TRUNC(timestamp_value, WEEK(MONDAY), "UTC") AS utc_truncated,
>   TIMESTAMP_TRUNC(timestamp_value, WEEK(MONDAY), "Pacific/Auckland") AS 
> nzdt_truncated
> FROM (SELECT TIMESTAMP("2017-11-06 00:00:00+12") AS timestamp_value);
> -- Display of results may differ, depending upon the environment and time 
> zone where this query was executed.
> +-------------------------+-------------------------+-------------------------+
> | timestamp_value         | utc_truncated           | nzdt_truncated          
> |
> +-------------------------+-------------------------+-------------------------+
> | 2017-11-05 12:00:00 UTC | 2017-10-30 00:00:00 UTC | 2017-11-05 11:00:00 UTC 
> |
> +-------------------------+-------------------------+-------------------------+
>  
> {quote}
>  



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

Reply via email to