Source:
<code>public List<Task<? extends Serializable>> handle(Context context) throws SemanticException { AlterPartitionMessage msg = deserializer.getAlterPartitionMessage(context.dmd.getPayload()); String actualDbName = context.isDbNameEmpty() ? msg.getDB() : context.dbName; String actualTblName = context.isTableNameEmpty() ? msg.getTable() : context.tableName; Map<String, String> newPartSpec = new LinkedHashMap<>(); Map<String, String> oldPartSpec = new LinkedHashMap<>(); String tableName = actualDbName + "." + actualTblName; try { Table tblObj = msg.getTableObj(); Iterator<String> beforeIterator = msg.getPtnObjBefore().getValuesIterator(); Iterator<String> afterIterator = msg.getPtnObjAfter().getValuesIterator(); for (FieldSchema fs : tblObj.getPartitionKeys()) { oldPartSpec.put(fs.getName(), beforeIterator.next()); newPartSpec.put(fs.getName(), afterIterator.next()); } } catch (Exception e) { throw (e instanceof SemanticException) ? (SemanticException) e : new SemanticException("Error reading message members", e); } RenamePartitionDesc renamePtnDesc = new RenamePartitionDesc( tableName, oldPartSpec, newPartSpec, context.eventOnlyReplicationSpec(), null); Task<DDLWork> renamePtnTask = TaskFactory.get( new DDLWork(readEntitySet, writeEntitySet, renamePtnDesc), context.hiveConf); context.log.debug("Added rename ptn task : {}:{}->{}", renamePtnTask.getId(), oldPartSpec, newPartSpec); updatedMetadata.set(context.dmd.getEventTo().toString(), actualDbName, actualTblName, newPartSpec); try { <START> return Collections.singletonList(ReplUtils.appendOpenTxnTaskForMigration(actualDbName, actualTblName, <END> context.hiveConf, updatedMetadata, renamePtnTask, msg.getTableObj())); } catch (Exception e) { throw new SemanticException(e.getMessage()); } }</code><technical_language>Rename partition rename table need start txn write new</technical_language>

Target:
public List<Task<? extends Serializable>> handle(Context context) throws SemanticException { AlterPartitionMessage msg = deserializer.getAlterPartitionMessage(context.dmd.getPayload()); String actualDbName = context.isDbNameEmpty() ? msg.getDB() : context.dbName; String actualTblName = context.isTableNameEmpty() ? msg.getTable() : context.tableName; Map<String, String> newPartSpec = new LinkedHashMap<>(); Map<String, String> oldPartSpec = new LinkedHashMap<>(); String tableName = actualDbName + "." + actualTblName; try { Iterator<String> beforeIterator = msg.getPtnObjBefore().getValuesIterator(); Iterator<String> afterIterator = msg.getPtnObjAfter().getValuesIterator(); for (FieldSchema fs : msg.getTableObj().getPartitionKeys()) { oldPartSpec.put(fs.getName(), beforeIterator.next()); newPartSpec.put(fs.getName(), afterIterator.next()); } } catch (Exception e) { throw (e instanceof SemanticException) ? (SemanticException) e : new SemanticException("Error reading message members", e); } RenamePartitionDesc renamePtnDesc = new RenamePartitionDesc( tableName, oldPartSpec, newPartSpec, context.eventOnlyReplicationSpec(), null); Task<DDLWork> renamePtnTask = TaskFactory.get( new DDLWork(readEntitySet, writeEntitySet, renamePtnDesc), context.hiveConf); context.log.debug("Added rename ptn task : {}:{}->{}", renamePtnTask.getId(), oldPartSpec, newPartSpec); updatedMetadata.set(context.dmd.getEventTo().toString(), actualDbName, actualTblName, newPartSpec); return Collections.singletonList(renamePtnTask); }