private void updateCountersInQueryPlan() {
    query.setStarted(started.contains(query.getQueryId()));
    query.setDone(done.contains(query.getQueryId()));
    if (query.getStageList() != null) {
      for (org.apache.hadoop.hive.ql.plan.api.Stage stage : query
          .getStageList()) {
        if (stage.getStageId() == null) {
          continue;
        }
        stage.setStarted(started.contains(stage.getStageId()));
        stage.setStageCounters(counters.get(stage.getStageId()));
        stage.setDone(done.contains(stage.getStageId()));
        for (org.apache.hadoop.hive.ql.plan.api.Task task : stage.getTaskList()) {
          task.setTaskCounters(counters.get(task.getTaskId()));
          if (task.getTaskType() == TaskType.OTHER) {
            task.setStarted(started.contains(stage.getStageId()));
            task.setDone(done.contains(stage.getStageId()));
          } else {
            task.setStarted(started.contains(task.getTaskId()));
            task.setDone(done.contains(task.getTaskId()));
            if (task.getOperatorList() == null) {
              return;
            }
            for (org.apache.hadoop.hive.ql.plan.api.Operator op :
              task.getOperatorList()) {
              // if the task has started, all operators within the task have
              // started
              op.setStarted(started.contains(task.getTaskId()));
              // if the task is done, all operators are done as well
              op.setDone(done.contains(task.getTaskId()));
            }
          }
        }
      }
    }
  }
From the counters extracted via extractCounters(), update the counters in
the query plan.
ql/src/java/org/apache/hadoop/hive/ql/QueryPlan.java