Document directory
You can use the third parameter of the override map function. The map function is as follows:
Public void map (longwritable key, text value, outputcollector <text, text> output, reporter)
String Path = (filesplit) reporter. getinputsplit (). getpath (). tostring ();
To obtain the full path.
The following method can be used to select files:
Public ClassFilterImplementsPathfilter {
Public BooleanAccept (Path ){
Return! (Path. tostring (). indexof ("ABC")>-1 );
}
}
Jobconf. Set ("mapred. Input. pathfilter. Class", "filter"); org. Apache. hadoop. FS
Interface pathfilter
-
All known implementing classes:
-
Outputlogfilter
-
public interface PathFilter
Method Summary |
boolean |
accept(Path path) Tests whether or not the specified abstract pathname shocould be encoded in a pathname list. |
Accept
boolean accept(Path path)
-
Tests whether or not the specified abstract pathname shocould be encoded in a pathname list.
-
Parameters:
-
path
-The abstract pathname to be tested
-
Returns:
-
true
If and only if
pathname
Shocould be encoded DED