srowen commented on code in PR #36222:
URL: https://github.com/apache/spark/pull/36222#discussion_r851660751


##########
core/src/main/scala/org/apache/spark/rdd/HadoopRDD.scala:
##########
@@ -457,9 +457,9 @@ private[spark] object HadoopRDD extends Logging {
       if (locationStr != "localhost") {
         if (loc.isInMemory) {
           logDebug(s"Partition $locationStr is cached by Hadoop.")
-          Some(HDFSCacheTaskLocation(locationStr).toString)
+          Option(HDFSCacheTaskLocation(locationStr).toString)

Review Comment:
   I don't see how the result of .toString can be null. Isn't the issue if 
anything that HDFSCacheTaskLocation.apply returns null?



##########
core/src/main/scala/org/apache/spark/scheduler/DAGScheduler.scala:
##########
@@ -2736,7 +2736,7 @@ private[spark] class DAGScheduler(
     // If the RDD has some placement preferences (as is the case for input 
RDDs), get those
     val rddPrefs = rdd.preferredLocations(rdd.partitions(partition)).toList
     if (rddPrefs.nonEmpty) {
-      return rddPrefs.map(TaskLocation(_))
+      return rddPrefs.map(TaskLocation(_)).filter(_ != null)

Review Comment:
   If you filter out null first, you don't need to check in the apply() method 
below



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to