Github user rxin commented on a diff in the pull request:

    https://github.com/apache/spark/pull/10496#discussion_r48586694
  
    --- Diff: 
sql/core/src/test/scala/org/apache/spark/sql/execution/datasources/json/JsonParsingOptionsSuite.scala
 ---
    @@ -111,4 +111,21 @@ class JsonParsingOptionsSuite extends QueryTest with 
SharedSQLContext {
         assert(df.schema.head.name == "age")
         assert(df.first().getDouble(0).isNaN)
       }
    +
    +  test("allowBackslashEscapingAnyCharacter off") {
    +    val str = """{"name": "Cazen Lee", "price": "\$10"}"""
    +    val rdd = sqlContext.sparkContext.parallelize(Seq(str))
    +    val df = sqlContext.read.option("allowBackslashEscapingAnyCharacter", 
"false").json(rdd)
    +
    +    assert(df.schema.head.name == "_corrupt_record")
    +  }
    +
    +  test("allowBackslashEscapingAnyCharacter on") {
    +    val str = """{"name": "Cazen Lee", "price": "\$10"}"""
    +    val rdd = sqlContext.sparkContext.parallelize(Seq(str))
    +    val df = sqlContext.read.option("allowBackslashEscapingAnyCharacter", 
"true").json(rdd)
    +
    +    assert(df.schema.head.name == "name")
    +    assert(df.first().getString(0) == "Cazen Lee")
    --- End diff --
    
    should we also test the price field?



---
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