今天想用数据输入格式KeyValueInputFormat,API文档上的方法,我使用job.setInputFormatClass(KeyValueTextInputFormat.class);结果却报错The method setInputFormatClass(Class<? extends InputFormat>) in the type Job is not applicable for the arguments (Class<KeyValueTextInputFormat>)
我重新看了下API文档,确定这种写法应该是没问题的,可是怎么报错了呢?然后我google了相关内容,终于找到了原因。
http://lucene.472066.n3.nabble.com/No-KeyValueTextInputFormat-in-hadoop-0-20-2-td894459.html
对于这个问题,大家在这个链接里进行了讨论,结果是The new api KeyValueTextInputFormat is not available in branch 0.20. It is added in branch 0.21 through https://issues.apache.org/jira/browse/MAPREDUCE-655.
好吧,也就是在这个版本不能使用KeyValueInputFormat。除非自己去写了。