Class SerializedListAccumulator<T>
- java.lang.Object
-
- org.apache.flink.api.common.accumulators.SerializedListAccumulator<T>
-
- Type Parameters:
T- The type of the accumulated objects
- All Implemented Interfaces:
Serializable,Cloneable,Accumulator<T,ArrayList<byte[]>>
@PublicEvolving public class SerializedListAccumulator<T> extends Object implements Accumulator<T,ArrayList<byte[]>>
This accumulator stores a collection of objects in serialized form, so that the stored objects are not affected by modifications to the original objects.Objects may be deserialized on demand with a specific classloader.
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description SerializedListAccumulator()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(T value)voidadd(T value, TypeSerializer<T> serializer)SerializedListAccumulator<T>clone()Duplicates the accumulator.static <T> List<T>deserializeList(ArrayList<byte[]> data, TypeSerializer<T> serializer)ArrayList<byte[]>getLocalValue()voidmerge(Accumulator<T,ArrayList<byte[]>> other)Used by system internally to merge the collected parts of an accumulator at the end of the job.voidresetLocal()Reset the local value.StringtoString()
-
-
-
Method Detail
-
add
public void add(T value)
- Specified by:
addin interfaceAccumulator<T,ArrayList<byte[]>>- Parameters:
value- The value to add to the accumulator object
-
add
public void add(T value, TypeSerializer<T> serializer) throws IOException
- Throws:
IOException
-
getLocalValue
public ArrayList<byte[]> getLocalValue()
- Specified by:
getLocalValuein interfaceAccumulator<T,ArrayList<byte[]>>- Returns:
- local The local value from the current UDF context
-
resetLocal
public void resetLocal()
Description copied from interface:AccumulatorReset the local value. This only affects the current UDF context.- Specified by:
resetLocalin interfaceAccumulator<T,ArrayList<byte[]>>
-
merge
public void merge(Accumulator<T,ArrayList<byte[]>> other)
Description copied from interface:AccumulatorUsed by system internally to merge the collected parts of an accumulator at the end of the job.- Specified by:
mergein interfaceAccumulator<T,ArrayList<byte[]>>- Parameters:
other- Reference to accumulator to merge in.
-
clone
public SerializedListAccumulator<T> clone()
Description copied from interface:AccumulatorDuplicates the accumulator. All subclasses need to properly implement cloning and cannot throw aCloneNotSupportedException
-
deserializeList
public static <T> List<T> deserializeList(ArrayList<byte[]> data, TypeSerializer<T> serializer) throws IOException, ClassNotFoundException
- Throws:
IOExceptionClassNotFoundException
-
-