private EnvironmentContext initializeEnvironmentContext(Table table, EnvironmentContext environmentContext) {
    EnvironmentContext result = environmentContext == null ? new EnvironmentContext() : environmentContext;
    // do not need to update stats in alter table/partition operations
    if (result.getProperties() == null ||
        result.getProperties().get(StatsSetupConst.DO_NOT_UPDATE_STATS) == null) {
      result.putToProperties(StatsSetupConst.DO_NOT_UPDATE_STATS, StatsSetupConst.TRUE);
    }
    HiveStorageHandler storageHandler = table.getStorageHandler();
    if (storageHandler != null) {
      storageHandler.prepareAlterTableEnvironmentContext(desc, result);
    }
    return result;
  }
Operation process of running some alter table command that requires write id.
ql/src/java/org/apache/hadoop/hive/ql/ddl/table/AbstractAlterTableOperation.java