I m using new Hadoop API and looking for a way to pass some parameters (few strings) to mappers.
How can I do that?
JobConf job = (JobConf)getConf();
job.set("NumberOfDocuments", args[0]);
这里,“NumberOfDocuments
”是指参数的名称,其价值从“args[0]
,即一条指挥线。 一俟你提出这一论点,你就可收回其价值,即:
private static Long N;
public void configure(JobConf job) {
N = Long.parseLong(job.get("NumberOfDocuments"));
}
值得注意的是,微小部分是,你不能确定这样的参数:
Configuration con = new Configuration();
con.set("NumberOfDocuments", args[0]);