public static FileStatus [ ] getDataChunkFiles ( FileSystem fs , Path path , final int partitionId , final int replicaType ) throws IOException { return fs . listStatus ( path , new PathFilter ( ) { public boolean accept ( Path input ) { if ( input . getName ( ) . matches ( "^" + Integer . toString ( partitionId ) + "_" + Integer . toString ( replicaType ) + "_[\\d]+\\.data" ) ) { return true ; } else { return false ; } } } ) ; }
Given a filesystem and path to a node gets all the files which belong to a partition and replica type