Details

    • Sub-task
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.23.0
    • 1.25.0
    • None
    • None

    Description

      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 and BigQuery. 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

      Attachments

        Issue Links

          Activity

            People

              julianhyde Julian Hyde
              julianhyde Julian Hyde
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: