private static void addMapping(WMMapping mapping, Map<String, Mapping> map, String text) {
    Mapping val = new Mapping(mapping.getPoolPath(), mapping.getOrdering());
    Mapping oldValue = map.put(mapping.getEntityName(), val);
    if (oldValue != null) {
      throw new AssertionError("Duplicate mapping for " + text + " " + mapping.getEntityName()
          + "; " + oldValue + " and " + val);
    }
  }
Contains all the information necessary to map a query to a pool.
ql/src/java/org/apache/hadoop/hive/ql/exec/tez/UserPoolMapping.java