Chapter 1: Secondary Sort: Introduction¶
Programs of chapter 1 of the book Data Algorithms (O'Reilly, 2015), running on Spark 4.3.0.
Chapter notes: chap01 · chap01/scala
Sample input: resource/time_series.txt · src/main/java/org/dataalgorithms/chap01/spark/sample_input.txt
Run the commands from the repository folder after building the jar (Running the programs).
Spark (Java)¶
chap01.spark.RepartitionAndSortWithinPartitionsExample1¶
Source: RepartitionAndSortWithinPartitionsExample1.java
scripts/run_spark.sh org.dataalgorithms.chap01.spark.RepartitionAndSortWithinPartitionsExample1
chap01.spark.SecondarySortUsingCombineByKey¶
Source: SecondarySortUsingCombineByKey.java
scripts/run_spark.sh org.dataalgorithms.chap01.spark.SecondarySortUsingCombineByKey resource/time_series.txt /tmp/data-algorithms/chap01.spark.SecondarySortUsingCombineByKey/output
chap01.spark.SecondarySortUsingGroupByKey¶
Source: SecondarySortUsingGroupByKey.java
scripts/run_spark.sh org.dataalgorithms.chap01.spark.SecondarySortUsingGroupByKey resource/time_series.txt /tmp/data-algorithms/chap01.spark.SecondarySortUsingGroupByKey/output
chap01.spark.SecondarySortUsingRepartitionAndSortWithinPartitions¶
Source: SecondarySortUsingRepartitionAndSortWithinPartitions.java
scripts/run_spark.sh org.dataalgorithms.chap01.spark.SecondarySortUsingRepartitionAndSortWithinPartitions 2 src/main/java/org/dataalgorithms/chap01/spark/sample_input.txt /tmp/data-algorithms/chap01.spark.SecondarySortUsingRepartitionAndSortWithinPartitions/output
Spark (Java 8 lambdas)¶
chap01.sparkwithlambda.SecondarySortUsingCombineByKey¶
Source: SecondarySortUsingCombineByKey.java
scripts/run_spark.sh org.dataalgorithms.chap01.sparkwithlambda.SecondarySortUsingCombineByKey resource/time_series.txt /tmp/data-algorithms/chap01.sparkwithlambda.SecondarySortUsingCombineByKey/output
chap01.sparkwithlambda.SecondarySortUsingGroupByKey¶
Source: SecondarySortUsingGroupByKey.java
scripts/run_spark.sh org.dataalgorithms.chap01.sparkwithlambda.SecondarySortUsingGroupByKey resource/time_series.txt /tmp/data-algorithms/chap01.sparkwithlambda.SecondarySortUsingGroupByKey/output
Spark (Scala)¶
chap01.scala.SecondarySort¶
Source: SecondarySort.scala
scripts/run_spark.sh org.dataalgorithms.chap01.scala.SecondarySort 2 resource/time_series.txt /tmp/data-algorithms/chap01.scala.SecondarySort/output
PySpark¶
SparkSecondarySort.py¶
Source: SparkSecondarySort.py
spark-submit src/python/chap01/SparkSecondarySort.py "local[*]" resource/time_series.txt
MapReduce (Hadoop)¶
chap01.mapreduce.SecondarySortDriver¶
Source: SecondarySortDriver.java
scripts/run_mapreduce.sh org.dataalgorithms.chap01.mapreduce.SecondarySortDriver src/main/java/org/dataalgorithms/chap01/spark/sample_input.txt /tmp/data-algorithms/chap01.mapreduce.SecondarySortDriver/output