@Override
  protected void postProcess(TableName tableName, Table table, AlterTableAddPartitionDesc desc, Task<DDLWork> ddlTask)
      throws SemanticException {
    if (!AcidUtils.isTransactionalTable(table)) {
      return;
    }

    setAcidDdlDesc(desc);

    Long writeId = null;
    int stmtId = 0;

    for (AlterTableAddPartitionDesc.PartitionDesc partitionDesc : desc.getPartitions()) {
      if (partitionDesc.getLocation() != null) {
        AcidUtils.validateAcidPartitionLocation(partitionDesc.getLocation(), conf);
        if (desc.isIfNotExists()) {
          //Don't add partition data if it already exists
          Partition oldPart = PartitionUtils.getPartition(db, table, partitionDesc.getPartSpec(), false);
          if (oldPart != null) {
            continue;
          }
        }

        if (writeId == null) {
          // so that we only allocate a writeId if actually adding data (vs. adding a partition w/o data)
          queryState.getValidTxnList();
          try {
            writeId = getTxnMgr().getTableWriteId(table.getDbName(), table.getTableName());
          } catch (LockException ex) {
            throw new SemanticException("Failed to allocate the write id", ex);
          }
          stmtId = getTxnMgr().getStmtIdAndIncrement();
        }
        LoadTableDesc loadTableWork = new LoadTableDesc(new Path(partitionDesc.getLocation()),
            Utilities.getTableDesc(table), partitionDesc.getPartSpec(),
            LoadTableDesc.LoadFileType.KEEP_EXISTING, //not relevant - creating new partition
            writeId);
        loadTableWork.setStmtId(stmtId);
        loadTableWork.setInheritTableSpecs(true);
        try {
          partitionDesc.setLocation(new Path(table.getDataLocation(),
              Warehouse.makePartPath(partitionDesc.getPartSpec())).toString());
        } catch (MetaException ex) {
          throw new SemanticException("Could not determine partition path due to: " + ex.getMessage(), ex);
        }
        Task<MoveWork> moveTask = TaskFactory.get(
            new MoveWork(getInputs(), getOutputs(), loadTableWork, null,
                true, //make sure to check format
                false)); //is this right?
        ddlTask.addDependentTask(moveTask);
      }
    }
  }
Add partition for Transactional tables needs to add (copy/rename) the data so that it lands
in a delta_x_x/ folder in the partition dir.
ql/src/java/org/apache/hadoop/hive/ql/ddl/table/partition/add/AlterTableAddPartitionAnalyzer.java