diff options
author | Shixiong Zhu <shixiong@databricks.com> | 2016-08-01 14:41:22 -0700 |
---|---|---|
committer | Shixiong Zhu <shixiong@databricks.com> | 2016-08-01 14:41:22 -0700 |
commit | 03d46aafe561b03e25f4e25cf01e631c18dd827c (patch) | |
tree | 7c615b17f6b1d2349657f3f413fbd47fd15efcd9 | |
parent | ab1e761f9691b41385e2ed2202c5a671c63c963d (diff) | |
download | spark-03d46aafe561b03e25f4e25cf01e631c18dd827c.tar.gz spark-03d46aafe561b03e25f4e25cf01e631c18dd827c.tar.bz2 spark-03d46aafe561b03e25f4e25cf01e631c18dd827c.zip |
[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.
-rw-r--r-- | streaming/src/main/scala/org/apache/spark/streaming/ui/StreamingJobProgressListener.scala | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/streaming/src/main/scala/org/apache/spark/streaming/ui/StreamingJobProgressListener.scala b/streaming/src/main/scala/org/apache/spark/streaming/ui/StreamingJobProgressListener.scala index c086df47d9..61f852a0d3 100644 --- a/streaming/src/main/scala/org/apache/spark/streaming/ui/StreamingJobProgressListener.scala +++ b/streaming/src/main/scala/org/apache/spark/streaming/ui/StreamingJobProgressListener.scala @@ -259,7 +259,7 @@ private[streaming] class StreamingJobProgressListener(ssc: StreamingContext) // We use an Iterable rather than explicitly converting to a seq so that updates // will propagate val outputOpIdToSparkJobIds: Iterable[OutputOpIdAndSparkJobId] = - Option(batchTimeToOutputOpIdSparkJobIdPair.get(batchTime).asScala) + Option(batchTimeToOutputOpIdSparkJobIdPair.get(batchTime)).map(_.asScala) .getOrElse(Seq.empty) _batchUIData.outputOpIdSparkJobIdPairs = outputOpIdToSparkJobIds } |