@InterfaceAudience.Public @InterfaceStability.Stable public abstract class CombineFileInputFormat<K,V> extends FileInputFormat<K,V>
InputFormat
that returns CombineFileSplit
's in
InputFormat.getSplits(JobContext)
method.
Splits are constructed from the files under the input paths.
A split cannot have files from different pools.
Each split returned may contain blocks from different files.
If a maxSplitSize is specified, then blocks on the same node are
combined to form a single split. Blocks that are left over are
then combined with other blocks in the same rack.
If maxSplitSize is not specified, then blocks from the same rack
are combined in a single split; no attempt is made to create
node-local splits.
If the maxSplitSize is equal to the block size, then this class
is similar to the default splitting behavior in Hadoop: each
block is a locally processed split.
Subclasses implement
InputFormat.createRecordReader(InputSplit, TaskAttemptContext)
to construct RecordReader
's for
CombineFileSplit
's.CombineFileSplit
FileInputFormat.Counter
限定符和类型 | 字段和说明 |
---|---|
static String |
SPLIT_MINSIZE_PERNODE |
static String |
SPLIT_MINSIZE_PERRACK |
构造器和说明 |
---|
CombineFileInputFormat()
default constructor
|
限定符和类型 | 方法和说明 |
---|---|
protected void |
createPool(List<PathFilter> filters)
Create a new pool and add the filters to it.
|
protected void |
createPool(PathFilter... filters)
Create a new pool and add the filters to it.
|
abstract RecordReader<K,V> |
createRecordReader(InputSplit split,
TaskAttemptContext context)
This is not implemented yet.
|
protected BlockLocation[] |
getFileBlockLocations(FileSystem fs,
FileStatus stat) |
List<InputSplit> |
getSplits(JobContext job)
Generate the list of files and make them into FileSplits.
|
protected boolean |
isSplitable(JobContext context,
Path file)
Is the given filename splitable?
|
protected void |
setMaxSplitSize(long maxSplitSize)
Specify the maximum size (in bytes) of each split.
|
protected void |
setMinSplitSizeNode(long minSplitSizeNode)
Specify the minimum size (in bytes) of each split per node.
|
protected void |
setMinSplitSizeRack(long minSplitSizeRack)
Specify the minimum size (in bytes) of each split per rack.
|
addInputPath, addInputPaths, computeSplitSize, getBlockIndex, getFormatMinSplitSize, getInputPathFilter, getInputPaths, getMaxSplitSize, getMinSplitSize, listStatus, setInputPathFilter, setInputPaths, setInputPaths, setMaxInputSplitSize, setMinInputSplitSize
protected void setMaxSplitSize(long maxSplitSize)
protected void setMinSplitSizeNode(long minSplitSizeNode)
protected void setMinSplitSizeRack(long minSplitSizeRack)
protected void createPool(List<PathFilter> filters)
protected void createPool(PathFilter... filters)
protected boolean isSplitable(JobContext context, Path file)
FileInputFormat
FileInputFormat
implementations can override this and return
false
to ensure that individual input files are never split-up
so that Mapper
s process entire files.isSplitable
在类中 FileInputFormat<K,V>
context
- the job contextfile
- the file name to checkpublic List<InputSplit> getSplits(JobContext job) throws IOException
FileInputFormat
getSplits
在类中 FileInputFormat<K,V>
job
- job configuration.InputSplit
s for the job.IOException
public abstract RecordReader<K,V> createRecordReader(InputSplit split, TaskAttemptContext context) throws IOException
createRecordReader
在类中 InputFormat<K,V>
split
- the split to be readcontext
- the information about the taskIOException
protected BlockLocation[] getFileBlockLocations(FileSystem fs, FileStatus stat) throws IOException
IOException
Copyright © 2009 The Apache Software Foundation