public void setup(Context context) {
   Configuration conf = context.getConfiguration();
   String date = DayPartitioner.getDate(context);
   HDFSPath outdir = new HDFSPath(conf, conf.get("output"));
   Datafile dataFile = outdir.getFile(date);
   sentenceFile = new SentenceFile(dataFile);
   sentenceFile.openWrite();
 }
示例#2
0
 public static int countReducers(Configuration conf, Path inputPath) throws IOException {
   HashSet<String> timestamps = new HashSet();
   HDFSPath inHdfsPath = new HDFSPath(conf, inputPath);
   for (DirComponent path : inHdfsPath.wildcardIterator()) {
     timestamps.add(path.getName());
   }
   return timestamps.size();
 }