HyukjinKwon commented on code in PR #36399:
URL: https://github.com/apache/spark/pull/36399#discussion_r861570313


##########
sql/core/src/test/scala/org/apache/spark/sql/JsonFunctionsSuite.scala:
##########
@@ -132,6 +132,86 @@ class JsonFunctionsSuite extends QueryTest with 
SharedSparkSession {
       Row(Row(java.sql.Timestamp.valueOf("2015-08-26 18:00:00.0"))))
   }
 
+  test("from_json with option (allowComments)") {
+    val df = Seq("""{"str": /* Hello */ "World"}""").toDS()
+    val schema = new StructType().add("str", StringType)
+    val options = Map("allowComments" -> "true")
+
+    checkAnswer(
+      df.select(from_json($"value", schema, options)),
+      Row(Row("World")) :: Nil)
+  }
+
+  test("from_json with option (allowUnquotedFieldNames)") {
+    val df = Seq("""{str: "World"}""").toDS()
+    val schema = new StructType().add("str", StringType)
+    val options = Map("allowUnquotedFieldNames" -> "true")
+
+    checkAnswer(
+      df.select(from_json($"value", schema, options)),
+      Row(Row("World")) :: Nil)
+  }
+
+  test("from_json with option (allowSingleQuotes)") {
+    val df = Seq("""{"str": 'World'}""").toDS()
+    val schema = new StructType().add("str", StringType)
+    val options = Map("allowSingleQuotes" -> "true")
+
+    checkAnswer(
+      df.select(from_json($"value", schema, options)),
+      Row(Row("World")) :: Nil)
+  }
+
+  test("from_json with option (allowNumericLeadingZeros)") {

Review Comment:
   Hm, this test fails.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to