List of usage examples for org.apache.hadoop.mapreduce InputSplit getLocationInfo
@Evolving public SplitLocationInfo[] getLocationInfo() throws IOException
From source file:org.apache.vxquery.hdfs2.HDFSFunctions.java
License:Apache License
/** * Create a HashMap that has as key the hostname and values the splits that belong to this hostname; * //www.j ava 2 s .c o m * @return * @throws IOException */ public HashMap<String, ArrayList<Integer>> getLocationsOfSplits() throws IOException { HashMap<String, ArrayList<Integer>> splits_map = new HashMap<String, ArrayList<Integer>>(); ArrayList<Integer> temp; int i = 0; String hostname; for (InputSplit s : this.splits) { SplitLocationInfo info[] = s.getLocationInfo(); hostname = info[0].getLocation(); if (splits_map.containsKey(hostname)) { temp = splits_map.get(hostname); temp.add(i); } else { temp = new ArrayList<Integer>(); temp.add(i); splits_map.put(hostname, temp); } i++; } return splits_map; }