@VisibleForTesting
  public static int determineLocation(List<String> locations, FileSplit fsplit) {
    byte[] bytes = getHashInputForSplit(fsplit);
    long hash1 = hash1(bytes);
    int index = Hashing.consistentHash(hash1, locations.size());
    String location = locations.get(index);
    LOG.debug("{} mapped to index={}, location={}", getSplitDescForDebug(fsplit), index, location);
    int iter = 1;
    long hash2 = 0;
    // Since our probing method is totally bogus, give up after some time.
    while (location == null && iter < locations.size() * 2) {
      if (iter == 1) {
        hash2 = hash2(bytes);
      }
      // Note that this is not real double hashing since we have consistent hash on top.
      index = Hashing.consistentHash(hash1 + iter * hash2, locations.size());
      location = locations.get(index);
      LOG.debug("{} remapped to index={}, location={}", getSplitDescForDebug(fsplit), index, location);
      ++iter;
    }
    return index;
  }
This maps a split (path + offset) to an index based on the number of locations provided.

If locations do not change across jobs, the intention is to map the same split to the same node.

A big problem is when nodes change (added, removed, temporarily removed and re-added) etc. That changes
the number of locations / position of locations - and will cause the cache to be almost completely invalidated.

TODO: Support for consistent hashing when combining the split location generator and the ServiceRegistry.
ql/src/java/org/apache/hadoop/hive/ql/exec/tez/HostAffinitySplitLocationProvider.java