无法在新的 mapreduce 中将 RCFileInputFormat 设置为 InputFormatClass API

Unable to set RCFileInputFormat as InputFormatClass in new mapreduce API

我正在尝试在映射器阶段读取 RCFiles,并且我能够在旧的 mapred API 中轻松地实现相同的目的。

现在,我重构我的代码以使用新的 mapreduce API。

使用 Job 而不是 JobConf 来配置作业属性。但我无法将 RCFileInputFormat 设置为 InputFormatClass。

下面是我遇到的编译错误:

job.setInputFormatClass(RCFileInputFormat.class);

The method setInputFormatClass(Class<? extends InputFormat>) in the type Job is not applicable for the arguments (Class<RCFileInputFormat>)

我如何克服这个问题并使用新的 mapreduce API 来实现相同的功能。

RCFileInputFormat 使用名为 mapred 的旧 MR API。您需要使用一个使用 mapreduce API 的。环顾四周,您也许可以使用 here

中的 RCFileMapReduceInputFormat

它似乎与您尝试使用的 Key/Value 签名相同:

<K extends LongWritable, V extends BytesRefArrayWritable>