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

Recognize sign before the interval string in literals

    XMLWordPrintableJSON

Details

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

    Description

      According to the SQL standard:

      <interval literal> ::=
        INTERVAL [ <sign> ] <interval string> <interval qualifier>
      <interval string> ::=
        <quote> <unquoted interval string> <quote>
      <unquoted interval string> ::=
        [ <sign> ] { <year-month literal> | <day-time literal> }
      <sign> ::=
          <plus sign>
        | <minus sign>
      

      but the parsing fails:

      spark-sql> select interval -'1-1' year to month;
      Error in query:
      mismatched input 'to' expecting {<EOF>, ';'}(line 1, pos 28)
      
      == SQL ==
      select interval -'1-1' year to month
      ----------------------------^^^
      

      Attachments

        Activity

          People

            maxgekk Max Gekk
            maxgekk Max Gekk
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: