You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2019/02/17 23:43:42 UTC

[GitHub] maropu commented on a change in pull request #23799: [SPARK-26892][CORE] Fix saveAsTextFile throws NullPointerException when null row present

maropu commented on a change in pull request #23799: [SPARK-26892][CORE] Fix saveAsTextFile throws NullPointerException when null row present
URL: https://github.com/apache/spark/pull/23799#discussion_r257530069
 
 

 ##########
 File path: core/src/test/scala/org/apache/spark/FileSuite.scala
 ##########
 @@ -94,6 +94,14 @@ class FileSuite extends SparkFunSuite with LocalSparkContext {
     assert(compressedFile.length < normalFile.length)
   }
 
+  test("text files do not allow null rows") {
+    sc = new SparkContext("local", "test")
+    val outputDir = new File(tempDir, "output").getAbsolutePath
+    val nums = sc.makeRDD((1 to 100) ++ Seq(null))
+    val exception = intercept[SparkException](nums.saveAsTextFile(outputDir))
+    assert(Utils.exceptionString(exception).contains("should not contain null rows"))
 
 Review comment:
   Just write `exception .getMessage.contains...`?

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org