public org.apache.hadoop.hive.ql.plan.api.Query getQueryPlan()
      throws IOException {
    if (query.getStageGraph() == null) {
      populateQueryPlan();
    }
    extractCounters();
    updateCountersInQueryPlan();
    return query;
  }
Extract all the counters from tasks and operators.
ql/src/java/org/apache/hadoop/hive/ql/QueryPlan.java