public class LambdaMapReduce<MK,MV,RK,RV,R> extends StaticMapReduce<MK,MV,RK,RV,R>
| Modifier and Type | Class and Description |
|---|---|
static class |
LambdaMapReduce.Builder<MK,MV,RK,RV,R> |
MapReduce.MapEmitter<K,V>, MapReduce.NullObject, MapReduce.ReduceEmitter<OK,OV>, MapReduce.Stage| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
COMBINE_LAMBDA |
static java.lang.String |
MAP_KEY_SORT |
static java.lang.String |
MAP_LAMBDA |
static java.lang.String |
MEMORY_KEY |
static java.lang.String |
MEMORY_LAMBDA |
static java.lang.String |
REDUCE_KEY_SORT |
static java.lang.String |
REDUCE_LAMBDA |
MAP_REDUCE| Modifier and Type | Method and Description |
|---|---|
static <MK,MV,RK,RV,R> |
build() |
void |
combine(MK key,
java.util.Iterator<MV> values,
MapReduce.ReduceEmitter<RK,RV> 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.
|
R |
generateFinalResult(java.util.Iterator<KeyValue<RK,RV>> 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.
|
java.util.Optional<java.util.Comparator<MK>> |
getMapKeySort()
If a
Comparator is provided, then all pairs leaving the MapReduce.MapEmitter are sorted. |
java.lang.String |
getMemoryKey()
The results of the MapReduce job are associated with a memory-key to ultimately be stored in
Memory. |
java.util.Optional<java.util.Comparator<RK>> |
getReduceKeySort()
If a
Comparator is provided, then all pairs leaving the MapReduce.ReduceEmitter are sorted. |
void |
loadState(org.apache.commons.configuration.Configuration configuration)
When it is necessary to load the state of a MapReduce job, this method is called.
|
void |
map(Vertex vertex,
MapReduce.MapEmitter<MK,MV> emitter)
The map() method is logically executed at all vertices in the graph in parallel.
|
void |
reduce(MK key,
java.util.Iterator<MV> values,
MapReduce.ReduceEmitter<RK,RV> emitter)
The reduce() method is logically on the "machine" the respective key hashes to.
|
void |
storeState(org.apache.commons.configuration.Configuration configuration)
When it is necessary to store the state of a MapReduce job, this method is called.
|
java.lang.String |
toString() |
cloneequals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitaddResultToMemory, createMapReducepublic static final java.lang.String MAP_LAMBDA
public static final java.lang.String MAP_KEY_SORT
public static final java.lang.String COMBINE_LAMBDA
public static final java.lang.String REDUCE_LAMBDA
public static final java.lang.String REDUCE_KEY_SORT
public static final java.lang.String MEMORY_LAMBDA
public static final java.lang.String MEMORY_KEY
public void loadState(org.apache.commons.configuration.Configuration configuration)
MapReduceconfiguration - the configuration to load the state of the MapReduce job from.public void storeState(org.apache.commons.configuration.Configuration configuration)
MapReducestoreState in interface MapReduce<MK,MV,RK,RV,R>storeState in class StaticMapReduce<MK,MV,RK,RV,R>configuration - the configuration to store the state of the MapReduce job in.public boolean doStage(MapReduce.Stage stage)
MapReducestage - the stage to check for definition.public void map(Vertex vertex, MapReduce.MapEmitter<MK,MV> emitter)
MapReducevertex - 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(MK key, java.util.Iterator<MV> values, MapReduce.ReduceEmitter<RK,RV> emitter)
MapReducekey - 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(MK key, java.util.Iterator<MV> values, MapReduce.ReduceEmitter<RK,RV> emitter)
MapReducekey - 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 java.util.Optional<java.util.Comparator<MK>> getMapKeySort()
MapReduceComparator is provided, then all pairs leaving the MapReduce.MapEmitter are sorted.
The sorted results are either fed sorted to the combine/reduce-stage or as the final output.
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 map output.public java.util.Optional<java.util.Comparator<RK>> getReduceKeySort()
MapReduceComparator 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 R generateFinalResult(java.util.Iterator<KeyValue<RK,RV>> keyValues)
MapReducekeyValues - the key/value pairs that were emitted from reduce() (or map() in a map-only job)public java.lang.String getMemoryKey()
MapReduceMemory.public java.lang.String toString()
public static <MK,MV,RK,RV,R> LambdaMapReduce.Builder<MK,MV,RK,RV,R> build()
Copyright © 2013-2015 TinkerPop. All Rights Reserved.