@Test
  public void testRenamePartition() throws Exception {

    List<List<String>> oldValues = createTable4PartColsParts(client);
    List<List<String>> newValues = new ArrayList<>();

    List<String> newVal = Lists.newArrayList("2018", "01", "16");
    newValues.addAll(oldValues.subList(0, 3));
    newValues.add(newVal);

    List<Partition> oldParts = client.listPartitions(DB_NAME, TABLE_NAME, (short)-1);

    Partition partToRename = oldParts.get(3);
    partToRename.setValues(newVal);
    makeTestChangesOnPartition(partToRename);
    client.renamePartition(DB_NAME, TABLE_NAME, oldValues.get(3), partToRename);

    List<Partition> newParts = client.listPartitions(DB_NAME, TABLE_NAME, (short)-1);
    assertPartitionsHaveCorrectValues(newParts, newValues);


    //Asserting other partition parameters can also be changed, but not the location
    assertFalse(newParts.get(3).getSd().getLocation().endsWith("hh=01"));
    assertEquals(3, newParts.get(3).getSd().getCols().size());
    assertEquals("testValue001", newParts.get(3).getParameters().get("hmsTestParam001"));
    assertEquals(NEW_CREATE_TIME, newParts.get(3).getCreateTime());
    assertEquals(NEW_CREATE_TIME, newParts.get(3).getLastAccessTime());



    assertTrue(client.listPartitions(DB_NAME, TABLE_NAME, oldValues.get(3), (short)-1).isEmpty());
  }
Testing
   renamePartition(String,String,List(String),Partition) ->
   renamePartition(String,String,List(String),Partition).
standalone-metastore/metastore-server/src/test/java/org/apache/hadoop/hive/metastore/client/TestAlterPartitions.java