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

Julian Hyde edited comment on CALCITE-5422 at 12/7/22 6:37 AM:
---------------------------------------------------------------

This change should affect the syntax of an interval literal anywhere, not just 
inside {{{}TIMESTAMP_ADD{}}}. For example, the statement
{code:sql}
VALUES INTERVAL 5000 MILLISECOND
{code}
is currently invalid but would be valid after this change. The new units are 
{{MILLISECOND}}, {{MICROSECOND}} and their plurals.

The following remain invalid:
{code:sql}
# Invalid. After TO, SECOND is still the smallest valid unit
VALUES INTERVAL '1:1' HOUR TO MILLISECOND;

# Invalid. After a string, SECOND is still the smallest valid unit
VALUES INTERVAL '5000' MICROSECOND;

# Invalid. BigQuery doesn't support NANOSECOND, even in TIMESTAMP_ADD,
# and neither should we.
VALUES TIMESTAMP_ADD(TIMESTAMP '2022-12-06 22:37:00',
  INTERVAL 5000000 NANOSECOND);
{code}


was (Author: julianhyde):
This change should affect the syntax of an interval literal anywhere, not just 
inside {{{}TIMESTAMP_ADD{}}}. For example, the statement
{code:sql}
VALUES INTERVAL 5000 MILLISECOND
{code}
is currently invalid but would be valid after this change. The new units are 
{{{}MILLISECOND{}}}, {{{}MICROSECOND{}}}, {{NANOSECOND}} and their plurals.

The following remain invalid:
{code:java}
# Invalid. After TO, SECOND is still the smallest valid unit
VALUES INTERVAL '1:1' HOUR TO MILLISECOND;

# Invalid. After a string, SECOND is still the smallest valid unit
VALUES INTERVAL '5000' MICROSECOND; {code}

> Time units to be supported by TIMESTAMP_ADD function
> ----------------------------------------------------
>
>                 Key: CALCITE-5422
>                 URL: https://issues.apache.org/jira/browse/CALCITE-5422
>             Project: Calcite
>          Issue Type: Bug
>            Reporter: Tanner Clary
>            Assignee: Tanner Clary
>            Priority: Major
>
> There is currently ambiguity surrounding what set of time units Calcite 
> should support for BigQuery's TIMESTAMP_ADD function. Specifically, intervals 
> do not support fractional seconds (nano, micro). The set of units supported 
> by BigQuery may be found at 
> https://cloud.google.com/bigquery/docs/reference/standard-sql/timestamp_functions#timestamp_add



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

Reply via email to