标签:
写Hadoop程序的时候在Mapper里遇到这个需求,上网查了下,做个记录:
public static class MapClass extends MapReduceBase implements Mapper<Object, Text, IntWritable, Text> { @Override public void map(Object k, Text value, OutputCollector<IntWritable, Text> output, Reporter reporter) throws IOException { // TODO Auto-generated method stub FileSplit fileSplit = (FileSplit) reporter.getInputSplit(); String fileName = fileSplit.getPath().getName(); } }
标签:
原文地址:http://www.cnblogs.com/Murcielago/p/4383177.html