Setting parameter in MapReduce Job configuration

前端 未结 2 751
名媛妹妹
名媛妹妹 2021-01-19 13:01

Is there any way to set a parameter in job configuration from Mapper and is accessible from Reducer.

I tried the below code

In Mapp

2条回答
  •  心在旅途
    2021-01-19 13:34

    If you are using the new API your code should ideally work. Have you created this "Sum" property at the start of the job creation? For example like this

    Configuration conf = new Configuration();
    conf.set("Sum", "0");
    Job job = new Job(conf);
    

    If not you better use

    context.getConfiguration().setIfUnset("Sum","100");
    

    In your mapper class to fix the issue. This is the only thing I can see.

提交回复
热议问题