map中获取文件名
//获取数据所属文件名
FileSplit fis = (FileSplit) context.getInputSplit();
String fileName = fis.getPath().getName();
context.write(new Text(fileName), value);
压缩文件snappy Driver中Configuration按以下设置
//设置map使用的压缩算法
conf.set("mapreduce.map.output.compress","true");
conf.set("mapreduce.map.output.compress.codec","org.apache.hadoop.io.compress.SnappyCodec");
//设置reduce使用的压缩算法
conf.set("mapreduce.output.fileoutputformat.compress","true");
conf.set("mapreduce.output.fileoutputformat.compress.type","RECORD");
conf.set("mapreduce.output.fileoutputformat.compress.codec","org.apache.hadoop.io.compress.SnappyCodec");