Package org.apache.giraph.io.formats
Class TextVertexInputFormat.TextVertexReader
- java.lang.Object
-
- org.apache.giraph.conf.DefaultImmutableClassesGiraphConfigurable<I,V,E>
-
- org.apache.giraph.worker.WorkerAggregatorDelegator<I,V,E>
-
- org.apache.giraph.io.VertexReader<I,V,E>
-
- org.apache.giraph.io.formats.TextVertexInputFormat.TextVertexReader
-
- All Implemented Interfaces:
org.apache.giraph.aggregators.AggregatorUsage
,org.apache.giraph.conf.GiraphConfigurationSettable<I,V,E>
,org.apache.giraph.conf.ImmutableClassesGiraphConfigurable<I,V,E>
,org.apache.giraph.worker.WorkerAggregatorUsage
,org.apache.giraph.worker.WorkerBroadcastUsage
,org.apache.giraph.worker.WorkerGlobalCommUsage
,org.apache.giraph.worker.WorkerReduceUsage
- Direct Known Subclasses:
TextVertexInputFormat.TextVertexReaderFromEachLine
,TextVertexInputFormat.TextVertexReaderFromEachLineProcessed
,TextVertexInputFormat.TextVertexReaderFromEachLineProcessedHandlingExceptions
- Enclosing class:
- TextVertexInputFormat<I extends org.apache.hadoop.io.WritableComparable,V extends org.apache.hadoop.io.Writable,E extends org.apache.hadoop.io.Writable>
protected abstract class TextVertexInputFormat.TextVertexReader extends org.apache.giraph.io.VertexReader<I,V,E>
Abstract class to be implemented by the user based on their specific vertex input. Easiest to ignore the key value separator and only use key instead.When reading a vertex from each line, extend
TextVertexInputFormat.TextVertexReaderFromEachLine
. If you need to preprocess each line first, then extendTextVertexInputFormat.TextVertexReaderFromEachLineProcessed
. If you need common exception handling while preprocessing, then extendTextVertexInputFormat.TextVertexReaderFromEachLineProcessedHandlingExceptions
.
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
TextVertexReader()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
protected org.apache.hadoop.mapreduce.RecordReader<org.apache.hadoop.io.LongWritable,org.apache.hadoop.io.Text>
createLineRecordReader(org.apache.hadoop.mapreduce.InputSplit inputSplit, org.apache.hadoop.mapreduce.TaskAttemptContext context)
Create the line record reader.protected org.apache.hadoop.mapreduce.TaskAttemptContext
getContext()
Get the context.float
getProgress()
protected org.apache.hadoop.mapreduce.RecordReader<org.apache.hadoop.io.LongWritable,org.apache.hadoop.io.Text>
getRecordReader()
Get the line record reader.void
initialize(org.apache.hadoop.mapreduce.InputSplit inputSplit, org.apache.hadoop.mapreduce.TaskAttemptContext context)
-
Methods inherited from class org.apache.giraph.worker.WorkerAggregatorDelegator
aggregate, getAggregatedValue, getBroadcast, reduce, reduceMerge, setAggregatorManager
-
-
-
-
Method Detail
-
initialize
public void initialize(org.apache.hadoop.mapreduce.InputSplit inputSplit, org.apache.hadoop.mapreduce.TaskAttemptContext context) throws IOException, InterruptedException
- Specified by:
initialize
in classorg.apache.giraph.io.VertexReader<I extends org.apache.hadoop.io.WritableComparable,V extends org.apache.hadoop.io.Writable,E extends org.apache.hadoop.io.Writable>
- Throws:
IOException
InterruptedException
-
createLineRecordReader
protected org.apache.hadoop.mapreduce.RecordReader<org.apache.hadoop.io.LongWritable,org.apache.hadoop.io.Text> createLineRecordReader(org.apache.hadoop.mapreduce.InputSplit inputSplit, org.apache.hadoop.mapreduce.TaskAttemptContext context) throws IOException, InterruptedException
Create the line record reader. Override this to use a different underlying record reader (useful for testing).- Parameters:
inputSplit
- the split to readcontext
- the context passed to initialize- Returns:
- the record reader to be used
- Throws:
IOException
- exception that can be thrown during creationInterruptedException
- exception that can be thrown during creation
-
close
public void close() throws IOException
- Specified by:
close
in classorg.apache.giraph.io.VertexReader<I extends org.apache.hadoop.io.WritableComparable,V extends org.apache.hadoop.io.Writable,E extends org.apache.hadoop.io.Writable>
- Throws:
IOException
-
getProgress
public float getProgress() throws IOException, InterruptedException
- Specified by:
getProgress
in classorg.apache.giraph.io.VertexReader<I extends org.apache.hadoop.io.WritableComparable,V extends org.apache.hadoop.io.Writable,E extends org.apache.hadoop.io.Writable>
- Throws:
IOException
InterruptedException
-
getRecordReader
protected org.apache.hadoop.mapreduce.RecordReader<org.apache.hadoop.io.LongWritable,org.apache.hadoop.io.Text> getRecordReader()
Get the line record reader.- Returns:
- Record reader to be used for reading.
-
getContext
protected org.apache.hadoop.mapreduce.TaskAttemptContext getContext()
Get the context.- Returns:
- Context passed to initialize.
-
-