Class TextVertexInputFormat.TextVertexReaderFromEachLineProcessedHandlingExceptions<T,​X extends Throwable>

  • Type Parameters:
    T - The resulting type of preprocessing.
    X - The exception type that can be thrown due to preprocessing.
    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
    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.TextVertexReaderFromEachLineProcessedHandlingExceptions<T,​X extends Throwable>
    extends TextVertexInputFormat.TextVertexReader
    Abstract class to be implemented by the user to read a vertex from each text line after preprocessing it with exception handling.
    • Constructor Detail

      • TextVertexReaderFromEachLineProcessedHandlingExceptions

        protected TextVertexReaderFromEachLineProcessedHandlingExceptions()
    • Method Detail

      • nextVertex

        public final boolean nextVertex()
                                 throws IOException,
                                        InterruptedException
        Specified by:
        nextVertex in class org.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
      • getCurrentVertex

        public final org.apache.giraph.graph.Vertex<I,​V,​E> getCurrentVertex()
                                                                                 throws IOException,
                                                                                        InterruptedException
        Specified by:
        getCurrentVertex in class org.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
      • preprocessLine

        protected abstract T preprocessLine​(org.apache.hadoop.io.Text line)
                                     throws X extends Throwable,
                                            IOException
        Preprocess the line so other methods can easily read necessary information for creating vertex.
        Parameters:
        line - the current line to be read
        Returns:
        the preprocessed object
        Throws:
        X - exception that can be thrown while preprocessing the line
        IOException - exception that can be thrown while reading
        X extends Throwable
      • getId

        protected abstract I getId​(T line)
                            throws X extends Throwable,
                                   IOException
        Reads vertex id from the preprocessed line.
        Parameters:
        line - the object obtained by preprocessing the line
        Returns:
        the vertex id
        Throws:
        X - exception that can be thrown while reading the preprocessed object
        IOException - exception that can be thrown while reading
        X extends Throwable
      • getValue

        protected abstract V getValue​(T line)
                               throws X extends Throwable,
                                      IOException
        Reads vertex value from the preprocessed line.
        Parameters:
        line - the object obtained by preprocessing the line
        Returns:
        the vertex value
        Throws:
        X - exception that can be thrown while reading the preprocessed object
        IOException - exception that can be thrown while reading
        X extends Throwable
      • getEdges

        protected abstract Iterable<org.apache.giraph.edge.Edge<I,​E>> getEdges​(T line)
                                                                              throws X extends Throwable,
                                                                                     IOException
        Reads edges from the preprocessed line.
        Parameters:
        line - the object obtained by preprocessing the line
        Returns:
        the edges
        Throws:
        X - exception that can be thrown while reading the preprocessed object
        IOException - exception that can be thrown while reading
        X extends Throwable
      • handleException

        protected org.apache.giraph.graph.Vertex<I,​V,​E> handleException​(org.apache.hadoop.io.Text line,
                                                                                    T processed,
                                                                                    X e)
        Handles exceptions while reading vertex from each line.
        Parameters:
        line - the line that was being read when the exception was thrown
        processed - the object obtained by preprocessing the line. Can be null if exception was thrown during preprocessing.
        e - the exception thrown while reading the line
        Returns:
        the recovered/alternative vertex to be used