private void alterPartitionAndCheck(Table table, String column, String value, String location) throws Exception {
    assertNotNull(location);
    executeQuery("ALTER TABLE " + table.getTableName() +
        " PARTITION (" + column + "='" + value + "')" +
        " SET LOCATION '" + location + "'");
    HashMap<String, String> partitions = new HashMap<String, String>();
    partitions.put(column, value);
    Partition partition = db.getPartition(table, partitions, false);
    assertNotNull("Partition object is expected for " + table.getTableName() , partition);
    String locationActual = partition.getLocation();
    if (new Path(location).toUri().getScheme() != null) {
      assertEquals("Partition should be located in the first filesystem",
          fs.makeQualified(new Path(location)).toString(), locationActual);
    }
    else {
      assertEquals("Partition should be located in the second filesystem",
          fs2.makeQualified(new Path(location)).toString(), locationActual);
    }
  }
Tests DDL with remote metastore service and second namenode (HIVE-6374)
itests/hive-unit/src/test/java/org/apache/hadoop/hive/ql/TestDDLWithRemoteMetastoreSecondNamenode.java