dongjoon-hyun commented on a change in pull request #33608:
URL: https://github.com/apache/spark/pull/33608#discussion_r680792268
##########
File path:
sql/core/src/test/scala/org/apache/spark/sql/execution/datasources/json/JsonSuite.scala
##########
@@ -2944,6 +2944,19 @@ abstract class JsonSuite
}
}
}
+
+ test("SPARK-36379: proceed parsing with root nulls in permissive mode") {
+ assert(intercept[SparkException] {
+ spark.read.option("mode", "failfast")
+ .schema("a string").json(Seq("""[{"a": "str"},
null]""").toDS).collect()
+ }.getMessage.contains("Malformed records are detected"))
+
+ // Permissive modes should proceed parsing malformed records (null).
+ // Here, since an array fails to parse in the middle, we will return one
row.
+ checkAnswer(
+ spark.read.json(Seq("""[{"a": "str"}, null, {"a": "str"}]""").toDS),
Review comment:
Although `PERMISSIVE`is the default, shall we use `.option("mode",
"permissive")` explicitly because this is a test case?
--
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]