Package ml.shifu.guagua.hadoop.io
Class GuaguaLineRecordReader
- java.lang.Object
-
- ml.shifu.guagua.hadoop.io.GuaguaLineRecordReader
-
- All Implemented Interfaces:
ml.shifu.guagua.io.GuaguaRecordReader<GuaguaWritableAdapter<org.apache.hadoop.io.LongWritable>,GuaguaWritableAdapter<org.apache.hadoop.io.Text>>
public class GuaguaLineRecordReader extends Object implements ml.shifu.guagua.io.GuaguaRecordReader<GuaguaWritableAdapter<org.apache.hadoop.io.LongWritable>,GuaguaWritableAdapter<org.apache.hadoop.io.Text>>
A reader read HDFS file line by line.Copy some code from
LineRecordReaderbut to supportGuaguaRecordReaderinterface.If use default constructor, user should also call
initialize(GuaguaFileSplit)like in below:this.setRecordReader(new GuaguaLineRecordReader()); this.getRecordReader().initialize(fileSplit);
or directly use other constructors:this.setRecordReader(new GuaguaLineRecordReader(fileSplit));
-
-
Constructor Summary
Constructors Constructor Description GuaguaLineRecordReader()GuaguaLineRecordReader(ml.shifu.guagua.io.GuaguaFileSplit split)GuaguaLineRecordReader(org.apache.hadoop.conf.Configuration conf, ml.shifu.guagua.io.GuaguaFileSplit split)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()GuaguaWritableAdapter<org.apache.hadoop.io.LongWritable>getCurrentKey()GuaguaWritableAdapter<org.apache.hadoop.io.Text>getCurrentValue()floatgetProgress()Get the progress within the splitvoidinitialize(ml.shifu.guagua.io.GuaguaFileSplit split)booleannextKeyValue()
-
-
-
Constructor Detail
-
GuaguaLineRecordReader
public GuaguaLineRecordReader()
-
GuaguaLineRecordReader
public GuaguaLineRecordReader(ml.shifu.guagua.io.GuaguaFileSplit split) throws IOException- Throws:
IOException
-
GuaguaLineRecordReader
public GuaguaLineRecordReader(org.apache.hadoop.conf.Configuration conf, ml.shifu.guagua.io.GuaguaFileSplit split) throws IOException- Throws:
IOException
-
-
Method Detail
-
initialize
public void initialize(ml.shifu.guagua.io.GuaguaFileSplit split) throws IOException- Specified by:
initializein interfaceml.shifu.guagua.io.GuaguaRecordReader<GuaguaWritableAdapter<org.apache.hadoop.io.LongWritable>,GuaguaWritableAdapter<org.apache.hadoop.io.Text>>- Throws:
IOException
-
nextKeyValue
public boolean nextKeyValue() throws IOException- Specified by:
nextKeyValuein interfaceml.shifu.guagua.io.GuaguaRecordReader<GuaguaWritableAdapter<org.apache.hadoop.io.LongWritable>,GuaguaWritableAdapter<org.apache.hadoop.io.Text>>- Throws:
IOException
-
getCurrentKey
public GuaguaWritableAdapter<org.apache.hadoop.io.LongWritable> getCurrentKey()
- Specified by:
getCurrentKeyin interfaceml.shifu.guagua.io.GuaguaRecordReader<GuaguaWritableAdapter<org.apache.hadoop.io.LongWritable>,GuaguaWritableAdapter<org.apache.hadoop.io.Text>>
-
getCurrentValue
public GuaguaWritableAdapter<org.apache.hadoop.io.Text> getCurrentValue()
- Specified by:
getCurrentValuein interfaceml.shifu.guagua.io.GuaguaRecordReader<GuaguaWritableAdapter<org.apache.hadoop.io.LongWritable>,GuaguaWritableAdapter<org.apache.hadoop.io.Text>>
-
getProgress
public float getProgress()
Get the progress within the split
-
close
public void close() throws IOException- Specified by:
closein interfaceml.shifu.guagua.io.GuaguaRecordReader<GuaguaWritableAdapter<org.apache.hadoop.io.LongWritable>,GuaguaWritableAdapter<org.apache.hadoop.io.Text>>- Throws:
IOException
-
-