Class SumSequenceFileWorker

  • All Implemented Interfaces:
    ml.shifu.guagua.worker.WorkerComputable<ml.shifu.guagua.hadoop.io.GuaguaWritableAdapter<org.apache.hadoop.io.LongWritable>,​ml.shifu.guagua.hadoop.io.GuaguaWritableAdapter<org.apache.hadoop.io.LongWritable>>

    public class SumSequenceFileWorker
    extends ml.shifu.guagua.worker.AbstractWorkerComputable<ml.shifu.guagua.hadoop.io.GuaguaWritableAdapter<org.apache.hadoop.io.LongWritable>,​ml.shifu.guagua.hadoop.io.GuaguaWritableAdapter<org.apache.hadoop.io.LongWritable>,​ml.shifu.guagua.hadoop.io.GuaguaWritableAdapter<org.apache.hadoop.io.Text>,​ml.shifu.guagua.hadoop.io.GuaguaWritableAdapter<org.apache.hadoop.io.Text>>
    SumSequenceFileWorker is used to accumulate the sum value for each line.

    Each line of input should be number.

    The master's sum value will be added to current iteration.

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      ml.shifu.guagua.hadoop.io.GuaguaWritableAdapter<org.apache.hadoop.io.LongWritable> doCompute​(ml.shifu.guagua.worker.WorkerContext<ml.shifu.guagua.hadoop.io.GuaguaWritableAdapter<org.apache.hadoop.io.LongWritable>,​ml.shifu.guagua.hadoop.io.GuaguaWritableAdapter<org.apache.hadoop.io.LongWritable>> workerContext)  
      void init​(ml.shifu.guagua.worker.WorkerContext<ml.shifu.guagua.hadoop.io.GuaguaWritableAdapter<org.apache.hadoop.io.LongWritable>,​ml.shifu.guagua.hadoop.io.GuaguaWritableAdapter<org.apache.hadoop.io.LongWritable>> workerContext)  
      void initRecordReader​(ml.shifu.guagua.io.GuaguaFileSplit fileSplit)  
      void load​(ml.shifu.guagua.hadoop.io.GuaguaWritableAdapter<org.apache.hadoop.io.Text> currentKey, ml.shifu.guagua.hadoop.io.GuaguaWritableAdapter<org.apache.hadoop.io.Text> currentValue, ml.shifu.guagua.worker.WorkerContext<ml.shifu.guagua.hadoop.io.GuaguaWritableAdapter<org.apache.hadoop.io.LongWritable>,​ml.shifu.guagua.hadoop.io.GuaguaWritableAdapter<org.apache.hadoop.io.LongWritable>> workerContext)  
      • Methods inherited from class ml.shifu.guagua.worker.AbstractWorkerComputable

        compute, getRecordReader, postLoad, preLoad, setRecordReader
    • Constructor Detail

      • SumSequenceFileWorker

        public SumSequenceFileWorker()
    • Method Detail

      • init

        public void init​(ml.shifu.guagua.worker.WorkerContext<ml.shifu.guagua.hadoop.io.GuaguaWritableAdapter<org.apache.hadoop.io.LongWritable>,​ml.shifu.guagua.hadoop.io.GuaguaWritableAdapter<org.apache.hadoop.io.LongWritable>> workerContext)
        Specified by:
        init in class ml.shifu.guagua.worker.AbstractWorkerComputable<ml.shifu.guagua.hadoop.io.GuaguaWritableAdapter<org.apache.hadoop.io.LongWritable>,​ml.shifu.guagua.hadoop.io.GuaguaWritableAdapter<org.apache.hadoop.io.LongWritable>,​ml.shifu.guagua.hadoop.io.GuaguaWritableAdapter<org.apache.hadoop.io.Text>,​ml.shifu.guagua.hadoop.io.GuaguaWritableAdapter<org.apache.hadoop.io.Text>>
      • doCompute

        public ml.shifu.guagua.hadoop.io.GuaguaWritableAdapter<org.apache.hadoop.io.LongWritable> doCompute​(ml.shifu.guagua.worker.WorkerContext<ml.shifu.guagua.hadoop.io.GuaguaWritableAdapter<org.apache.hadoop.io.LongWritable>,​ml.shifu.guagua.hadoop.io.GuaguaWritableAdapter<org.apache.hadoop.io.LongWritable>> workerContext)
        Specified by:
        doCompute in class ml.shifu.guagua.worker.AbstractWorkerComputable<ml.shifu.guagua.hadoop.io.GuaguaWritableAdapter<org.apache.hadoop.io.LongWritable>,​ml.shifu.guagua.hadoop.io.GuaguaWritableAdapter<org.apache.hadoop.io.LongWritable>,​ml.shifu.guagua.hadoop.io.GuaguaWritableAdapter<org.apache.hadoop.io.Text>,​ml.shifu.guagua.hadoop.io.GuaguaWritableAdapter<org.apache.hadoop.io.Text>>
      • load

        public void load​(ml.shifu.guagua.hadoop.io.GuaguaWritableAdapter<org.apache.hadoop.io.Text> currentKey,
                         ml.shifu.guagua.hadoop.io.GuaguaWritableAdapter<org.apache.hadoop.io.Text> currentValue,
                         ml.shifu.guagua.worker.WorkerContext<ml.shifu.guagua.hadoop.io.GuaguaWritableAdapter<org.apache.hadoop.io.LongWritable>,​ml.shifu.guagua.hadoop.io.GuaguaWritableAdapter<org.apache.hadoop.io.LongWritable>> workerContext)
        Specified by:
        load in class ml.shifu.guagua.worker.AbstractWorkerComputable<ml.shifu.guagua.hadoop.io.GuaguaWritableAdapter<org.apache.hadoop.io.LongWritable>,​ml.shifu.guagua.hadoop.io.GuaguaWritableAdapter<org.apache.hadoop.io.LongWritable>,​ml.shifu.guagua.hadoop.io.GuaguaWritableAdapter<org.apache.hadoop.io.Text>,​ml.shifu.guagua.hadoop.io.GuaguaWritableAdapter<org.apache.hadoop.io.Text>>
      • initRecordReader

        public void initRecordReader​(ml.shifu.guagua.io.GuaguaFileSplit fileSplit)
                              throws IOException
        Specified by:
        initRecordReader in class ml.shifu.guagua.worker.AbstractWorkerComputable<ml.shifu.guagua.hadoop.io.GuaguaWritableAdapter<org.apache.hadoop.io.LongWritable>,​ml.shifu.guagua.hadoop.io.GuaguaWritableAdapter<org.apache.hadoop.io.LongWritable>,​ml.shifu.guagua.hadoop.io.GuaguaWritableAdapter<org.apache.hadoop.io.Text>,​ml.shifu.guagua.hadoop.io.GuaguaWritableAdapter<org.apache.hadoop.io.Text>>
        Throws:
        IOException