public List<String> getDDLPlanForPartitionWithStats(Table table,
                                                      Map<String, List<Partition>> tableToPartitionList
  ) throws HiveException {
    List<String> alterTableStmt = new ArrayList<String>();
    String tableName = table.getTableName();
    for (Partition pt : tableToPartitionList.get(tableName)) {
      alterTableStmt.add(getAlterTableAddPartition(pt));
      alterTableStmt.add(getAlterTableStmtPartitionStatsBasic(pt));
    }
    String databaseName = table.getDbName();
    List<String> partNames = new ArrayList<String>();
    //TODO : Check if only Accessed Column Statistics Can be Retrieved From the HMS.
    List<String> columnNames = getTableColumnNames(table);
    tableToPartitionList.get(tableName).forEach(p -> partNames.add(p.getName()));
    Map<String, List<ColumnStatisticsObj>> partitionColStats =
      Hive.get().getPartitionColumnStatistics(databaseName,
        tableName, partNames, columnNames,
        true);
    Map<String, String> partitionToActualName = new HashMap<>();
    tableToPartitionList.get(tableName).forEach(p -> partitionToActualName.put(p.getName(), getPartitionActualName(p)));
    partitionColStats.keySet().stream().sorted().forEach(partitionName ->
      alterTableStmt.addAll(getAlterTableStmtPartitionStatsColsAll(partitionColStats.get(partitionName),
        tableName, partitionToActualName.get(partitionName),
        databaseName))
    );
    return alterTableStmt;
  }
Parses the basic table statistics for the given table.

@param pt
@return Returns the alter table .... update statistics for partition.
ql/src/java/org/apache/hadoop/hive/ql/exec/DDLPlanUtils.java