Source:
<code>private void testAddPartition(URI uri, String tableName, String partitionName) throws Exception { AlterTableDesc alterTableDesc = new AlterTableDesc(); alterTableDesc.setTableName(DB_NAME + "." + tableName); alterTableDesc.setAlterTableType(AlterTableType.ADD_PARTITION); Path path = new Path(uri.getPath(), partitionName); PartitionDesc partitionDesc = new PartitionDesc(); partitionDesc.setPartitionName(partitionName); List<PartitionKeyProto> partitionKeyList = new ArrayList<>(); String[] partitionNames = partitionName.split("/"); <START> for (String partitionName1 : partitionNames) { <END> String[] eachPartitionName = partitionName1.split("="); PartitionKeyProto.Builder builder = PartitionKeyProto.newBuilder(); builder.setColumnName(eachPartitionName[0]); builder.setPartitionValue(eachPartitionName[1]); partitionKeyList.add(builder.build()); } partitionDesc.setPartitionKeys(partitionKeyList); partitionDesc.setPath(path.toString()); alterTableDesc.setPartitionDesc(partitionDesc); store.alterTable(alterTableDesc.getProto()); CatalogProtos.PartitionDescProto resultDesc = store.getPartition(DB_NAME, NATION, partitionName); assertNotNull(resultDesc); assertEquals(resultDesc.getPartitionName(), partitionName); assertEquals(resultDesc.getPath(), uri.toString() + "/" + partitionName); assertEquals(resultDesc.getPartitionKeysCount(), 2); for (int i = 0; i < resultDesc.getPartitionKeysCount(); i++) { CatalogProtos.PartitionKeyProto keyProto = resultDesc.getPartitionKeys(i); String[] eachName = partitionNames[i].split("="); assertEquals(keyProto.getPartitionValue(), eachName[1]); } }</code><technical_language>partitionName</technical_language>

Target:
private void testAddPartition(URI uri, String tableName, String partitionName) throws Exception { AlterTableDesc alterTableDesc = new AlterTableDesc(); alterTableDesc.setTableName(DB_NAME + "." + tableName); alterTableDesc.setAlterTableType(AlterTableType.ADD_PARTITION); Path path = new Path(uri.getPath(), partitionName); PartitionDesc partitionDesc = new PartitionDesc(); partitionDesc.setPartitionName(partitionName); List<PartitionKeyProto> partitionKeyList = new ArrayList<>(); String[] partitionNames = partitionName.split("/"); for (String aName : partitionNames) { String[] eachPartitionName = aName.split("="); PartitionKeyProto.Builder builder = PartitionKeyProto.newBuilder(); builder.setColumnName(eachPartitionName[0]); builder.setPartitionValue(eachPartitionName[1]); partitionKeyList.add(builder.build()); } partitionDesc.setPartitionKeys(partitionKeyList); partitionDesc.setPath(path.toString()); alterTableDesc.setPartitionDesc(partitionDesc); store.alterTable(alterTableDesc.getProto()); CatalogProtos.PartitionDescProto resultDesc = store.getPartition(DB_NAME, NATION, partitionName); assertNotNull(resultDesc); assertEquals(resultDesc.getPartitionName(), partitionName); assertEquals(resultDesc.getPath(), uri.toString() + "/" + partitionName); assertEquals(resultDesc.getPartitionKeysCount(), 2); for (int i = 0; i < resultDesc.getPartitionKeysCount(); i++) { CatalogProtos.PartitionKeyProto keyProto = resultDesc.getPartitionKeys(i); String[] eachName = partitionNames[i].split("="); assertEquals(keyProto.getPartitionValue(), eachName[1]); } }