使用 hadoop 0.20.2 并尝试通过分布式缓存读取序列化地图
面临编译错误 localFiles = DistributedCache.getLocalCacheFiles(job); ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 未处理的异常类型 IOException
DRIVER 类片段(/scratch/word_id.ser 是存储在本地系统中的序列化文件)
Job job = new Job(conf, "xml-read");
DistributedCache.addCacheFile(new URI("/scratch/word_id.ser"),job);
MAPPER 类片段
public class MyParserMapper1 {
public static class Map extends MapReduceBase implements Mapper<LongWritable, Text, IntWritable, Text> {
private FileSystem fs;
private Path[] localFiles;
HashMap hash_temp;
private ObjectInputStream oisc;
@Override
public void configure(JobConf job) {
localFiles = DistributedCache.getLocalCacheFiles(job);
}