T
- Type of elements to count.public static class Utils.CountHelper<T> extends RichOutputFormat<T>
DataSet.count()
function.OutputFormat.InitializationContext
Constructor and Description |
---|
CountHelper(String id) |
Modifier and Type | Method and 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(int taskNumber,
int numTasks)
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.
|
getRuntimeContext, setRuntimeContext
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
open
public CountHelper(String id)
public void configure(Configuration parameters)
OutputFormat
This method is always called first on a newly instantiated output format.
parameters
- The configuration with all parameters.public void open(int taskNumber, int numTasks)
OutputFormat
When this method is called, the output format it guaranteed to be configured.
taskNumber
- The number of the parallel instance.numTasks
- The number of parallel tasks.public void writeRecord(T record)
OutputFormat
When this method is called, the output format it guaranteed to be opened.
record
- The records to add to the output.public void close()
OutputFormat
When this method is called, the output format it guaranteed to be opened.
Copyright © 2014–2024 The Apache Software Foundation. All rights reserved.