HyukjinKwon commented on a change in pull request #23674: [SPARK-26745][SQL] 
JsonSuite test case: empty line -> 0 record count
URL: https://github.com/apache/spark/pull/23674#discussion_r252550120
 
 

 ##########
 File path: 
sql/core/src/test/scala/org/apache/spark/sql/execution/datasources/json/JsonSuite.scala
 ##########
 @@ -2426,6 +2426,17 @@ class JsonSuite extends QueryTest with SharedSQLContext 
with TestJsonData {
     countForMalformedJSON(0, Seq(""))
   }
 
+  test("SPARK-26745: count() for non-multiline input with empty lines") {
+    val df = spark.read.json(testFile("test-data/with-empty-line.json"))
+    val withEmptyLineData = Row(1, 2, 3) :: Row(4, 5, 6) :: Row(7, 8, 9) :: Nil
 
 Review comment:
   Actually, can you write a test without a separate file? you could do, for 
instance,
   
   ```scala
   withTempPath { path =>
     Seq("", """{"a":4}""", "", ...).toDF.repartition(1)
       .write.text(path.getCanonicalPath())
     assert(spark.read.json(path.getCanonicalPath()).count() === 3)
   }
   ```

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

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

Reply via email to