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/16 06:33:01 UTC

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

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

 ##########
 File path: core/src/main/scala/org/apache/spark/rdd/RDD.scala
 ##########
 @@ -1507,7 +1507,8 @@ abstract class RDD[T: ClassTag](
     val r = this.mapPartitions { iter =>
       val text = new Text()
       iter.map { x =>
-        text.set(x.toString)
+        val value = if (x != null) x.toString else "Null"
+        text.set(value)
 
 Review comment:
   I would simply just add an assert or require.

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