public static DatabaseName fromString(String name, String defaultCatalog) {
    if (name.contains(CAT_DB_TABLE_SEPARATOR)) {
      String[] names = name.split("\\.");
      if (names.length != 2) {
        throw new RuntimeException("Database name must be either <dbname> or <catname>.<dbname>");
      }
      return new DatabaseName(names[0], names[1]);
    } else {
      assert defaultCatalog != null;
      return new DatabaseName(defaultCatalog, name);
    }
  }
Build a DatabaseName from a string of the form [catalog.]database.
@param name name, can be "db" or "cat.db"
@param defaultCatalog default catalog to use if catalog name is not in the name.  This can
                      be null if you are absolutely certain that the catalog name is
                      embedded in name.  If you want the default catalog to be determined by
                      the session, use SessionState.getCurrentCatalog().  If you want it to
                      be determined by the default for the Hive instance or you are not in a
                      session, use MetaStoreUtils.getDefaultCatalog().
@return new DatabaseName object.
storage-api/src/java/org/apache/hadoop/hive/common/DatabaseName.java