@InterfaceAudience.Public @InterfaceStability.Stable public class TextInputFormat extends FileInputFormat<LongWritable,Text> implements JobConfigurable
InputFormat
。文件被分割成行,使用换行符或回车符表示行结束。键是文件中的位置,值是文本行。INPUT_DIR_NONRECURSIVE_IGNORE_SUBDIRS, INPUT_DIR_RECURSIVE, LOG, NUM_INPUT_FILES
构造函数及描述 |
---|
TextInputFormat() |
修饰符和类型 | 方法和描述 |
---|---|
void |
configure(JobConf conf)
Initializes a new instance from a
JobConf . |
RecordReader<LongWritable,Text> |
getRecordReader(InputSplit genericSplit,
JobConf job,
Reporter reporter)
Get the
RecordReader for the given InputSplit . |
protected boolean |
isSplitable(FileSystem fs,
Path file)
给定的文件名是否可分割?通常情况下是可以的,但如果文件是流式压缩的,则不可分割。
|
addInputPath, addInputPathRecursively, addInputPaths, computeSplitSize, getBlockIndex, getInputPathFilter, getInputPaths, getSplitHosts, getSplits, listStatus, makeSplit, makeSplit, setInputPathFilter, setInputPaths, setInputPaths, setMinSplitSize
public void configure(JobConf conf)
JobConfigurable
JobConf
初始化一个新实例。configure
在接口中 JobConfigurable
conf
- 配置信息protected boolean isSplitable(FileSystem fs, Path file)
FileInputFormat
FileInputFormat
中的默认实现总是返回true。需要处理不可分割文件的实现必须重写此方法。
FileInputFormat
的实现可以重写此方法并返回false
,以确保单个输入文件永远不会被分割,从而使Mapper
处理完整的文件。isSplitable
在类中 FileInputFormat<LongWritable,Text>
fs
- 文件所在的文件系统file
- 要检查的文件名public RecordReader<LongWritable,Text> getRecordReader(InputSplit genericSplit, JobConf job, Reporter reporter) throws IOException
InputFormat
getRecordReader
在接口 InputFormat<LongWritable,Text>
getRecordReader
在类 FileInputFormat<LongWritable,Text>
genericSplit
- 该InputSplit
job
- 此分片所属的作业RecordReader
IOException
版权所有 © 2024 Apache软件基金会。保留所有权利。