Skip to content

Chapter 5: Order Inversion

Programs of chapter 5 of the book Data Algorithms (O'Reilly, 2015), running on Spark 4.3.0.

Chapter notes: chap05 ยท chap05/scala

Sample input: data/chap05/sentences.txt

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

Spark (Java)

chap05.spark.RelativeFrequency

Source: RelativeFrequency.java

scripts/run_spark.sh org.dataalgorithms.chap05.spark.RelativeFrequency 2 data/chap05/sentences.txt /tmp/data-algorithms/chap05.spark.RelativeFrequency/output

chap05.spark.SparkSQLRelativeFrequency

Source: SparkSQLRelativeFrequency.java

scripts/run_spark.sh org.dataalgorithms.chap05.spark.SparkSQLRelativeFrequency 2 data/chap05/sentences.txt /tmp/data-algorithms/chap05.spark.SparkSQLRelativeFrequency/output

Spark (Scala)

chap05.scala.RelativeFrequency

Source: RelativeFrequency.scala

scripts/run_spark.sh org.dataalgorithms.chap05.scala.RelativeFrequency 2 data/chap05/sentences.txt /tmp/data-algorithms/chap05.scala.RelativeFrequency/output

chap05.scala.SparkSQLRelativeFrequency

Source: SparkSQLRelativeFrequency.scala

scripts/run_spark.sh org.dataalgorithms.chap05.scala.SparkSQLRelativeFrequency 2 data/chap05/sentences.txt /tmp/data-algorithms/chap05.scala.SparkSQLRelativeFrequency/output

MapReduce (Hadoop)

chap05.mapreduce.RelativeFrequencyDriver

Source: RelativeFrequencyDriver.java

scripts/run_mapreduce.sh org.dataalgorithms.chap05.mapreduce.RelativeFrequencyDriver 2 data/chap05/sentences.txt /tmp/data-algorithms/chap05.mapreduce.RelativeFrequencyDriver/output