草庐IT

PathFilter

全部标签

Hadoop setInputPathFilter 错误

我正在使用Hadoop0.20.2(无法更改)并且我想在我的输入路径中添加一个过滤器。数据如下所示:/path1/test_a1/path1/test_a2/path1/train_a1/path1/train_a2我只想处理所有包含train的文件。查看FileInputFormat类建议使用:FileInputFormat.setInputPathFilter(Jobjob,Classfilter)这就是我的问题开始的地方,因为PathFilter是一个接口(interface)——当然,我可以扩展接口(interface),但我仍然没有实现。因此,我实现了接口(interface

Hadoop PathFilter 配置为空

我有一个看起来像这样的路径过滤器:publicclassAvroFileInclusionFilterextendsConfiguredimplementsPathFilter{Configurationconf;@OverridepublicvoidsetConf(Configurationconf){this.conf=conf;}@Overridepublicbooleanaccept(Pathpath){System.out.println("FileInclusion:"+conf.get("fileInclusion"));returntrue;}}我在配置中明确设置了fi

java - 如何在 Apache Spark 中使用 PathFilter?

我有一个简单的文件过滤器,基本上从特定日期选择文件。在Hadoop中,我会使用setInputPathFilter将PathFilter类设置为InputFormat参数。我如何在Spark中执行此操作?publicclassFilesFilterextendsConfiguredimplementsPathFilter{@Overridepublicbooleanaccept(Pathpath){try{if(fs.isDirectory(path))returntrue;}catch(IOExceptione1){e1.printStackTrace();returnfalse;}