Github user jerryshao commented on a diff in the pull request:

    https://github.com/apache/spark/pull/3466#discussion_r22245026
  
    --- Diff: 
streaming/src/main/scala/org/apache/spark/streaming/StreamingSource.scala ---
    @@ -28,46 +28,58 @@ private[streaming] class StreamingSource(ssc: 
StreamingContext) extends Source {
     
       private val streamingListener = ssc.progressListener
     
    -  private def registerGauge[T](name: String, f: 
StreamingJobProgressListener => T,
    +  private def registerGauge[T](name: String, f: 
StreamingJobProgressListener => Option[T],
           defaultValue: T) {
         metricRegistry.register(MetricRegistry.name("streaming", name), new 
Gauge[T] {
    -      override def getValue: T = 
Option(f(streamingListener)).getOrElse(defaultValue)
    --- End diff --
    
    Hi TD, what's your meaning of `And other places should not have to use 
Option`, If here as an example, change to 
    
    ```scala
    registerGauge("lastCompletedBatch_submissionTime",
        _.lastCompletedBatch.map(_.submissionTime).get, -1L)
    ```
    
    `get` will throw exception when there's no completed batch. I'm not sure 
what's actual meaning, sorry if I misunderstand anything.



---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

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

Reply via email to