Uploaded image for project: 'Flink'
  1. Flink
  2. FLINK-24924

TO_TIMESTAMP and TO_DATE should fail

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Open
    • Major
    • Resolution: Unresolved
    • None
    • None
    • Table SQL / Planner
    • None

    Description

      In a similar fashion to what described https://issues.apache.org/jira/browse/FLINK-24385, TO_TIMESTAMP and TO_DATE should fail instead of returning null.

      In particular for these two functions, a failure in parsing could lead to very unexpected behavior, for example it could lead to records with null rowtime.

      We should change these functions to fail by default when parsing generates an error. We can let users handle errors by letting them use TRY_CAST for the same functionality:

      -- This fails when input is invalid
      TO_TIMESTAMP(input)
      
      -- Behaves the same as above
      CAST(input AS TIMESTAMP)
      
      -- This returns null when input is invalid
      TRY_CAST(input AS TIMESTAMP)
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            slinkydeveloper Francesco Guardiani
            Votes:
            0 Vote for this issue
            Watchers:
            10 Start watching this issue

            Dates

              Created:
              Updated: