MapReduce.MapEmitter<K,V>, MapReduce.NullObject, MapReduce.ReduceEmitter<OK,OV>, MapReduce.Stage
MAP_REDUCE
Constructor and Description |
---|
MapReduceB() |
Modifier and Type | Method and Description |
---|---|
boolean |
doStage(MapReduce.Stage stage)
A MapReduce job can be map-only, map-reduce-only, or map-combine-reduce.
|
List<Integer> |
generateFinalResult(Iterator<KeyValue<Integer,Integer>> keyValues)
The key/value pairs emitted by reduce() (or map() in a map-only job) can be iterated to generate a local JVM Java object.
|
String |
getMemoryKey()
The results of the MapReduce job are associated with a memory-key to ultimately be stored in
Memory . |
Optional<Comparator<Integer>> |
getReduceKeySort()
If a
Comparator is provided, then all pairs leaving the MapReduce.ReduceEmitter are sorted. |
void |
map(Vertex vertex,
MapReduce.MapEmitter<Integer,Integer> emitter)
The map() method is logically executed at all vertices in the graph in parallel.
|
void |
reduce(Integer key,
Iterator<Integer> values,
MapReduce.ReduceEmitter<Integer,Integer> emitter)
The reduce() method is logically on the "machine" the respective key hashes to.
|
clone, equals, hashCode, storeState, toString
finalize, getClass, notify, notifyAll, wait, wait, wait
addResultToMemory, combine, createMapReduce, getMapKeySort, loadState, workerEnd, workerStart
public boolean doStage(MapReduce.Stage stage)
MapReduce
stage
- the stage to check for definition.public void map(Vertex vertex, MapReduce.MapEmitter<Integer,Integer> emitter)
MapReduce
MapReduce
classes must at least provide an implementation of MapReduce#map(Vertex, MapEmitter)
.vertex
- the current vertex being map() processed.emitter
- the component that allows for key/value pairs to be emitted to the next stage.public void reduce(Integer key, Iterator<Integer> values, MapReduce.ReduceEmitter<Integer,Integer> emitter)
MapReduce
key
- the key that has aggregated valuesvalues
- the aggregated values associated with the keyemitter
- the component that allows for key/value pairs to be emitted as the final result.public Optional<Comparator<Integer>> getReduceKeySort()
MapReduce
Comparator
is provided, then all pairs leaving the MapReduce.ReduceEmitter
are sorted.
If sorting is not required, then Optional.empty()
should be returned as sorting is computationally expensive.
The default implementation returns Optional.empty()
.Optional
of a comparator for sorting the reduce output.public String getMemoryKey()
MapReduce
Memory
.public List<Integer> generateFinalResult(Iterator<KeyValue<Integer,Integer>> keyValues)
MapReduce
keyValues
- the key/value pairs that were emitted from reduce() (or map() in a map-only job)Copyright © 2013–2022 Apache Software Foundation. All rights reserved.