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

    https://github.com/apache/spark/pull/9831#discussion_r45394497
  
    --- Diff: 
streaming/src/test/scala/org/apache/spark/streaming/rdd/TrackStateRDDSuite.scala
 ---
    @@ -278,6 +287,50 @@ class TrackStateRDDSuite extends SparkFunSuite with 
BeforeAndAfterAll {
           rdd7, Seq(("k3", 2)), Set())
       }
     
    +  test("checkpointing") {
    +    /*
    +      This tests whether the TrackStateRDD correctly truncates any 
references to its parent RDDs -
    +      the data RDD and the parent TrackStateRDD.
    +     */
    +    def rddCollectFunc(rdd: RDD[TrackStateRDDRecord[Int, Int, Int]]) = {
    +      rdd.map { record => (record.stateMap.getAll().toList, 
record.emittedRecords.toList) }
    +         .collect.toSet
    +    }
    +
    +    /** Generate TrackStateRDD with data RDD having a long lineage */
    +    def makeStateRDDWithLongLineageDataRDD(longLineageRDD: RDD[Int])
    +      : TrackStateRDD[Int, Int, Int, Int] = {
    +      TrackStateRDD.createFromPairRDD(longLineageRDD.map { _ -> 1}, 
partitioner, Time(0))
    +    }
    +
    +    testRDD(
    +      makeStateRDDWithLongLineageDataRDD, reliableCheckpoint = true, 
rddCollectFunc _)
    +    testRDDPartitions(
    +      makeStateRDDWithLongLineageDataRDD, reliableCheckpoint = true, 
rddCollectFunc _)
    +
    +    /** Generate TrackStateRDD with parent state RDD having a long lineage 
*/
    +    def makeStateRDDWithLongLineageParenttateRDD(
    +        longLineageRDD: RDD[Int]): TrackStateRDD[Int, Int, Int, Int] = {
    +
    +      // Create a TrackStateRDD that has a long lineage using the data RDD 
with a long lineage
    +      val stateRDDWithLongLineage = 
makeStateRDDWithLongLineageDataRDD(longLineageRDD)
    +
    +      // Create a new TrackStateRDD, with the lineage lineage 
TrackStateRDD as the parent
    +      new TrackStateRDD[Int, Int, Int, Int](
    +        stateRDDWithLongLineage,
    +        stateRDDWithLongLineage.sparkContext.emptyRDD[(Int, 
Int)].partitionBy(partitioner),
    --- End diff --
    
    It's better to test with a long lineage `partitionedDataRDD`.


---
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