Chapter 6: Moving Average¶
Programs of chapter 6 of the book Data Algorithms (O'Reilly, 2015), running on Spark 4.3.0.
Chapter notes: chap06/scala
Sample input: src/main/java/org/dataalgorithms/chap06/memorysort/sample.txt
Run the commands from the repository folder after building the jar (Running the programs).
Spark (Scala)¶
chap06.scala.MovingAverage¶
Source: MovingAverage.scala
scripts/run_spark.sh org.dataalgorithms.chap06.scala.MovingAverage 3 2 src/main/java/org/dataalgorithms/chap06/memorysort/sample.txt /tmp/data-algorithms/chap06.scala.MovingAverage/output
chap06.scala.MovingAverageInMemory¶
Source: MovingAverageInMemory.scala
scripts/run_spark.sh org.dataalgorithms.chap06.scala.MovingAverageInMemory 3 src/main/java/org/dataalgorithms/chap06/memorysort/sample.txt /tmp/data-algorithms/chap06.scala.MovingAverageInMemory/output
MapReduce (Hadoop)¶
chap06.memorysort.SortInMemory_MovingAverageDriver¶
Source: SortInMemory_MovingAverageDriver.java
scripts/run_mapreduce.sh org.dataalgorithms.chap06.memorysort.SortInMemory_MovingAverageDriver 3 src/main/java/org/dataalgorithms/chap06/memorysort/sample.txt /tmp/data-algorithms/chap06.memorysort.SortInMemory_MovingAverageDriver/output
chap06.secondarysort.SortByMRF_MovingAverageDriver¶
Source: SortByMRF_MovingAverageDriver.java
scripts/run_mapreduce.sh org.dataalgorithms.chap06.secondarysort.SortByMRF_MovingAverageDriver 3 src/main/java/org/dataalgorithms/chap06/memorysort/sample.txt /tmp/data-algorithms/chap06.secondarysort.SortByMRF_MovingAverageDriver/output
Java¶
chap06.pojo.TestSimpleMovingAverage¶
Source: TestSimpleMovingAverage.java
scripts/run_mapreduce.sh org.dataalgorithms.chap06.pojo.TestSimpleMovingAverage