我延长了一些时间 FileInputFormat
由 XMLFileInputFormat
. 问题是当我把这门课设置在 job
```
job.setInputFormatClass(XMLFileInputFormat.class);
我得到一些错误告诉它希望这个类扩展 `or.apache.hadoop.mapreduce.InputFormat` (但我查过了 `FileInputFormat` 工具 `InputFormat` )
这个班是这样安排的
public class XMLFileInputFormat extends FileInputFormat<NullWritable, BytesWritable> {
@Override
protected boolean isSplitable(FileSystem fs, Path filename) {
return false; }
@Override
public RecordReader<NullWritable, BytesWritable> getRecordReader(
InputSplit split, JobConf job, Reporter reporter) throws IOException {
return new XMLFileRecordReader((FileSplit) split, job);
}
}
如何正确设置 `InputFormat` ?
1条答案
按热度按时间sauutmhj1#
请验证导入语句中的包结构。它应该是org.apache.hadoop.mapreduce.fileinputformat。
您可以导入:org.apache.hadoop.mapred.fileinputformat