title: Find size of data stored in rdd from a text file in apache spark
body: <p>I am new to Apache Spark (version 1.4.1). I wrote a small code to read a text file and stored its data in Rdd . </p>
  
  <p>Is there a way by which I can get the size of data in rdd .</p>
  
  <p>This is my code : </p>
  
  <pre><code>import org.apache.spark.SparkContext
  import org.apache.spark.rdd.RDD
  import org.apache.spark.util.SizeEstimator
  import org.apache.spark.sql.Row
  
  object RddSize {
  
    def main(args: Array[String]) {
  
      val sc = new SparkContext("local", "data size")
      val FILE_LOCATION = "src/main/resources/employees.csv"
      val peopleRdd = sc.textFile(FILE_LOCATION)
  
      val newRdd = peopleRdd.filter(str =&gt; str.contains(",M,"))
      //Here I want to find whats the size remaining data
    }
  } 
  </code></pre>
  
  <p>I want to get size of data before filter Transformation (<strong>peopleRdd</strong>) and after it (<strong>newRdd</strong>).</p>