public abstract class MapReduceDriverBase<K1,V1,K2,V2,K3,V3,T extends MapReduceDriverBase<K1,V1,K2,V2,K3,V3,T>> extends TestDriver<K3,V3,T>
Modifier and Type | Field and Description |
---|---|
protected List<Pair<K1,V1>> |
inputList |
protected Comparator<K2> |
keyGroupComparator
Key group comparator
|
protected Comparator<K2> |
keyValueOrderComparator
Key value order comparator
|
static org.apache.commons.logging.Log |
LOG |
protected org.apache.hadoop.fs.Path |
mapInputPath |
counterWrapper, expectedEnumCounters, expectedMultipleOutputs, expectedOutputs, expectedPathOutputs, expectedStringCounters, mos
Constructor and Description |
---|
MapReduceDriverBase() |
Modifier and Type | Method and Description |
---|---|
void |
addAll(List<Pair<K1,V1>> inputs)
Adds input to send to the mapper
|
void |
addInput(K1 key,
V1 val)
Adds an input to send to the mapper
|
void |
addInput(Pair<K1,V1> input)
Adds an input to send to the Mapper
|
void |
addInputFromString(String input)
Deprecated.
No replacement due to lack of type safety and incompatibility
with non Text Writables
|
org.apache.hadoop.fs.Path |
getMapInputPath() |
protected void |
preRunChecks(Object mapper,
Object reducer) |
abstract List<Pair<K3,V3>> |
run()
Runs the test but returns the result set instead of validating it (ignores
any addOutput(), etc calls made before this)
|
void |
setKeyGroupingComparator(org.apache.hadoop.io.RawComparator<K2> groupingComparator)
Set the key grouping comparator, similar to calling the following API calls
but passing a real instance rather than just the class:
pre 0.20.1 API:
JobConf.setOutputValueGroupingComparator(Class)
0.20.1+ API: Job.setGroupingComparatorClass(Class)
|
void |
setKeyOrderComparator(org.apache.hadoop.io.RawComparator<K2> orderComparator)
Set the key value order comparator, similar to calling the following API
calls but passing a real instance rather than just the class:
pre 0.20.1 API:
JobConf.setOutputKeyComparatorClass(Class)
0.20.1+ API: Job.setSortComparatorClass(Class)
|
void |
setMapInputPath(org.apache.hadoop.fs.Path mapInputPath) |
T |
withAll(List<Pair<K1,V1>> inputs)
Identical to addAll() but returns self for fluent programming style
|
T |
withInput(K1 key,
V1 val)
Identical to addInput() but returns self for fluent programming style
|
T |
withInput(Pair<K1,V1> input)
Identical to addInput() but returns self for fluent programming style
|
T |
withInputFromString(String input)
Deprecated.
No replacement due to lack of type safety and incompatibility
with non Text Writables
|
T |
withKeyGroupingComparator(org.apache.hadoop.io.RawComparator<K2> groupingComparator)
Identical to
setKeyGroupingComparator(RawComparator) , but with a
fluent programming style |
T |
withKeyOrderComparator(org.apache.hadoop.io.RawComparator<K2> orderComparator)
Identical to
setKeyOrderComparator(RawComparator) , but with a
fluent programming style |
T |
withMapInputPath(org.apache.hadoop.fs.Path mapInputPath) |
addAllOutput, addCacheArchive, addCacheArchive, addCacheFile, addCacheFile, addMultiOutput, addMultiOutput, addOutput, addOutput, addOutputFromString, cleanupDistributedCache, copy, copyPair, driverReused, formatPairList, formatValueList, getConfiguration, getExpectedEnumCounters, getExpectedOutputs, getExpectedStringCounters, getKeyComparator, getOutputSerializationConfiguration, getValueComparator, initDistributedCache, parseCommaDelimitedList, parseTabbedPair, printPreTestDebugLog, resetExpectedCounters, resetOutput, run, runTest, runTest, setCacheArchives, setCacheFiles, setConfiguration, setKeyComparator, setOutputSerializationConfiguration, setUsedOnceStatus, setValueComparator, thisAsTestDriver, validate, validate, validate, validateOutputList, withAllOutput, withCacheArchive, withCacheArchive, withCacheFile, withCacheFile, withConfiguration, withCounter, withCounter, withMultiOutput, withMultiOutput, withOutput, withOutput, withOutputFromString, withOutputSerializationConfiguration, withPathOutput, withPathOutput, withStrictCounterChecking
public static final org.apache.commons.logging.Log LOG
protected org.apache.hadoop.fs.Path mapInputPath
protected Comparator<K2> keyGroupComparator
protected Comparator<K2> keyValueOrderComparator
public void addInput(K1 key, V1 val)
key
- val
- public void addInput(Pair<K1,V1> input)
input
- The (k, v) pair to add to the input list.public void addAll(List<Pair<K1,V1>> inputs)
inputs
- List of (k, v) pairs to add to the input list@Deprecated public void addInputFromString(String input)
input
- A string of the form "key \t val". Trims any whitespace.public T withInput(K1 key, V1 val)
key
- val
- public T withInput(Pair<K1,V1> input)
input
- The (k, v) pair to add@Deprecated public T withInputFromString(String input)
input
- A string of the form "key \t val". Trims any whitespace.public T withAll(List<Pair<K1,V1>> inputs)
inputs
- List of (k, v) pairs to addpublic org.apache.hadoop.fs.Path getMapInputPath()
public void setMapInputPath(org.apache.hadoop.fs.Path mapInputPath)
mapInputPath
- Path which is to be passed to the mappers InputSplitpublic final T withMapInputPath(org.apache.hadoop.fs.Path mapInputPath)
mapInputPath
- The Path object which will be given to the mapperpublic abstract List<Pair<K3,V3>> run() throws IOException
TestDriver
run
in class TestDriver<K3,V3,T extends MapReduceDriverBase<K1,V1,K2,V2,K3,V3,T>>
IOException
public void setKeyGroupingComparator(org.apache.hadoop.io.RawComparator<K2> groupingComparator)
JobConf.setOutputValueGroupingComparator(Class)
Job.setGroupingComparatorClass(Class)
groupingComparator
- public void setKeyOrderComparator(org.apache.hadoop.io.RawComparator<K2> orderComparator)
JobConf.setOutputKeyComparatorClass(Class)
Job.setSortComparatorClass(Class)
orderComparator
- public T withKeyGroupingComparator(org.apache.hadoop.io.RawComparator<K2> groupingComparator)
setKeyGroupingComparator(RawComparator)
, but with a
fluent programming stylegroupingComparator
- Comparator to use in the shuffle stage for key groupingpublic T withKeyOrderComparator(org.apache.hadoop.io.RawComparator<K2> orderComparator)
setKeyOrderComparator(RawComparator)
, but with a
fluent programming styleorderComparator
- Comparator to use in the shuffle stage for key value orderingCopyright © 2014 The Apache Software Foundation. All Rights Reserved.