hadoop上的java自定义类fileinputformat

6psbrbz9  于 2021-06-03  发布在  Hadoop
关注(0)|答案(1)|浏览(269)

我正在hadoop上运行wordcount示例,我想读取文件的全部内容。我使用了这里的示例(wholefileinputformat-newapi.java和wholefilerecordreader newapi.java)。我在wordcount类中添加了以下内容:conf.setinputformat(wholefileinputformat.class);
当我编译程序时,我得到以下错误:

error: method setInputFormat in class JobConf cannot be applied to given types;
        conf.setInputFormat(WholeFileInputFormat.class);
            ^
  required: Class<? extends InputFormat>
  found: Class<WholeFileInputFormat>
  reason: argument mismatch; Class<WholeFileInputFormat> cannot be converted to Class<?   extends InputFormat>

谢谢你的帮助。

3hvapo4f

3hvapo4f1#

也许你正在使用旧的api WholeFileInputFormat 是新的api。你也应该使用新的api。

相关问题