Uploaded image for project: 'Spark'
  1. Spark
  2. SPARK-27790 Support ANSI SQL INTERVAL types
  3. SPARK-36222

Step by days in the Sequence expression for dates

    XMLWordPrintableJSON

Details

    • Sub-task
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 3.2.0
    • 3.2.0
    • SQL
    • None

    Description

      Allow to generate a sequence of dates by day step in a range of dates. For instance:

      spark-sql> select sequence(date'2021-07-01', date'2021-07-10', interval '3' day);
      Error in query: cannot resolve 'sequence(DATE '2021-07-01', DATE '2021-07-10', INTERVAL '3' DAY)' due to data type mismatch:
      sequence uses the wrong parameter type. The parameter type must conform to:
      1. The start and stop expressions must resolve to the same type.
      2. If start and stop expressions resolve to the 'date' or 'timestamp' type
      then the step expression must resolve to the 'interval' or
      'interval year to month' or 'interval day to second' type,
      otherwise to the same type as the start and stop expressions.
               ; line 1 pos 7;
      'Project [unresolvedalias(sequence(2021-07-01, 2021-07-10, Some(INTERVAL '3' DAY), Some(Europe/Moscow)), None)]
      +- OneRowRelation
      

      Attachments

        Issue Links

          Activity

            People

              beliefer Jiaan Geng
              maxgekk Max Gekk
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: