Hadoop-Cascading:部分目录源点击

时间:2014-09-30 10:08:42

标签: java hadoop cascading scalding

我的数据结构如下:

+data
|-2014080700_00.txt
|-2014080700_01.txt
|-2014080701_00.txt
|- ...
|-2014080723_00.txt
|-2014080800_00.txt
|- ...
|-2014090800_00.txt

我知道我可以使用Tap之类的数据目录中的所有文件,如下所示:

Tap inTap = new Hfs( new TextLine(), "/path/to/data"); 

但是我想要目录的特定部分,例如只有日期20140807的文件。因此,它将包含前缀为20140807的所有文件。有没有办法用Cascading做到这一点?或者有什么方法可以用烫伤吗?

1 个答案:

答案 0 :(得分:3)

我认为你不能使用Hfs来做,但它确实如此  可以使用GlobHfs

尝试以下方法:

Tap inTap = new GlobHfs( new TextLine(), "/path/to/data/", new GlobFilter("20140807*"));

这会创建一个Globbing tap,使用“/ path / to / data /”目录作为源,并使用传递给GlobFilter"20140807*" glob模式过滤内部文件。