Uploaded image for project: 'Flink'
  1. Flink
  2. FLINK-24403 Improve behaviour of CAST
  3. FLINK-24426

Add support for cast from a string to an INTERVAL

    XMLWordPrintableJSON

Details

    • Sub-task
    • Status: Open
    • Major
    • Resolution: Unresolved
    • None
    • None
    • None
    • None

    Description

      PostgreSQL allows casts like:

       

      postgres=# select '2 YEARS 5 month 3 HOURS 10 days 2 mins 6 seconds'::interval;
      interval
      ---------------------------------
       2 years 5 mons 10 days 03:02:06
      (1 row)

      postgres=# select '+1 10:17:36.789'::interval;
      {{ interval }}
      --------------------
      {{ 1 day 10:17:36.789}}
      (1 row)

       

      We should at least support the latter which is the standard string representation of an interval, when the inverse cast from INTERVAL to string is used.

       

      Oracle on the other hand uses dedicated functions for such conversion: to_dsinterval() but also supports:

      select CAST('+02-01' AS INTERVAL YEAR TO MONTH) FROM DUAL;

      +02-01

      Attachments

        Activity

          People

            Unassigned Unassigned
            matriv Marios Trivyzas
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated: