liupc 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_r257558458
##########
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:
@maropu Here, `exception.getMessage` can not get the root cause message, but
returns `Job aborted`, so I have to use `Utils.exceptionString`.
----------------------------------------------------------------
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]