Skip to content

Chapter 4: Left Outer Join

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

Chapter notes: chap04 · chap04/scala

Sample input: src/main/scala/org/dataalgorithms/chap04/scala/transactions.tsv · src/main/scala/org/dataalgorithms/chap04/scala/users.tsv

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

Spark (Java)

chap04.spark.SparkLeftOuterJoin

Source: SparkLeftOuterJoin.java

scripts/run_spark.sh org.dataalgorithms.chap04.spark.SparkLeftOuterJoin src/main/scala/org/dataalgorithms/chap04/scala/users.tsv src/main/scala/org/dataalgorithms/chap04/scala/transactions.tsv

Spark (Java 8 lambdas)

chap04.sparkwithlambda.SparkLeftOuterJoin

Source: SparkLeftOuterJoin.java

scripts/run_spark.sh org.dataalgorithms.chap04.sparkwithlambda.SparkLeftOuterJoin src/main/scala/org/dataalgorithms/chap04/scala/users.tsv src/main/scala/org/dataalgorithms/chap04/scala/transactions.tsv

Spark (Scala)

chap04.scala.DataFrameLeftOuterJoin

Source: DataFrameLeftOuterJoin.scala

scripts/run_spark.sh org.dataalgorithms.chap04.scala.DataFrameLeftOuterJoin src/main/scala/org/dataalgorithms/chap04/scala/users.tsv src/main/scala/org/dataalgorithms/chap04/scala/transactions.tsv /tmp/data-algorithms/chap04.scala.DataFrameLeftOuterJoin/output

chap04.scala.LeftOuterJoin

Source: LeftOuterJoin.scala

scripts/run_spark.sh org.dataalgorithms.chap04.scala.LeftOuterJoin src/main/scala/org/dataalgorithms/chap04/scala/users.tsv src/main/scala/org/dataalgorithms/chap04/scala/transactions.tsv /tmp/data-algorithms/chap04.scala.LeftOuterJoin/output

chap04.scala.SparkLeftOuterJoin

Source: SparkLeftOuterJoin.scala

scripts/run_spark.sh org.dataalgorithms.chap04.scala.SparkLeftOuterJoin src/main/scala/org/dataalgorithms/chap04/scala/users.tsv src/main/scala/org/dataalgorithms/chap04/scala/transactions.tsv /tmp/data-algorithms/chap04.scala.SparkLeftOuterJoin/output

MapReduce (Hadoop)

chap04.mapreduce.LeftJoinDriver

Source: LeftJoinDriver.java

scripts/run_mapreduce.sh org.dataalgorithms.chap04.mapreduce.LeftJoinDriver src/main/scala/org/dataalgorithms/chap04/scala/transactions.tsv src/main/scala/org/dataalgorithms/chap04/scala/users.tsv /tmp/data-algorithms/chap04.mapreduce.LeftJoinDriver/output

chap04.mapreduce.LocationCountDriver

Source: LocationCountDriver.java

scripts/run_mapreduce.sh org.dataalgorithms.chap04.mapreduce.LocationCountDriver /tmp/data-algorithms/chap04.mapreduce.LeftJoinDriver/output /tmp/data-algorithms/chap04.mapreduce.LocationCountDriver/output
  • Run LeftJoinDriver first: it writes this program's input.