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

来源:互联网 发布:电视 品牌 知乎 编辑:程序博客网 时间:2024/05/29 10:39

设置文件过滤代码:

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/

0 0
原创粉丝点击