簡體   English   中英

IntelliJ內部Mapreduce作業失敗

[英]Mapreduce job failing inside IntelliJ

我正在嘗試從IntelliJ內部運行Map-Reduce作業。 這是我的跑步者代碼,

public class ViewCount extends Configured implements Tool{

    @Override
    public int run(String[] args) throws Exception {
        Configuration conf = this.getConf();


        Job job = Job.getInstance(conf);
        job.setJobName("viewCount");
        job.setJarByClass(ViewCount.class);

        job.setOutputKeyClass(Text.class);
        job.setOutputValueClass(IntWritable.class);

        job.setMapperClass(Map.class);
        job.setReducerClass(Reduce.class);

        Path inputFilePath = new Path(args[0]);
        Path outputFilePath = new Path(args[1]);

        FileInputFormat.addInputPath(job, inputFilePath);
        FileOutputFormat.setOutputPath(job, outputFilePath);

        return job.waitForCompletion(true) ? 0:1;

    }

    public static void main(String[] args) throws Exception {

        int exitCode = ToolRunner.run(new ViewCount(), args);
        System.exit(exitCode);
    }

任務無法生成,並顯示以下錯誤消息。

error: incompatible types: Job cannot be converted to JobConf
        FileOutputFormat.setOutputPath(job, outputFilePath);

Apached文檔表明該方法實際上需要一個工作,而不是JobConf,那么我在做什么錯呢?

看一看這些類來自的包。 您可能正在混合軟件包,並且需要根據Hadoop版本使用正確軟件包中的TextInputFormat。 如果您使用的是Hadoop版本2.x,則與Hadoop版本1.x(具有mapred包)相比,需要導入不同的類(從mapreduce包中)。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM