Skip to content

Commit 03d46aa

Browse files
committed
[SPARK-15869][STREAMING] Fix a potential NPE in StreamingJobProgressListener.getBatchUIData
## What changes were proposed in this pull request? Moved `asScala` to a `map` to avoid NPE. ## How was this patch tested? Existing unit tests. Author: Shixiong Zhu <shixiong@databricks.com> Closes #14443 from zsxwing/SPARK-15869.
1 parent ab1e761 commit 03d46aa

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

streaming/src/main/scala/org/apache/spark/streaming/ui/StreamingJobProgressListener.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ private[streaming] class StreamingJobProgressListener(ssc: StreamingContext)
259259
// We use an Iterable rather than explicitly converting to a seq so that updates
260260
// will propagate
261261
val outputOpIdToSparkJobIds: Iterable[OutputOpIdAndSparkJobId] =
262-
Option(batchTimeToOutputOpIdSparkJobIdPair.get(batchTime).asScala)
262+
Option(batchTimeToOutputOpIdSparkJobIdPair.get(batchTime)).map(_.asScala)
263263
.getOrElse(Seq.empty)
264264
_batchUIData.outputOpIdSparkJobIdPairs = outputOpIdToSparkJobIds
265265
}

0 commit comments

Comments
 (0)