我可以举一个如何使用任务副作用文件的例子吗?
public class Map0t extends MapReduceBase implements Mapper<LongWritable, Text, Text, IntWritable >{
public void map(LongWritable key, Text value, OutputCollector<Text, IntWritable> output, Reporter reporter) throws IOException {
IntWritable one = new IntWritable(1);
StringTokenizer tokenizer = new StringTokenizer(value.toString(), ",");
String x;
String y;
String z;
x = tokenizer.nextToken();
y = tokenizer.nextToken();
z = tokenizer.nextToken();
output.collect(new Text(x+" "+z), one);
}
}
我想将新的Text(x +“” + y),新的Text(z)作为上述Mapper函数的副作用写入HDFS中的其他文件夹。我进行了搜索,但找不到有关如何使用任务副作用文件的任何示例。
最佳答案
这不是最佳方法,但我能想到的一种方法是
关于hadoop - Hadoop任务副作用文件示例,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/11443585/