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

Expose SQLSTATE in error message

    XMLWordPrintableJSON

Details

    Description

      When using spark.sql.error.messageFormat in MINIMAL or STANDARD mode the SQLSTATE is exposed;
      We want to extend this to PRETTY mode, now that all errors have SQLSTATEs

      We propose to trail the SQLSTATE after the text message, so it does not take away from the reading experience of the message, while still being easily found by tooling or humans.
      [<errorClass>] <message> SQLSTATE: <state>
      <context>

      Example:

      [DIVIDE_BY_ZERO] ** Division by zero. Use `try_divide` to tolerate divisor being 0 and return NULL instead. If necessary set "spark.sql.ansi.enabled" to "false" to bypass this error. SQLSTATE: 22013
      == SQL(line 1, position 8){{{}==
      {}}}{{{}SELECT 1/0
      {}}}       ^^^

      Other options considered have been:
      [DIVIDE_BY_ZERO](22013) ** Division by zero. Use `try_divide` to tolerate divisor being 0 and return NULL instead. If necessary set "spark.sql.ansi.enabled" to "false" to bypass this error. 
      == SQL(line 1, position 8){{{}==
      {}}}{{{}SELECT 1/0
      {}}}       ^^^

      and

      {{[DIVIDE_BY_ZERO] ** Division by zero. Use `try_divide` to tolerate divisor being 0 and return NULL instead. If necessary set "spark.sql.ansi.enabled" to "false" to bypass this error.
      == SQL(line 1, position 8)==
      SELECT 1/0
             ^^^
      {{SQLSTATE: 22013}}
      }}{}{{{}}}

      Attachments

        Issue Links

          Activity

            People

              srielau Serge Rielau
              srielau Serge Rielau
              Max Gekk Max Gekk
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: