private boolean deletePartitionLocation(Partition partition, boolean purgeData) throws MetaException {
    String location = partition.getSd().getLocation();
    if (location != null) {
      Path path = getWh().getDnsPath(new Path(location));
      try {
        do {
          if (!getWh().deleteDir(path, true, purgeData, false)) {
            throw new MetaException("Unable to delete partition at " + location);
          }
          path = path.getParent();
        } while (getWh().isEmptyDir(path));
      } catch (IOException e) {
        throw new MetaException("Unable to delete partition at " + path.toString());
      }
      return true;
    }
    return false;
  }
Delete the directory where the partition resides.
@param partition instance of partition, must be not null
@param purgeData purge the data
@return true if delete was successful
@throws MetaException if delete fails
ql/src/java/org/apache/hadoop/hive/ql/metadata/SessionHiveMetaStoreClient.java