GitHub user gatorsmile opened a pull request:

    https://github.com/apache/spark/pull/10018

    [SPARK-12028] [SQL] get_json_object returns an incorrect result when the 
value is null literals

    When calling `get_json_object` for the following two cases, both results 
are `"null"`:
    
    ```scala
        val tuple: Seq[(String, String)] = ("5", """{"f1": null}""") :: Nil
        val df: DataFrame = tuple.toDF("key", "jstring")
        val res = df.select(functions.get_json_object($"jstring", 
"$.f1")).collect()
    ```
    ```scala
        val tuple2: Seq[(String, String)] = ("5", """{"f1": "null"}""") :: Nil
        val df2: DataFrame = tuple2.toDF("key", "jstring")
        val res3 = df2.select(functions.get_json_object($"jstring", 
"$.f1")).collect()
    ```
    
    Fixed the problem and also added a test case. 

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/gatorsmile/spark get_json_object

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/spark/pull/10018.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #10018
    
----
commit 06d9eae73e4b40a0451d1d21f7174aacbf05f780
Author: gatorsmile <gatorsm...@gmail.com>
Date:   2015-11-27T18:59:31Z

    fixed a bug of get_json_object

commit 54edc84f21918c5cb69a0abfc51f680190f27a1f
Author: gatorsmile <gatorsm...@gmail.com>
Date:   2015-11-27T19:04:13Z

    Merge remote-tracking branch 'upstream/master' into get_json_object

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to