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

Extend the function of decode so as consistent with mainstream databases

    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 3.1.0
    • 3.2.0
    • SQL
    • None

    Description

      In Spark, decode(bin, charset) - Decodes the first argument using the second argument character set.

      Unfortunately this is NOT what any other SQL vendor understands DECODE to do.
      DECODE generally is a short hand for a simple case expression:

      SELECT DECODE(c1, 1, 'Hello', 2, 'World', '!') FROM (VALUES (1), (2), (3)) AS T(c1)
      => 
      (Hello),
      (World)
      (!)
      

      Attachments

        Activity

          People

            beliefer Jiaan Geng
            beliefer Jiaan Geng
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: