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

DECODE function returns wrong results when passed NULL

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 3.2.0, 3.2.1, 3.3.0, 3.2.2, 3.3.1
    • 3.2.3, 3.3.2, 3.4.0
    • Spark Core
    • None

    Description

      The DECODE function was implemented for Oracle compatibility. It works similar to CASE expression, but it is supposed to have one major difference: NULL == NULL
      https://docs.oracle.com/database/121/SQLRF/functions057.htm#SQLRF00631

      The Spark implementation does not observe this however:

      select decode(null, 6, 'Spark', NULL, 'SQL', 4, 'rocks');

      NULL

       The result is supposed to be 'SQL'

      Attachments

        Activity

          People

            Gengliang.Wang Gengliang Wang
            srielau Serge Rielau
            Gengliang Wang Gengliang Wang
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: