static long getWriteId(EnvironmentContext context){
    return Optional.ofNullable(context)
      .map(EnvironmentContext::getProperties)
      .map(prop -> prop.get(hive_metastoreConstants.WRITE_ID))
      .map(Long::parseLong)
      .orElse(0L);
  }
Verify if update stats while altering partition(s)
For the following three cases HMS will not update partition stats
1) Table property 'DO_NOT_UPDATE_STATS' = True
2) HMS configuration property 'STATS_AUTO_GATHER' = False
3) Is View
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/HMSHandler.java