How to find spark RDD/Dataframe size?
<p>I know how to find the file size in scala.But how to find a RDD/dataframe size in spark?</p>

<p>Scala:</p>

<pre><code>object Main extends App {
  val file = new java.io.File("hdfs://localhost:9000/samplefile.txt").toString()
  println(file.length)
}
</code></pre>

<p>Spark:<br/></p>

<pre><code>val distFile = sc.textFile(file)
println(distFile.length)
</code></pre>

<p>but if i process it not getting file size. How to find the RDD size?</p>