title: Changing an attribute in an object that belongs to RDD
body: <p>I have the following code :</p>
  
  <pre><code>      def generateStoriesnew(outputPath: String, groupedRDD:RDD[(String,Iterable[String])], isInChurnMode: Boolean, isInChurnPeriod: Boolean) {
  val windowedRDD = groupedRDD.map(SOME CODE)
   var  windowedRDD2 = windowedRDD.filter(r =&gt; r != null).map(a=&gt;a.churnPeriod(isInChurnPeriod,isInChurnMode))  
  val prettyStringRDD = windowedRDD2.map(r =&gt; {
    r.toString
  })
  prettyStringRDD.saveAsTextFile(outputPath)
  </code></pre>
  
  <p>}</p>
  
  <p>and here is the code for ChurnPriod function:</p>
  
  <pre><code>def churnPeriod( churnPeriod:Boolean, churnMode: Boolean): Unit = {  
  if (churnMode &amp;&amp; rootEventType.equalsIgnoreCase("c")){
    var churnCustStory: CustStoryN = null
    var nonChurnCustStory: CustStoryN = null
    var churnPeriodEventStory: mutable.MutableList[StoryEventN] = null
    var NonChurnEventstory: mutable.MutableList[StoryEventN] = null
    churnPeriodEventStory = new mutable.MutableList[StoryEventN]
    NonChurnEventstory = new mutable.MutableList[StoryEventN]     
    var lastEventChurnPeriod = true
    var currentEventStory = eventStory
    var max = currentEventStory.length
    println(max);
    if (currentEventStory.size &gt; 0) {
      for (i &lt;- 0 until currentEventStory.length) {
        var currentEvent = currentEventStory(i)
        if (currentEvent.timeSenseRootEvent &lt; 90) {          
          churnPeriodEventStory.+=(currentEvent)
          //lastEventChurnPeriod = true
        }
        else {
          NonChurnEventstory.+=(currentEvent)
          lastEventChurnPeriod = false
        }
      }
    }
  if (churnPeriod)
    eventStory = churnPeriodEventStory
  else
    eventStory=null
  </code></pre>
  
  <p>}
      }</p>
  
  <p>but churn period function does not change eventstory which is a member of a custstory class. what am I  missing here ?</p>
  
  <pre><code>    class CustStoryN (val custId:String,
               var rootEventType:String,
               var rootEventTime:Long,
               var eventStory:mutable.MutableList[StoryEventN])
  </code></pre>
  
  <p>my hypothesis is either:
  1.map is not the right transformation for the function that I have
  2.churnPeriod function never get called
  3.I can not change eventstory which is a member of cust story class
  Does anyone have any idea how I can troubleshoot this problem?</p>