public static String verifyStatsChangeCtx(String fullTableName, Map<String, String> oldP, Map<String, String> newP,
                                            long writeId, String validWriteIds, boolean isColStatsChange) {
    if (validWriteIds != null && writeId > 0) {
      return null; // We have txn context.
    }

    if (!StatsSetupConst.areBasicStatsUptoDate(newP)) {
      // The validWriteIds can be absent, for example, in case of Impala alter.
      // If the new value is invalid, then we don't care, let the alter operation go ahead.
      return null;
    }

    String oldVal = oldP == null ? null : oldP.get(StatsSetupConst.COLUMN_STATS_ACCURATE);
    String newVal = newP == null ? null : newP.get(StatsSetupConst.COLUMN_STATS_ACCURATE);
    if (StringUtils.equalsIgnoreCase(oldVal, newVal)) {
      if (!isColStatsChange) {
        return null; // No change in col stats or parameters => assume no change.
      }
    }

    // Some change to the stats state is being made; it can only be made with a write ID.
    return "Cannot change stats state for a transactional table " + fullTableName + " without " +
            "providing the transactional write state for verification (new write ID " +
            writeId + ", valid write IDs " + validWriteIds + "; current state " + oldVal + "; new" +
            " state " + newVal;
  }
Verifies that the stats JSON string is unchanged for alter table (txn stats).
@return Error message with the details of the change, or null if the value has not changed.
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/ObjectStore.java