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

    https://github.com/apache/spark/pull/11249#discussion_r53741073
  
    --- Diff: 
streaming/src/main/scala/org/apache/spark/streaming/Checkpoint.scala ---
    @@ -41,6 +41,13 @@ class Checkpoint(ssc: StreamingContext, val 
checkpointTime: Time)
       val checkpointDuration = ssc.checkpointDuration
       val pendingTimes = ssc.scheduler.getPendingTimes().toArray
       val sparkConfPairs = ssc.conf.getAll
    +  @transient val recoverableAccuNameToId = ssc.recoverableAccuNameToId
    --- End diff --
    
    `ssc`could be used directly, but could not in `scala.Function1` as input of 
`filter` method, otherwise it need to be serialized.
    
    if I change change the code to 
    ```scala
      val trackedAccs: Array[AccumulableCheckpoint[_, _]] = 
Accumulators.originals.filter(ele =>
       ssc.recoverableAccuNameToId.values.toSet.contains(ele._1)).map{
        case (id, weakRef) => new AccumulableCheckpoint(weakRef.get.get)
      }.toArray
    ```
    and got below exception:
    
    > java.io.NotSerializableException: DStream checkpointing has been enabled 
but the DStreams with their functions are not serializable
    org.apache.spark.streaming.StreamingContext
    Serialization stack:
        - object not serializable (class: 
org.apache.spark.streaming.StreamingContext, value: 
org.apache.spark.streaming.StreamingContext@381bf51d)
        - field (class: org.apache.spark.streaming.Checkpoint, name: 
org$apache$spark$streaming$Checkpoint$$ssc, type: class 
org.apache.spark.streaming.StreamingContext)
        - object (class org.apache.spark.streaming.Checkpoint, 
org.apache.spark.streaming.Checkpoint@622b6f7)
        at 
org.apache.spark.streaming.StreamingContext.validate(StreamingContext.scala:570)


---
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 [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to