@InterfaceAudience.Public @InterfaceStability.Stable public class NLineInputFormat extends FileInputFormat<LongWritable,Text>
FileInputFormat.Counter
限定符和类型 | 字段和说明 |
---|---|
static String |
LINES_PER_MAP |
构造器和说明 |
---|
NLineInputFormat() |
限定符和类型 | 方法和说明 |
---|---|
protected static FileSplit |
createFileSplit(Path fileName,
long begin,
long length)
NLineInputFormat uses LineRecordReader, which always reads
(and consumes) at least one character out of its upper split
boundary.
|
RecordReader<LongWritable,Text> |
createRecordReader(InputSplit genericSplit,
TaskAttemptContext context)
Create a record reader for a given split.
|
static int |
getNumLinesPerSplit(JobContext job)
Get the number of lines per split
|
List<InputSplit> |
getSplits(JobContext job)
Logically splits the set of input files for the job, splits N lines
of the input as one split.
|
static List<FileSplit> |
getSplitsForFile(FileStatus status,
Configuration conf,
int numLinesPerSplit) |
static void |
setNumLinesPerSplit(Job job,
int numLines)
Set the number of lines per split
|
addInputPath, addInputPaths, computeSplitSize, getBlockIndex, getFormatMinSplitSize, getInputPathFilter, getInputPaths, getMaxSplitSize, getMinSplitSize, isSplitable, listStatus, setInputPathFilter, setInputPaths, setInputPaths, setMaxInputSplitSize, setMinInputSplitSize
public RecordReader<LongWritable,Text> createRecordReader(InputSplit genericSplit, TaskAttemptContext context) throws IOException
InputFormat
RecordReader.initialize(InputSplit, TaskAttemptContext)
before
the split is used.createRecordReader
在类中 InputFormat<LongWritable,Text>
genericSplit
- the split to be readcontext
- the information about the taskIOException
public List<InputSplit> getSplits(JobContext job) throws IOException
getSplits
在类中 FileInputFormat<LongWritable,Text>
job
- job configuration.InputSplit
s for the job.IOException
FileInputFormat.getSplits(JobContext)
public static List<FileSplit> getSplitsForFile(FileStatus status, Configuration conf, int numLinesPerSplit) throws IOException
IOException
protected static FileSplit createFileSplit(Path fileName, long begin, long length)
fileName
- Path of filebegin
- the position of the first byte in the file to processlength
- number of bytes in InputSplitpublic static void setNumLinesPerSplit(Job job, int numLines)
job
- the job to modifynumLines
- the number of lines per splitpublic static int getNumLinesPerSplit(JobContext job)
job
- the jobCopyright © 2009 The Apache Software Foundation