public Object process(StatsAggregator statsAggregator) throws HiveException, MetaException {
      Partish p = partish;
      Map<String, String> parameters = p.getPartParameters();
      if (work.isTargetRewritten()) {
        StatsSetupConst.setBasicStatsState(parameters, StatsSetupConst.TRUE);
      }

      // work.getTableSpecs() == null means it is not analyze command
      // and then if it is not followed by column stats, we should clean
      // column stats
      // FIXME: move this to ColStat related part
      if (!work.isExplicitAnalyze() && !followedColStats1) {
        StatsSetupConst.clearColumnStatsState(parameters);
      }

      if (partfileStatus == null && providedBasicStats == null) {
        // This may happen if ACID state is absent from config.
        String spec =  partish.getPartition() == null ? partish.getTable().getTableName()
            :  partish.getPartition().getSpec().toString();
        LOG.warn("Partition/partfiles is null for: " + spec);
        if (isMissingAcidState) {
          MetaStoreServerUtils.clearQuickStats(parameters);
          return p.getOutput();
        }
        return null;
      }

      // The collectable stats for the aggregator needs to be cleared.
      // For example, if a file is being loaded, the old number of rows are not valid
      // XXX: makes no sense for me... possibly not needed anymore
      if (work.isClearAggregatorStats()) {
        // we choose to keep the invalid stats and only change the setting.
        StatsSetupConst.setBasicStatsState(parameters, StatsSetupConst.FALSE);
      }

      if (providedBasicStats == null) {
        MetaStoreServerUtils.populateQuickStats(partfileStatus, parameters);
      } else {
        parameters.putAll(providedBasicStats);
      }

      if (statsAggregator != null && !skipStatsUpdate) {
        // Update stats for transactional tables (MM, or full ACID with overwrite), even
        // though we are marking stats as not being accurate.
        if (StatsSetupConst.areBasicStatsUptoDate(parameters) || p.isTransactionalTable()) {
          String prefix = getAggregationPrefix(p.getTable(), p.getPartition());
          updateStats(statsAggregator, parameters, prefix);
        }
      }

      return p.getOutput();
    }
StatsTask implementation. StatsTask mainly deals with "collectable" stats. These are
stats that require data scanning and are collected during query execution (unless the user
explicitly requests data scanning just for the purpose of stats computation using the "ANALYZE"
command. All other stats are computed directly by the MetaStore. The rationale being that the
MetaStore layer covers all Thrift calls and provides better guarantees about the accuracy of
those stats.
ql/src/java/org/apache/hadoop/hive/ql/stats/BasicStatsTask.java