Package org.apache.flink.util
Class Utils.CollectHelper<T>
- java.lang.Object
-
- org.apache.flink.api.common.io.RichOutputFormat<T>
-
- org.apache.flink.util.Utils.CollectHelper<T>
-
- Type Parameters:
T
- Type of elements to count.
- All Implemented Interfaces:
Serializable
,OutputFormat<T>
- Enclosing class:
- Utils
public static class Utils.CollectHelper<T> extends RichOutputFormat<T>
Utility sink function that collects elements into an accumulator, from which it they can be retrieved by the client. This sink is used by theDataSet#collect()
function.- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.flink.api.common.io.OutputFormat
OutputFormat.InitializationContext
-
-
Constructor Summary
Constructors Constructor Description CollectHelper(String id, TypeSerializer<T> serializer)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Method that marks the end of the life-cycle of parallel output instance.void
configure(Configuration parameters)
Configures this output format.void
open(OutputFormat.InitializationContext context)
Opens a parallel instance of the output format to store the result of its parallel instance.void
writeRecord(T record)
Adds a record to the output.-
Methods inherited from class org.apache.flink.api.common.io.RichOutputFormat
getRuntimeContext, setRuntimeContext
-
-
-
-
Constructor Detail
-
CollectHelper
public CollectHelper(String id, TypeSerializer<T> serializer)
-
-
Method Detail
-
configure
public void configure(Configuration parameters)
Description copied from interface:OutputFormat
Configures this output format. Since output formats are instantiated generically and hence parameterless, this method is the place where the output formats set their basic fields based on configuration values.This method is always called first on a newly instantiated output format.
- Parameters:
parameters
- The configuration with all parameters.
-
open
public void open(OutputFormat.InitializationContext context)
Description copied from interface:OutputFormat
Opens a parallel instance of the output format to store the result of its parallel instance.When this method is called, the output format it guaranteed to be configured.
- Parameters:
context
- The context to get task parallel infos.
-
writeRecord
public void writeRecord(T record) throws IOException
Description copied from interface:OutputFormat
Adds a record to the output.When this method is called, the output format it guaranteed to be opened.
- Parameters:
record
- The records to add to the output.- Throws:
IOException
- Thrown, if the records could not be added due to an I/O problem.
-
close
public void close()
Description copied from interface:OutputFormat
Method that marks the end of the life-cycle of parallel output instance. Should be used to close channels and streams and release resources. After this method returns without an error, the output is assumed to be correct.When this method is called, the output format it guaranteed to be opened.
-
-