@Override
  public int execute() throws HiveException {
    // TODO: catalog name everywhere in this method
    Table table = context.getDb().getTable(desc.getDbName(), desc.getTableName());
    long writeId = getWriteId(table);

    List<Partition> partitions = getPartitions(table, writeId);
    addPartitions(table, partitions, writeId);
    return 0;
  }
Operation process of adding a partition to a table.
ql/src/java/org/apache/hadoop/hive/ql/ddl/table/partition/add/AlterTableAddPartitionOperation.java