public String [ ] getLocations ( ) throws IOException { HashSet < String > hosts = new HashSet < String > ( ) ; for ( InputSplit s : splits ) { String [ ] hints = s . getLocations ( ) ; if ( hints != null && hints . length > 0 ) { for ( String host : hints ) { hosts . add ( host ) ; } } } return hosts . toArray ( new String [ hosts . size ( ) ] ) ; }
Collect a set of hosts from all child InputSplits .