private List<Partition> getPartitions(Table table, long writeId) throws HiveException {
    List<Partition> partitions = new ArrayList<>(desc.getPartitions().size());
    for (AlterTableAddPartitionDesc.PartitionDesc partitionDesc : desc.getPartitions()) {
      Partition partition = convertPartitionSpecToMetaPartition(table, partitionDesc);
      if (partition != null && writeId > 0) {
        partition.setWriteId(writeId);
      }
      partitions.add(partition);
    }

    return partitions;
  }
Operation process of adding a partition to a table.
ql/src/java/org/apache/hadoop/hive/ql/ddl/table/partition/add/AlterTableAddPartitionOperation.java