public class TextAggregatorWriter extends DefaultImmutableClassesGiraphConfigurable implements AggregatorWriter
AggregatorWriter. Each line consists of
text and contains the aggregator name, the aggregator value and the
aggregator class.| Modifier and Type | Field and Description |
|---|---|
static int |
ALWAYS
Signal for "write values in every superstep" frequency
|
static int |
AT_THE_END
Signal for "write only the final values" frequency
|
static String |
FILENAME
The filename of the outputfile
|
static String |
FREQUENCY
The frequency of writing:
- NEVER: never write, files aren't created at all
- AT_THE_END: aggregators are written only when the computation is over
- int: i.e.
|
static int |
NEVER
Signal for "never write" frequency
|
protected org.apache.hadoop.fs.FSDataOutputStream |
output
Handle to the outputfile
|
LAST_SUPERSTEP| Constructor and Description |
|---|
TextAggregatorWriter() |
| Modifier and Type | Method and Description |
|---|---|
protected String |
aggregatorToString(String aggregatorName,
org.apache.hadoop.io.Writable value,
long superstep)
Implements the way an aggregator is converted into a String.
|
void |
close()
The method is called at the end of a successful computation.
|
void |
initialize(org.apache.hadoop.mapreduce.Mapper.Context context,
long attempt)
The method is called at the initialization of the AggregatorWriter.
|
void |
writeAggregator(Iterable<Map.Entry<String,org.apache.hadoop.io.Writable>> aggregatorMap,
long superstep)
The method is called at the end of each superstep.
|
getConf, setConfclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetConfsetConfpublic static final String FILENAME
public static final int NEVER
public static final int AT_THE_END
public static final int ALWAYS
public static final String FREQUENCY
protected org.apache.hadoop.fs.FSDataOutputStream output
public void initialize(org.apache.hadoop.mapreduce.Mapper.Context context,
long attempt)
throws IOException
AggregatorWriterinitialize in interface AggregatorWritercontext - Mapper Context where the master is running onattempt - ID of the applicationAttempt, used to
disambiguate aggregator writes for different attemptsIOExceptionpublic void writeAggregator(Iterable<Map.Entry<String,org.apache.hadoop.io.Writable>> aggregatorMap, long superstep) throws IOException
AggregatorWriterAggregatorWriter.LAST_SUPERSTEP is passed.writeAggregator in interface AggregatorWriteraggregatorMap - Map from aggregator name to aggregator valuesuperstep - Current superstepIOExceptionprotected String aggregatorToString(String aggregatorName, org.apache.hadoop.io.Writable value, long superstep)
aggregatorName - Name of the aggregatorvalue - Value of aggregatorsuperstep - Current supersteppublic void close()
throws IOException
AggregatorWriterAggregatorWriter.writeAggregator(Iterable, long).close in interface AggregatorWriterIOExceptionCopyright © 2011-2020 The Apache Software Foundation. All Rights Reserved.