@Override
  public void postAnalyze(HiveSemanticAnalyzerHookContext context, List<Task<?>> rootTasks) throws SemanticException {

    HiveSemanticAnalyzerHookContext hookContext = context;
    HiveConf conf = (HiveConf) hookContext.getConf();
    absErr = conf.getDouble("accurate.estimate.checker.absolute.error", 3.0);
    relErr = conf.getDouble("accurate.estimate.checker.relative.error", .1);
    List<Node> rootOps = Lists.newArrayList();

    List<Task<?>> roots = rootTasks;
    for (Task<?> task0 : roots) {

      if (task0 instanceof ExplainTask) {
        ExplainTask explainTask = (ExplainTask) task0;
        ExplainWork w = explainTask.getWork();
        List<Task<?>> explainRoots = w.getRootTasks();

        for (Task<?> task : explainRoots) {

          Object work = task.getWork();
          if (work instanceof MapredWork) {
            MapredWork mapredWork = (MapredWork) work;
            MapWork mapWork = mapredWork.getMapWork();
            if (mapWork != null) {
              rootOps.addAll(mapWork.getAllRootOperators());
            }
            ReduceWork reduceWork = mapredWork.getReduceWork();
            if (reduceWork != null) {
              rootOps.addAll(reduceWork.getAllRootOperators());
            }
          }
          if (work instanceof TezWork) {
            for (BaseWork bw : ((TezWork) work).getAllWorkUnsorted()) {
              rootOps.addAll(bw.getAllRootOperators());
            }
          }
        }
      }

    }
    if (rootOps.isEmpty()) {
      return;
    }

    SemanticDispatcher disp = new DefaultRuleDispatcher(new EstimateCheckerHook(), new HashMap<>(), null);
    SemanticGraphWalker ogw = new DefaultGraphWalker(disp);

    HashMap<Node, Object> nodeOutput = new HashMap<Node, Object>();
    ogw.startWalking(rootOps, nodeOutput);

  }
Adds an extra check for Explain Analyze queries.
ql/src/java/org/apache/hadoop/hive/ql/hooks/AccurateEstimatesCheckerHook.java