FileInputFormat setInputPathFilter过滤文件报错找不到文件夹

设置文件过滤代码:

FileInputFormat.setInputPathFilter(job,MyPathFilter.class);

过滤器实现代码:

class MyPathFilter implements PathFilter{
public boolean accept(Path path) {
// TODO Auto-generated method stub
return path.getName().endsWith(".txt");
}
}


运行报错,找不到输入文件夹;但是,文件夹是存在的。解决方法是,改变输入路径格式:

之前格式》  hdfs://192.168.9.72:9000/mr/fileinputformat/input

改进格式》 hdfs://192.168.9.72:9000/mr/fileinputformat/input/*


资料参考: http://terje.blog.163.com/blog/static/119243712013101892629462/

你可能感兴趣的:(MapReduce,FileInputFormat,hadoop)