Class MatrixMapReduceFramework<E,K,V,A,R>
java.lang.Object
mapreduce.framework.matrix.exercise.MatrixMapReduceFramework<E,K,V,A,R>
- All Implemented Interfaces:
MapReduceFramework<E,K, V, A, R>
@Immutable
public class MatrixMapReduceFramework<E,K,V,A,R>
extends Object
implements MapReduceFramework<E,K,V,A,R>
A MapReduce framework that uses a matrix to organize its keys and associated
mutable containers of values. Unlike the BottleneckedMapReduceFramework, this
class does not require the accumulation stage to run sequentially. It gets
around the issue by creating a whole matrix of
Maps, where each row
is assigned to a map task, and each column is later assigned to a reduce
task.
The mapAndAccumulateAll(Object[]) method slices up the input and
maps each slice to one row, accumulating as it goes. It places items into the
correct column based on the hashCode of the key. Then, the
combineAndReduceAll(Map[][]) method combines the mutable result
containers from the various map tasks, and finishes them to the reduced
values.
- Author:
- __STUDENT_NAME__, Finn Voichick, Dennis Cosgrove
-
Constructor Summary
ConstructorsConstructorDescriptionMatrixMapReduceFramework(Mapper<E, K, V> mapper, AccumulatorCombinerReducer<V, A, R> accumulatorCombinerReducer, int mapAndAccumulateTaskCount, int combineAndReduceTaskCount, ToIntFunction<K> hashFunction) -
Method Summary
-
Constructor Details
-
MatrixMapReduceFramework
public MatrixMapReduceFramework(Mapper<E, K, V> mapper, AccumulatorCombinerReducer<V, A, R> accumulatorCombinerReducer, int mapAndAccumulateTaskCount, int combineAndReduceTaskCount, ToIntFunction<K> hashFunction)
-
-
Method Details
-
mapper
-
accumulatorCombinerReducer
- Specified by:
accumulatorCombinerReducerin interfaceMapReduceFramework<E,K, V, A, R>
-
mapAndAccumulateTaskCount
public int mapAndAccumulateTaskCount() -
combineAndReduceTaskCount
public int combineAndReduceTaskCount() -
hashFunction
-
mapReduceAll
- Specified by:
mapReduceAllin interfaceMapReduceFramework<E,K, V, A, R> - Throws:
InterruptedExceptionExecutionException
-