S
- Single value typeR
- Reduced value typepublic class BasicArrayReduce<S,R extends org.apache.hadoop.io.Writable> extends Object implements ReduceOperation<org.apache.commons.lang3.tuple.Pair<PrimitiveRefs.IntRef,S>,WArrayList<R>>
Constructor and Description |
---|
BasicArrayReduce() |
BasicArrayReduce(int fixedSize,
PrimitiveTypeOps<R> typeOps,
ReduceOperation<S,R> elementReduceOp)
Create ReduceOperation that reduces BasicArrays by reducing individual
elements, with predefined size.
|
BasicArrayReduce(PrimitiveTypeOps<R> typeOps,
ReduceOperation<S,R> elementReduceOp)
Create ReduceOperation that reduces BasicArrays by reducing individual
elements, with unbounded size.
|
Modifier and Type | Method and Description |
---|---|
static <S,R extends org.apache.hadoop.io.Writable> |
createArrayHandles(int fixedSize,
PrimitiveTypeOps<R> typeOps,
ReduceOperation<S,R> elementReduceOp,
CreateReducersApi.CreateReducerFunctionApi createFunction)
Registers one new reducer, that will reduce BasicArray,
by reducing individual elements using
elementReduceOp ,
with predefined size. |
static <S,R extends org.apache.hadoop.io.Writable> |
createArrayHandles(PrimitiveTypeOps<R> typeOps,
ReduceOperation<S,R> elementReduceOp,
CreateReducersApi.CreateReducerFunctionApi createFunction)
Registers one new reducer, that will reduce BasicArray,
by reducing individual elements using
elementReduceOp ,
with unbounded size. |
WArrayList<R> |
createInitialValue()
Return new reduced value which is neutral to reduce operation.
|
static <S,R extends org.apache.hadoop.io.Writable> |
createLocalArrayHandles(int fixedSize,
PrimitiveTypeOps<R> typeOps,
ReduceOperation<S,R> elementReduceOp,
CreateReducersApi reduceApi)
Registers one new local reducer, that will reduce BasicArray,
by reducing individual elements using
elementReduceOp ,
with predefined size. |
static <S,R extends org.apache.hadoop.io.Writable> |
createLocalArrayHandles(PrimitiveTypeOps<R> typeOps,
ReduceOperation<S,R> elementReduceOp,
CreateReducersApi reduceApi)
Registers one new local reducer, that will reduce BasicArray,
by reducing individual elements using
elementReduceOp ,
with unbounded size. |
void |
readFields(DataInput in) |
WArrayList<R> |
reduce(WArrayList<R> curValue,
org.apache.commons.lang3.tuple.Pair<PrimitiveRefs.IntRef,S> valueToReduce)
Add a new value.
|
WArrayList<R> |
reduceMerge(WArrayList<R> curValue,
WArrayList<R> valueToReduce)
Add partially reduced value to current partially reduced value.
|
void |
write(DataOutput out) |
public BasicArrayReduce()
public BasicArrayReduce(int fixedSize, PrimitiveTypeOps<R> typeOps, ReduceOperation<S,R> elementReduceOp)
fixedSize
- Number of elementstypeOps
- TypeOps of individual elementselementReduceOp
- ReduceOperation for individual elementspublic BasicArrayReduce(PrimitiveTypeOps<R> typeOps, ReduceOperation<S,R> elementReduceOp)
typeOps
- TypeOps of individual elementselementReduceOp
- ReduceOperation for individual elementspublic static <S,R extends org.apache.hadoop.io.Writable> ReducerArrayHandle<S,R> createLocalArrayHandles(PrimitiveTypeOps<R> typeOps, ReduceOperation<S,R> elementReduceOp, CreateReducersApi reduceApi)
elementReduceOp
,
with unbounded size.
This function will return ReducerArrayHandle, by which
individual elements can be manipulated separately.typeOps
- TypeOps of individual elementselementReduceOp
- ReduceOperation for individual elementsreduceApi
- API for creating reducerspublic static <S,R extends org.apache.hadoop.io.Writable> ReducerArrayHandle<S,R> createLocalArrayHandles(int fixedSize, PrimitiveTypeOps<R> typeOps, ReduceOperation<S,R> elementReduceOp, CreateReducersApi reduceApi)
elementReduceOp
,
with predefined size.
This function will return ReducerArrayHandle, by which
individual elements can be manipulated separately.fixedSize
- Number of elementstypeOps
- TypeOps of individual elementselementReduceOp
- ReduceOperation for individual elementsreduceApi
- API for creating reducerspublic static <S,R extends org.apache.hadoop.io.Writable> ReducerArrayHandle<S,R> createArrayHandles(PrimitiveTypeOps<R> typeOps, ReduceOperation<S,R> elementReduceOp, CreateReducersApi.CreateReducerFunctionApi createFunction)
elementReduceOp
,
with unbounded size.
This function will return ReducerArrayHandle, by which
individual elements can be manipulated separately.typeOps
- TypeOps of individual elementselementReduceOp
- ReduceOperation for individual elementscreateFunction
- Function for creating a reducerpublic static <S,R extends org.apache.hadoop.io.Writable> ReducerArrayHandle<S,R> createArrayHandles(int fixedSize, PrimitiveTypeOps<R> typeOps, ReduceOperation<S,R> elementReduceOp, CreateReducersApi.CreateReducerFunctionApi createFunction)
elementReduceOp
,
with predefined size.
This function will return ReducerArrayHandle, by which
individual elements can be manipulated separately.fixedSize
- Number of elementstypeOps
- TypeOps of individual elementselementReduceOp
- ReduceOperation for individual elementscreateFunction
- Function for creating a reducerpublic WArrayList<R> createInitialValue()
ReduceOperation
createInitialValue
in interface ReduceOperation<org.apache.commons.lang3.tuple.Pair<PrimitiveRefs.IntRef,S>,WArrayList<R extends org.apache.hadoop.io.Writable>>
public WArrayList<R> reduce(WArrayList<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>,WArrayList<R extends org.apache.hadoop.io.Writable>>
curValue
- Partial value into which to reduce and store the resultvalueToReduce
- Single value to be reducedpublic WArrayList<R> reduceMerge(WArrayList<R> curValue, WArrayList<R> valueToReduce)
ReduceOperation
reduceMerge
in interface ReduceOperation<org.apache.commons.lang3.tuple.Pair<PrimitiveRefs.IntRef,S>,WArrayList<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.