Skip to content

Bonus Chapter B09: Character Count

Chapter notes: chapB09/charcount

Sample input: data/chapB01/words.txt

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

Spark (Java)

chapB09.charcount.spark.basic.CharCount

Source: CharCount.java

scripts/run_spark.sh org.dataalgorithms.chapB09.charcount.spark.basic.CharCount data/chapB01/words.txt /tmp/data-algorithms/chapB09.charcount.spark.basic.CharCount/output

chapB09.charcount.spark.inmapper.CharCountInMapperCombiner

Source: CharCountInMapperCombiner.java

scripts/run_spark.sh org.dataalgorithms.chapB09.charcount.spark.inmapper.CharCountInMapperCombiner data/chapB01/words.txt /tmp/data-algorithms/chapB09.charcount.spark.inmapper.CharCountInMapperCombiner/output

chapB09.charcount.spark.localaggregation.CharCountLocalAggregation

Source: CharCountLocalAggregation.java

scripts/run_spark.sh org.dataalgorithms.chapB09.charcount.spark.localaggregation.CharCountLocalAggregation data/chapB01/words.txt /tmp/data-algorithms/chapB09.charcount.spark.localaggregation.CharCountLocalAggregation/output

MapReduce (Hadoop)

chapB09.charcount.mapreduce.basic.CharCountDriver

Source: CharCountDriver.java

scripts/run_mapreduce.sh org.dataalgorithms.chapB09.charcount.mapreduce.basic.CharCountDriver data/chapB01/words.txt /tmp/data-algorithms/chapB09.charcount.mapreduce.basic.CharCountDriver/output

chapB09.charcount.mapreduce.inmapper.CharCountInMapperCombinerDriver

Source: CharCountInMapperCombinerDriver.java

scripts/run_mapreduce.sh org.dataalgorithms.chapB09.charcount.mapreduce.inmapper.CharCountInMapperCombinerDriver data/chapB01/words.txt /tmp/data-algorithms/chapB09.charcount.mapreduce.inmapper.CharCountInMapperCombinerDriver/output

chapB09.charcount.mapreduce.localaggregation.CharCountLocalAggregationDriver

Source: CharCountLocalAggregationDriver.java

scripts/run_mapreduce.sh org.dataalgorithms.chapB09.charcount.mapreduce.localaggregation.CharCountLocalAggregationDriver data/chapB01/words.txt /tmp/data-algorithms/chapB09.charcount.mapreduce.localaggregation.CharCountLocalAggregationDriver/output