spark-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From koeninger <...@git.apache.org>
Subject [GitHub] spark pull request #15307: [WIP][SPARK-17731][SQL][STREAMING] Metrics for st...
Date Mon, 03 Oct 2016 21:12:12 GMT
Github user koeninger commented on a diff in the pull request:

    https://github.com/apache/spark/pull/15307#discussion_r81641129
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/streaming/StreamExecution.scala
---
    @@ -273,8 +304,14 @@ class StreamExecution(
         val hasNewData = {
           awaitBatchLock.lock()
           try {
    -        val newData = uniqueSources.flatMap(s => s.getOffset.map(o => s -> o))
    -        availableOffsets ++= newData
    +        timeIt(GET_OFFSET_LATENCY) {
    +          val latestOffsets: Map[Source, Option[Offset]] = uniqueSources.map { s =>
    +            timeIt(s, SOURCE_GET_OFFSET_LATENCY) {
    +              (s, s.getOffset)
    +            }
    +          }.toMap
    +          availableOffsets ++= latestOffsets.filter { case (s, o) => o.nonEmpty }.mapValues(_.get)
    --- End diff --
    
    Just wanted to make sure I wasn't missing something.  There's later code that uses flatMap
instead of a separate filter, maybe better to be consistent one way or the other but not a
big deal.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Mime
View raw message