From ee6543fc2c0a3fa4bb42a233197170f1e0b20a73 Mon Sep 17 00:00:00 2001 From: Tathagata Das Date: Thu, 10 Apr 2014 14:28:46 -0700 Subject: [PATCH] Minor changes based on Andrew's comments. --- .../apache/spark/streaming/ui/StreamingPage.scala | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/streaming/src/main/scala/org/apache/spark/streaming/ui/StreamingPage.scala b/streaming/src/main/scala/org/apache/spark/streaming/ui/StreamingPage.scala index 8ef5ebb4cd96b..5cd900c2f88f0 100644 --- a/streaming/src/main/scala/org/apache/spark/streaming/ui/StreamingPage.scala +++ b/streaming/src/main/scala/org/apache/spark/streaming/ui/StreamingPage.scala @@ -85,7 +85,7 @@ private[ui] class StreamingPage(parent: StreamingTab) val headerRow = Seq( "Receiver", "Location", - s"Records in last batch", + "Records in last batch", "Minimum rate\n[records/sec]", "25th percentile rate\n[records/sec]", "Median rate\n[records/sec]", @@ -102,8 +102,7 @@ private[ui] class StreamingPage(parent: StreamingTab) }.getOrElse { Seq(emptyCellTest, emptyCellTest, emptyCellTest, emptyCellTest, emptyCellTest) } - Seq(receiverName, receiverLocation, receiverLastBatchRecords) ++ - receivedRecordStats + Seq(receiverName, receiverLocation, receiverLastBatchRecords) ++ receivedRecordStats } Some(listingTable(headerRow, dataRows, fixedWidth = true)) } else { @@ -225,15 +224,18 @@ private[ui] class StreamingPage(parent: StreamingTab) day -> s"$hourString $minuteString $secondString", week -> s"$dayString $hourString $minuteString", year -> s"$weekString $dayString $hourString" - ).foreach { - case (durationLimit, durationString) if (ms < durationLimit) => + ).foreach { case (durationLimit, durationString) => + if (ms < durationLimit) { + // if time is less than the limit (upto year) return durationString - case e: Any => // matcherror is thrown without this + } } + // if time is more than a year return s"$yearString $weekString $dayString" } catch { case e: Exception => logError("Error converting time to string", e) + // if there is some error, return blank string return "" } }