private String getJSONAdjacency(
      org.apache.hadoop.hive.ql.plan.api.Adjacency adj) {
    if (adj == null) {
      return "null";
    }
    StringBuilder sb = new StringBuilder();
    sb.append("{");
    sb.append(getJSONKeyValue("node", adj.getNode()));
    sb.append(getJSONKeyValue("children", getJSONList(adj.getChildren())));
    sb.append(getJSONKeyValue("adjacencyType", adj.getAdjacencyType()));
    sb.deleteCharAt(sb.length() - 1);
    sb.append("}");
    return sb.toString();
  }
Extract all the counters from tasks and operators.
ql/src/java/org/apache/hadoop/hive/ql/QueryPlan.java