private static void sortMappings(WMFullResourcePlan fullRp, Map<String, PoolTreeNode> poolMap,
        Map<String, List<String>> unmanagedMappings, Map<String, List<String>> invalidMappings) {
      if (fullRp.isSetMappings()) {
        for (WMMapping mapping : fullRp.getMappings()) {
          if (mapping.isSetPoolPath()) {
            PoolTreeNode destNode = poolMap.get(mapping.getPoolPath());
            addMappingToMap((destNode == null) ? invalidMappings : destNode.mappings, mapping);
          } else {
            addMappingToMap(unmanagedMappings, mapping);
          }
        }
      }
    }
A n-ary tree for the pools, each node contains a pool and its children.
ql/src/java/org/apache/hadoop/hive/ql/ddl/workloadmanagement/resourceplan/show/formatter/ShowResourcePlanFormatter.java