S
- Single value type, objects passed on workersR
- Reduced value typepublic class ArrayReduce<S,R extends org.apache.hadoop.io.Writable> extends Object implements ReduceOperation<org.apache.commons.lang3.tuple.Pair<PrimitiveRefs.IntRef,S>,ArrayWritable<R>>
Constructor and Description |
---|
ArrayReduce() |
ArrayReduce(int fixedSize,
ReduceOperation<S,R> elementReduceOp)
Create ReduceOperation that reduces arrays by reducing individual
elements.
|
Modifier and Type | Method and Description |
---|---|
static <S,T extends org.apache.hadoop.io.Writable> |
createArrayHandles(int fixedSize,
ReduceOperation<S,T> elementReduceOp,
CreateReducersApi.CreateReducerFunctionApi createFunction)
Registers one new reducer, that will reduce array of objects,
by reducing individual elements using
elementReduceOp . |
ArrayWritable<R> |
createInitialValue()
Return new reduced value which is neutral to reduce operation.
|
void |
readFields(DataInput in) |
ArrayWritable<R> |
reduce(ArrayWritable<R> curValue,
org.apache.commons.lang3.tuple.Pair<PrimitiveRefs.IntRef,S> valueToReduce)
Add a new value.
|
ArrayWritable<R> |
reduceMerge(ArrayWritable<R> curValue,
ArrayWritable<R> valueToReduce)
Add partially reduced value to current partially reduced value.
|
void |
write(DataOutput out) |
public ArrayReduce()
public ArrayReduce(int fixedSize, ReduceOperation<S,R> elementReduceOp)
fixedSize
- Number of elementselementReduceOp
- ReduceOperation for individual elementspublic static <S,T extends org.apache.hadoop.io.Writable> ReducerArrayHandle<S,T> createArrayHandles(int fixedSize, ReduceOperation<S,T> elementReduceOp, CreateReducersApi.CreateReducerFunctionApi createFunction)
elementReduceOp
.
This function will return ReducerArrayHandle to it, by which
individual elements can be manipulated separately.fixedSize
- Number of elementselementReduceOp
- ReduceOperation for individual elementscreateFunction
- Function for creating a reducerpublic ArrayWritable<R> createInitialValue()
ReduceOperation
createInitialValue
in interface ReduceOperation<org.apache.commons.lang3.tuple.Pair<PrimitiveRefs.IntRef,S>,ArrayWritable<R extends org.apache.hadoop.io.Writable>>
public ArrayWritable<R> reduce(ArrayWritable<R> curValue, org.apache.commons.lang3.tuple.Pair<PrimitiveRefs.IntRef,S> valueToReduce)
ReduceOperation
reduce
in interface ReduceOperation<org.apache.commons.lang3.tuple.Pair<PrimitiveRefs.IntRef,S>,ArrayWritable<R extends org.apache.hadoop.io.Writable>>
curValue
- Partial value into which to reduce and store the resultvalueToReduce
- Single value to be reducedpublic ArrayWritable<R> reduceMerge(ArrayWritable<R> curValue, ArrayWritable<R> valueToReduce)
ReduceOperation
reduceMerge
in interface ReduceOperation<org.apache.commons.lang3.tuple.Pair<PrimitiveRefs.IntRef,S>,ArrayWritable<R extends org.apache.hadoop.io.Writable>>
curValue
- Partial value into which to reduce and store the resultvalueToReduce
- Partial value to be reducedpublic void write(DataOutput out) throws IOException
write
in interface org.apache.hadoop.io.Writable
IOException
public void readFields(DataInput in) throws IOException
readFields
in interface org.apache.hadoop.io.Writable
IOException
Copyright © 2011-2020 The Apache Software Foundation. All Rights Reserved.