Skip to content

Bonus Chapter B01: Word Count

Chapter notes: chapB01/wordcount

Sample input: data/chapB01/words.txt

Run the commands from the repository folder after building the jar (Running the programs).

Spark (Java)

chapB01.wordcount.spark.SparkWordCount

Source: SparkWordCount.java

scripts/run_spark.sh org.dataalgorithms.chapB01.wordcount.spark.SparkWordCount 2 data/chapB01/words.txt /tmp/data-algorithms/chapB01.wordcount.spark.SparkWordCount/output

Spark (Java 8 lambdas)

chapB01.wordcount.sparkwithlambda.SparkWordCount

Source: SparkWordCount.java

scripts/run_spark.sh org.dataalgorithms.chapB01.wordcount.sparkwithlambda.SparkWordCount 2 data/chapB01/words.txt /tmp/data-algorithms/chapB01.wordcount.sparkwithlambda.SparkWordCount/output

MapReduce (Hadoop)

chapB01.wordcount.mapreduce.WordCountDriver

Source: WordCountDriver.java

scripts/run_mapreduce.sh org.dataalgorithms.chapB01.wordcount.mapreduce.WordCountDriver 2 data/chapB01/words.txt /tmp/data-algorithms/chapB01.wordcount.mapreduce.WordCountDriver/output