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_r252549423
 
 

 ##########
 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
+    // important to do this .count() first, prior to 
caching/persisting/computing/collecting, to
+    // test the non-parsed-count pathway
+    assert(df.count() === withEmptyLineData.length,
+           "JSON DataFrame unparsed-count should exclude whitespace-only 
lines")
 
 Review comment:
   nit:
   
   ```
       assert(df.count() === withEmptyLineData.length,
         "JSON DataFrame unparsed-count should exclude whitespace-only lines")
   ```
   
   indentation

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