Spark – Word count

Word counting using  Spark program from  Windows 7 cmd prompt.  Create a file in the name “SPARK_WORD_COUNT” and save on the C drive . Here we are trying to count the word “HADOOP” from the  saved  file . I added 17 “HADOOP” words in this file  and end of the step , spark program counts 17 “HADOOP” words . Lets us start the spark program

Go to  bin directory  and  enter  “spark-shell” to  start the  spark . Follow the  below  steps


val file = sc.textFile(“C:/SPARK_WORD_COUNT.txt”)

val HadoopCount  = file.filter(line => line.contains(“HADOOP”)


Word count result

Word count result

3 thoughts on “Spark – Word count

  1. What a smashing article! Thanks for writing it and for sharing it with us.English is not my native language, that said the article content was so lucid and easy to understand I enjoyed reading every paragraph.

  2. This post is really insightful, it has helped me understand so many things.Thanks for posting such an informative article. Rarely on internet, one comes across informative ones such as this.Awesome article.keep the good work Thank you.

  3. Great article! Thanks for sharing such a good information.The most simple yet complete and explaining the purity and main point behind the topic.Do keep sharing these kind of posts,they are really helpful in making our mind to good thinking and apply our thought.

Leave a Reply

Your email address will not be published. Required fields are marked *

Name *