タイムスタンプに基づいて hdfs にディレクトリを作成する必要がある単純な MR ジョブがあります。正しいAPIを見つけるのに苦労しています(hadoop 2.0.3でステータスを見つけて、存在しない場合はディレクトリを作成します)。誰かがそれを行う正しい方法を提案できますか? ここに既存のコードがあります:
FileSystem fileSystem = FileSystem.get(new Configuration());
Calendar c = Calendar.getInstance();
String basepath = "/dev/group/data/json/";
for ( Record record: records){
c.setTimeInMillis(record.timestamp );
Path path = new Path(basepath + c.get(Calendar.YEAR) + "/" + c.get(Calendar.MONTH));
// Check if the path is valid and create hdfs folder if not
FileStatus[] status = filesystem.???
context.write(key, new Text(mapper.writeValueAsString(record)));
}
どうも