Skip to content

Chapter 8: Common Friends

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

Chapter notes: chap08

Sample input: data/chap08/friends.txt ยท data/chap08/friends_mapreduce.txt

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

Spark (Java)

chap08.spark.FindCommonFriends

Source: FindCommonFriends.java

scripts/run_spark.sh org.dataalgorithms.chap08.spark.FindCommonFriends data/chap08/friends.txt

Spark (Java 8 lambdas)

chap08.sparkwithlambda.FindCommonFriends

Source: FindCommonFriends.java

scripts/run_spark.sh org.dataalgorithms.chap08.sparkwithlambda.FindCommonFriends data/chap08/friends.txt

Spark (Scala)

chap08.scala.FindCommonFriends

Source: FindCommonFriends.scala

scripts/run_spark.sh org.dataalgorithms.chap08.scala.FindCommonFriends data/chap08/friends.txt /tmp/data-algorithms/chap08.scala.FindCommonFriends/output

MapReduce (Hadoop)

chap08.mapreduce.CommonFriendsDriver

Source: CommonFriendsDriver.java

scripts/run_mapreduce.sh org.dataalgorithms.chap08.mapreduce.CommonFriendsDriver data/chap08/friends_mapreduce.txt /tmp/data-algorithms/chap08.mapreduce.CommonFriendsDriver/output

chap08.mapreduce.CommonFriendsDriverUsingList

Source: CommonFriendsDriverUsingList.java

scripts/run_mapreduce.sh org.dataalgorithms.chap08.mapreduce.CommonFriendsDriverUsingList data/chap08/friends_mapreduce.txt /tmp/data-algorithms/chap08.mapreduce.CommonFriendsDriverUsingList/output