public final class MemoryMapReduce extends StaticMapReduce<MapReduce.NullObject,MapMemory,MapReduce.NullObject,MapMemory,MapMemory>
MapReduce.MapEmitter<K,V>, MapReduce.NullObject, MapReduce.ReduceEmitter<OK,OV>, MapReduce.Stage
Modifier and Type | Field and Description |
---|---|
Set<String> |
memoryKeys |
MAP_REDUCE
Constructor and Description |
---|
MemoryMapReduce(Set<String> memoryKeys) |
Modifier and Type | Method and Description |
---|---|
void |
addResultToMemory(Memory.Admin memory,
Iterator<KeyValue<MapReduce.NullObject,MapMemory>> keyValues)
The final result can be generated and added to
Memory and accessible via DefaultComputerResult . |
void |
combine(MapReduce.NullObject key,
Iterator<MapMemory> values,
MapReduce.ReduceEmitter<MapReduce.NullObject,MapMemory> emitter)
The combine() method is logically executed at all "machines" in parallel.
|
boolean |
doStage(MapReduce.Stage stage)
A MapReduce job can be map-only, map-reduce-only, or map-combine-reduce.
|
boolean |
equals(Object object) |
MapMemory |
generateFinalResult(Iterator<KeyValue<MapReduce.NullObject,MapMemory>> 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 . |
int |
hashCode() |
void |
loadState(Configuration configuration)
When it is necessary to load the state of a MapReduce job, this method is called.
|
void |
map(Vertex vertex,
MapReduce.MapEmitter<MapReduce.NullObject,MapMemory> emitter)
The map() method is logically executed at all vertices in the graph in parallel.
|
void |
reduce(MapReduce.NullObject key,
Iterator<MapMemory> values,
MapReduce.ReduceEmitter<MapReduce.NullObject,MapMemory> emitter)
The reduce() method is logically on the "machine" the respective key hashes to.
|
void |
storeState(Configuration configuration)
When it is necessary to store the state of a MapReduce job, this method is called.
|
String |
toString() |
clone
finalize, getClass, notify, notifyAll, wait, wait, wait
createMapReduce, getMapKeySort, getReduceKeySort, workerEnd, workerStart
public String getMemoryKey()
MapReduce
Memory
.public void storeState(Configuration configuration)
MapReduce
storeState
in interface MapReduce<MapReduce.NullObject,MapMemory,MapReduce.NullObject,MapMemory,MapMemory>
storeState
in class StaticMapReduce<MapReduce.NullObject,MapMemory,MapReduce.NullObject,MapMemory,MapMemory>
configuration
- the configuration to store the state of the MapReduce job in.public void loadState(Configuration configuration)
MapReduce
configuration
- the configuration to load the state of the MapReduce job from.public boolean doStage(MapReduce.Stage stage)
MapReduce
stage
- the stage to check for definition.public void map(Vertex vertex, MapReduce.MapEmitter<MapReduce.NullObject,MapMemory> emitter)
MapReduce
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 combine(MapReduce.NullObject key, Iterator<MapMemory> values, MapReduce.ReduceEmitter<MapReduce.NullObject,MapMemory> 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 to the reduce stage.public void reduce(MapReduce.NullObject key, Iterator<MapMemory> values, MapReduce.ReduceEmitter<MapReduce.NullObject,MapMemory> 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 MapMemory generateFinalResult(Iterator<KeyValue<MapReduce.NullObject,MapMemory>> keyValues)
MapReduce
keyValues
- the key/value pairs that were emitted from reduce() (or map() in a map-only job)public void addResultToMemory(Memory.Admin memory, Iterator<KeyValue<MapReduce.NullObject,MapMemory>> keyValues)
MapReduce
Memory
and accessible via DefaultComputerResult
.
The default simply takes the object from generateFinalResult() and adds it to the Memory given getMemoryKey().memory
- the memory of the GraphComputer
keyValues
- the key/value pairs emitted from reduce() (or map() in a map only job).public int hashCode()
hashCode
in class StaticMapReduce<MapReduce.NullObject,MapMemory,MapReduce.NullObject,MapMemory,MapMemory>
public boolean equals(Object object)
equals
in class StaticMapReduce<MapReduce.NullObject,MapMemory,MapReduce.NullObject,MapMemory,MapMemory>
public String toString()
toString
in class StaticMapReduce<MapReduce.NullObject,MapMemory,MapReduce.NullObject,MapMemory,MapMemory>
Copyright © 2013–2015 Apache Software Foundation. All rights reserved.