static PoolTreeNode makePoolTree(WMFullResourcePlan fullRp) {
      PoolTreeNode root = new PoolTreeNode();
      Map<String, PoolTreeNode> poolMap = new HashMap<>();
      buildPoolTree(fullRp, root, poolMap);

      Map<String, WMTrigger> triggerMap = new HashMap<>();
      List<WMTrigger> unmanagedTriggers = new ArrayList<>();
      Set<WMTrigger> unusedTriggers = new HashSet<>();
      sortTriggers(fullRp, poolMap, triggerMap, unmanagedTriggers, unusedTriggers);

      Map<String, List<String>> unmanagedMappings = new HashMap<>();
      Map<String, List<String>> invalidMappings = new HashMap<>();
      sortMappings(fullRp, poolMap, unmanagedMappings, invalidMappings);

      addNonPoolNodes(root, poolMap, unmanagedTriggers, unusedTriggers, unmanagedMappings, invalidMappings);

      return root;
    }
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