public Path getDatabaseExternalPath(Database db) throws MetaException {
      Path dbPath = new Path(db.getLocationUri());
      if (FileUtils.isSubdirectory(getWhRoot().toString(), dbPath.toString() + Path.SEPARATOR)) {
        // db metadata incorrect, find new location based on external warehouse root
        dbPath = getDefaultExternalDatabasePath(db.getName());
      }
      return getDnsPath(dbPath);
  }
Get the external tables path specified by the database.  In the case of the default database the root of the
warehouse is returned.
@param db database to get the path of
@return path to the database directory
@throws MetaException when the file path cannot be properly determined from the configured
file system.
standalone-metastore/metastore-common/src/main/java/org/apache/hadoop/hive/metastore/Warehouse.java