hadoop获取context的当前输出路径,

我想看一下路径,然后判断文件是否存在?你妹的,真麻烦?

找个半天,用import org.apache.hadoop.io.MapFile;这个类,很恶心,自己查。

 
知道肯定跟Configuration,查了半天用这个:

String name =context.getConfiguration().get("mapred.output.dir");

顺便判断个文件存在:

       FileSystem fs = FileSystem.newInstance(conf) ;
      Path path = new Path("/user/zhoujie/log2session/log2session-bydomain-liumingjian/mso/"+test+key.toString().substring(key.toString().lastIndexOf(":")+1));
      if (fs.exists(path)) 
          test=test+10000;

DistributedFileSystem这个类也行。

posted on 2013-06-07 21:19  代码王子  阅读(177)  评论(0编辑  收藏  举报

导航