Difference between revisions of "MapReduce Frameworks Lab"
Line 1: | Line 1: | ||
− | =class StudentIndividualMapContext= | + | =Part 1 Simple Framework= |
+ | ==class StudentIndividualMapContext== | ||
public void emit(K key, V value) | public void emit(K key, V value) | ||
− | =Word Count Application= | + | ==Word Count Application== |
− | ==class WordCountMapper== | + | ===class WordCountMapper=== |
public void map(MapContext<String, Integer> context, String[] lineOfWords) | public void map(MapContext<String, Integer> context, String[] lineOfWords) | ||
− | ==class WordCountReducer== | + | ===class WordCountReducer=== |
public FinishAccumulator<Integer> createAccumulator() | public FinishAccumulator<Integer> createAccumulator() | ||
− | ==Test== | + | ===Test=== |
class TestWordCountApplicationWithInstructorFramework | class TestWordCountApplicationWithInstructorFramework | ||
− | =Mutual Friends Application= | + | ==Mutual Friends Application== |
− | ==class MutualFriendsMapper== | + | ===class MutualFriendsMapper=== |
public void map(MapContext<OrderedPair<AccountId>, List<AccountId>> context, Account account) | public void map(MapContext<OrderedPair<AccountId>, List<AccountId>> context, Account account) | ||
− | ==class MutualFriendsReducer== | + | ===class MutualFriendsReducer=== |
public FinishAccumulator<List<AccountId>> createAccumulator() | public FinishAccumulator<List<AccountId>> createAccumulator() | ||
− | ==Test== | + | ===Test=== |
class TestMutualFriendsApplicationWithInstructorFramework | class TestMutualFriendsApplicationWithInstructorFramework | ||
− | =class WordCountConcreteStaticMapReduce (optional but encouraged)= | + | ==class WordCountConcreteStaticMapReduce (optional but encouraged)== |
− | ==mapAll== | + | ===mapAll=== |
private static IndividualMapContext<String, Integer>[] mapAll(String[][] S, WordCountMapper mapper) throws SuspendableException | private static IndividualMapContext<String, Integer>[] mapAll(String[][] S, WordCountMapper mapper) throws SuspendableException | ||
− | ==groupAll== | + | ===groupAll=== |
private static Map<String, List<Integer>> groupAll(IndividualMapContext<String, Integer>[] f_of_S) | private static Map<String, List<Integer>> groupAll(IndividualMapContext<String, Integer>[] f_of_S) | ||
− | ==reduceAll== | + | ===reduceAll=== |
private static Map<String, Integer> reduceAll(Map<String, List<Integer>> grouped_f_of_S, WordCountReducer reducer) throws SuspendableException | private static Map<String, Integer> reduceAll(Map<String, List<Integer>> grouped_f_of_S, WordCountReducer reducer) throws SuspendableException | ||
− | ==Test== | + | ===Test=== |
class TestWordCountConcreteStaticFramework | class TestWordCountConcreteStaticFramework | ||
− | =class MutualFriendsConcreteStaticMapReduce (optional but encouraged)= | + | ==class MutualFriendsConcreteStaticMapReduce (optional but encouraged)== |
− | ==mapAll== | + | ===mapAll=== |
private static IndividualMapContext<OrderedPair<AccountId>, List<AccountId>>[] mapAll(Account[] S, MutualFriendsMapper mapper) throws SuspendableException | private static IndividualMapContext<OrderedPair<AccountId>, List<AccountId>>[] mapAll(Account[] S, MutualFriendsMapper mapper) throws SuspendableException | ||
− | ==groupAll== | + | ===groupAll=== |
private static Map<OrderedPair<AccountId>, List<List<AccountId>>> groupAll(IndividualMapContext<OrderedPair<AccountId>, List<AccountId>>[] f_of_S) | private static Map<OrderedPair<AccountId>, List<List<AccountId>>> groupAll(IndividualMapContext<OrderedPair<AccountId>, List<AccountId>>[] f_of_S) | ||
− | ==reduceAll== | + | ===reduceAll=== |
private static Map<OrderedPair<AccountId>, List<AccountId>> reduceAll(Map<OrderedPair<AccountId>, List<List<AccountId>>> grouped_f_of_S, MutualFriendsReducer reducer) throws SuspendableException | private static Map<OrderedPair<AccountId>, List<AccountId>> reduceAll(Map<OrderedPair<AccountId>, List<List<AccountId>>> grouped_f_of_S, MutualFriendsReducer reducer) throws SuspendableException | ||
− | ==Test== | + | ===Test=== |
class TestMutualFriendsConcreteStaticFramework | class TestMutualFriendsConcreteStaticFramework | ||
− | =Generic SimpleMapReduceFramework= | + | ==Generic SimpleMapReduceFramework== |
− | ==mapAll== | + | ===mapAll=== |
private IndividualMapContext<K,V>[] mapAll(E[] S, Mapper<E,K,V> mapper) throws SuspendableException | private IndividualMapContext<K,V>[] mapAll(E[] S, Mapper<E,K,V> mapper) throws SuspendableException | ||
− | ==groupAll== | + | ===groupAll=== |
private Map<K, List<V>> groupAll(IndividualMapContext<K,V>[] f_of_S) | private Map<K, List<V>> groupAll(IndividualMapContext<K,V>[] f_of_S) | ||
− | ==reduceAll== | + | ===reduceAll=== |
private Map<K, V> reduceAll(Map<K, List<V>> grouped_f_of_S, Reducer<V> reducer) throws SuspendableException | private Map<K, V> reduceAll(Map<K, List<V>> grouped_f_of_S, Reducer<V> reducer) throws SuspendableException | ||
− | ==Test== | + | ===Test=== |
class TestMutualFriendsSolution | class TestMutualFriendsSolution |
Revision as of 23:07, 27 February 2017
Contents
- 1 Part 1 Simple Framework
Part 1 Simple Framework
class StudentIndividualMapContext
public void emit(K key, V value)
Word Count Application
class WordCountMapper
public void map(MapContext<String, Integer> context, String[] lineOfWords)
class WordCountReducer
public FinishAccumulator<Integer> createAccumulator()
Test
class TestWordCountApplicationWithInstructorFramework
Mutual Friends Application
class MutualFriendsMapper
public void map(MapContext<OrderedPair<AccountId>, List<AccountId>> context, Account account)
class MutualFriendsReducer
public FinishAccumulator<List<AccountId>> createAccumulator()
Test
class TestMutualFriendsApplicationWithInstructorFramework
class WordCountConcreteStaticMapReduce (optional but encouraged)
mapAll
private static IndividualMapContext<String, Integer>[] mapAll(String[][] S, WordCountMapper mapper) throws SuspendableException
groupAll
private static Map<String, List<Integer>> groupAll(IndividualMapContext<String, Integer>[] f_of_S)
reduceAll
private static Map<String, Integer> reduceAll(Map<String, List<Integer>> grouped_f_of_S, WordCountReducer reducer) throws SuspendableException
Test
class TestWordCountConcreteStaticFramework
class MutualFriendsConcreteStaticMapReduce (optional but encouraged)
mapAll
private static IndividualMapContext<OrderedPair<AccountId>, List<AccountId>>[] mapAll(Account[] S, MutualFriendsMapper mapper) throws SuspendableException
groupAll
private static Map<OrderedPair<AccountId>, List<List<AccountId>>> groupAll(IndividualMapContext<OrderedPair<AccountId>, List<AccountId>>[] f_of_S)
reduceAll
private static Map<OrderedPair<AccountId>, List<AccountId>> reduceAll(Map<OrderedPair<AccountId>, List<List<AccountId>>> grouped_f_of_S, MutualFriendsReducer reducer) throws SuspendableException
Test
class TestMutualFriendsConcreteStaticFramework
Generic SimpleMapReduceFramework
mapAll
private IndividualMapContext<K,V>[] mapAll(E[] S, Mapper<E,K,V> mapper) throws SuspendableException
groupAll
private Map<K, List<V>> groupAll(IndividualMapContext<K,V>[] f_of_S)
reduceAll
private Map<K, V> reduceAll(Map<K, List<V>> grouped_f_of_S, Reducer<V> reducer) throws SuspendableException
Test
class TestMutualFriendsSolution