Jen-Ming Chung created SPARK-21804:
--------------------------------------

             Summary: json_tuple returns null values within repeated columns 
except the first one
                 Key: SPARK-21804
                 URL: https://issues.apache.org/jira/browse/SPARK-21804
             Project: Spark
          Issue Type: Bug
          Components: SQL
    Affects Versions: 2.2.0
            Reporter: Jen-Ming Chung
            Priority: Minor


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:

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

I think this should be consistent with Hive's implementation:
{code:language=scala}
hive> SELECT json_tuple('{"a": 1, "b": 2}', 'a', 'a');
...
1    1
{code}




--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to