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

json_tuple returns null values within repeated columns except the first one

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.2.0
    • Fix Version/s: 2.3.0
    • Component/s: SQL
    • Labels:

      Description

      I was testing json_tuple in extracting values from JSON but I found it could actually returns null values within repeated columns except the first one as below:

      scala> spark.sql("""SELECT json_tuple('{"a":1, "b":2}', 'a', 'b', 'a')""").show()
      +---+---+----+
      | c0| c1|  c2|
      +---+---+----+
      |  1|  2|null|
      +---+---+----+
      

      I think this should be consistent with Hive's implementation:

      hive> SELECT json_tuple('{"a": 1, "b": 2}', 'a', 'a');
      ...
      1    1
      

        Attachments

          Activity

            People

            • Assignee:
              cjm Jen-Ming Chung
              Reporter:
              cjm Jen-Ming Chung
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: