[
https://issues.apache.org/jira/browse/CALCITE-4134?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17161797#comment-17161797
]
Julian Hyde commented on CALCITE-4134:
--------------------------------------
Dev branch: https://github.com/julianhyde/calcite/tree/4134-interval
> Interval expressions
> --------------------
>
> Key: CALCITE-4134
> URL: https://issues.apache.org/jira/browse/CALCITE-4134
> Project: Calcite
> Issue Type: Sub-task
> Affects Versions: 1.23.0
> 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)