Hadoop 0.20.2 の TeraSort クラスのマッパーにコードを挿入する予定です。しかし、ソース コードを確認した後、マッパーが実装されているセグメントを見つけることができません。通常、マッパー クラスを示す job.setMapperClass() というメソッドが表示されます。ただし、TeraSort については、setInputformat、setOutputFormat などしか表示されません。mapper メソッドと reduce メソッドが呼び出されている場所がわかりません。誰でもこれについていくつかのヒントを教えてください。ありがとう、ソースコードはこのようなものです、
public int run(String[] args) throws Exception {
LOG.info("starting");
JobConf job = (JobConf) getConf();
Path inputDir = new Path(args[0]);
inputDir = inputDir.makeQualified(inputDir.getFileSystem(job));
Path partitionFile = new Path(inputDir, TeraInputFormat.PARTITION_FILENAME);
URI partitionUri = new URI(partitionFile.toString() +
"#" + TeraInputFormat.PARTITION_FILENAME);
TeraInputFormat.setInputPaths(job, new Path(args[0]));
FileOutputFormat.setOutputPath(job, new Path(args[1]));
job.setJobName("TeraSort");
job.setJarByClass(TeraSort.class);
job.setOutputKeyClass(Text.class);
job.setOutputValueClass(Text.class);
job.setInputFormat(TeraInputFormat.class);
job.setOutputFormat(TeraOutputFormat.class);
job.setPartitionerClass(TotalOrderPartitioner.class);
TeraInputFormat.writePartitionFile(job, partitionFile);
DistributedCache.addCacheFile(partitionUri, job);
DistributedCache.createSymlink(job);
job.setInt("dfs.replication", 1);
// TeraOutputFormat.setFinalSync(job, true);
job.setNumReduceTasks(0);
JobClient.runJob(job);
LOG.info("done");
return 0;
}
TeraValidate などの他のクラスについては、次のようなコードを見つけることができます。
job.setMapperClass(ValidateMapper.class);
job.setReducerClass(ValidateReducer.class);
TeraSort ではそのようなメソッドは見当たりません。
ありがとう、