title: What is difference between calling someRDD.collect.foreach(println) vs someRDD.foreach(println)
body: <p>I have created an RDD from a csv file when i am calling rdd.collect.foreach(println) it returns file as it is but rdd.foreach(println) returns merged output. There are two partions on the RDD.
          val sc = new SparkContext("local[*]", "WordCount")</p>
  
  <pre><code>    val cities = sc.textFile("C:/Users/PSKUMARBEHL/Desktop/us_cities.csv")
        cities.collect.foreach(println)
        cities.foreach(println)
        println(cities.partitions.length)
  </code></pre>