@Override
  @Test
  public void testExchangePartitionsCustomTableAndPartLocation() throws Exception {
    Table source = createTable(DB_NAME, "test_source_table_cust_loc",
        getYearMonthAndDayPartCols(), getMetaStore().getWarehouseRoot() + "/sourceTable");
    Table dest = createTable(DB_NAME, "test_dest_table_cust_loc", getYearMonthAndDayPartCols(),
        getMetaStore().getWarehouseRoot() + "/destTable");
    org.apache.hadoop.hive.metastore.api.Partition[] parts = new Partition[2];
    parts[0] = createPartition(source, Lists.newArrayList("2019", "may", "11"),
        source.getSd().getLocation() + "/2019m11");
    parts[1] = createPartition(source, Lists.newArrayList("2019", "july", "23"),
        source.getSd().getLocation() + "/2019j23");

    Map<String, String> partitionSpecs = getPartitionSpec(parts[1]);
    getClient().exchange_partitions(partitionSpecs, source.getDbName(),
        source.getTableName(), dest.getDbName(), dest.getTableName());

    checkRemainingPartitions(source, dest, Lists.newArrayList(parts[0]));
    List<Partition> destTablePartitions = getClient().listPartitions(dest.getDbName(), dest.getTableName(), (short) -1);
    Assert.assertEquals(1, destTablePartitions.size());
    checkExchangedPartitions(source, dest, Lists.newArrayList(parts[1]));
  }
Test class for exchange partitions related methods on temporary tables.
ql/src/test/org/apache/hadoop/hive/ql/metadata/TestSessionHiveMetastoreClientExchangePartitionsTempTable.java