Julian Hyde created CALCITE-4134:
------------------------------------
Summary: Interval expressions
Key: CALCITE-4134
URL: https://issues.apache.org/jira/browse/CALCITE-4134
Project: Calcite
Issue Type: Sub-task
Reporter: Julian Hyde
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)