public static String prependCatalogToDbName(@Nullable String catalogName, @Nullable String dbName,
                                              Configuration conf) {
    if (catalogName == null) {
      catalogName = getDefaultCatalog(conf);
    }
    StringBuilder buf = new StringBuilder()
        .append(CATALOG_DB_THRIFT_NAME_MARKER)
        .append(catalogName)
        .append(CATALOG_DB_SEPARATOR);
    if (dbName != null) {
      if (dbName.isEmpty()) {
        buf.append(DB_EMPTY_MARKER);
      } else {
        buf.append(dbName);
      }
    }
    return buf.toString();
  }
Given a catalog name and database name cram them together into one string.  This method can
be used if you do not know the catalog name, in which case the default catalog will be
retrieved from the conf object.  The resulting string can be parsed apart again via
{@link #parseDbName(String, Configuration)}.
@param catalogName catalog name, can be null if no known.
@param dbName database name, can be null or empty.
@param conf configuration object, used to determine default catalog if catalogName is null
@return one string that contains both.
standalone-metastore/metastore-common/src/main/java/org/apache/hadoop/hive/metastore/utils/MetaStoreUtils.java