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, setConf
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getConf
setConf
public 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
AggregatorWriter
initialize
in interface AggregatorWriter
context
- Mapper Context where the master is running onattempt
- ID of the applicationAttempt, used to
disambiguate aggregator writes for different attemptsIOException
public void writeAggregator(Iterable<Map.Entry<String,org.apache.hadoop.io.Writable>> aggregatorMap, long superstep) throws IOException
AggregatorWriter
AggregatorWriter.LAST_SUPERSTEP
is passed.writeAggregator
in interface AggregatorWriter
aggregatorMap
- Map from aggregator name to aggregator valuesuperstep
- Current superstepIOException
protected 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
AggregatorWriter
AggregatorWriter.writeAggregator(Iterable, long)
.close
in interface AggregatorWriter
IOException
Copyright © 2011-2020 The Apache Software Foundation. All Rights Reserved.