我正在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>
谢谢你的帮助。
1条答案
按热度按时间3hvapo4f1#
也许你正在使用旧的api
WholeFileInputFormat
是新的api。你也应该使用新的api。