You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Julian Hyde (Jira)" <ji...@apache.org> on 2020/07/20 20:34:00 UTC

[jira] [Assigned] (CALCITE-4134) Interval expressions

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

Julian Hyde reassigned CALCITE-4134:
------------------------------------

    Assignee: Julian Hyde

> Interval expressions
> --------------------
>
>                 Key: CALCITE-4134
>                 URL: https://issues.apache.org/jira/browse/CALCITE-4134
>             Project: Calcite
>          Issue Type: Sub-task
>            Reporter: Julian Hyde
>            Assignee: Julian Hyde
>            Priority: Major
>             Fix For: 1.25.0
>
>
> Support interval expressions.
> Standard SQL has only interval literals (e.g. {{INTERVAL '1' HOUR}}, {{INTERVAL -'1:2' HOUR TO MINUTE}}). Note that the 'value' part is a character literal and may contain formatting characters like ':'.
> Interval expressions are a SQL extension present in [MySQL|https://dev.mysql.com/doc/refman/8.0/en/expressions.html#temporal-intervals] and [BigQuery|https://cloud.google.com/bigquery/docs/reference/standard-sql/datetime_functions#datetime_add]. We support the syntax {{INTERVAL numericExpression timeUnit}}:
> * the 'value' part is a numeric expression;
> * {{timeUnit}} is a time unit (such as {{HOUR}}), not a time unit range (such as {{HOUR TO MINUTE}});
> * {{timeUnit}} may have precision, e.g. {{HOUR(2)}};
> * {{timeUnit}} may be plural, e.g. {{HOURS}}, if {{SqlConformance.allowPluralTimeUnits}} (see CALCITE-3383);
> * numeric literals and identifiers do not require parentheses, but other expressions require parentheses.
> Examples:
> * {{SELECT INTERVAL empno HOUR FROM Emp}}
> * {{SELECT INTERVAL (empno * 2) MINUTE FROM Emp}}
> * {{INTERVAL -3 YEAR}}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)