Uploaded image for project: 'Spark'
  1. Spark
  2. SPARK-35161

Error-handling SQL functions

    XMLWordPrintableJSON

Details

    • Umbrella
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 3.2.0
    • None
    • SQL
    • None

    Description

      Create new Error-handling version SQL functions for existing SQL functions/operators, which returns NULL if overflow/error occurs. So that:
      1. Users can manage to finish queries without interruptions in ANSI mode.
      2. Users can get NULLs instead of unreasonable results if overflow occurs when ANSI mode is off.
      For example, the behavior of the following SQL operations is unreasonable:

      2147483647 + 2 => -2147483647
      CAST(2147483648L AS INT) => -2147483648
      

      With the new safe version SQL functions:

      TRY_ADD(2147483647, 2) => null
      TRY_CAST(2147483648L AS INT) => null
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            Gengliang.Wang Gengliang Wang
            Gengliang Wang Gengliang Wang
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated: