atlas icon indicating copy to clipboard operation
atlas copied to clipboard

The method hivedb. Getcatalogname() does not exist in version 2.0

Open xinda77 opened this issue 5 years ago • 3 comments

xinda77 avatar Dec 05 '19 05:12 xinda77

@xinda77 - can you please file a JIRA in https://issues.apache.org/jira/ with details of the issue?

mneethiraj avatar Dec 05 '19 06:12 mneethiraj

the temporary way is update method getDatabaseName() in HiveMetaStoreBridge.java like this:

public static String getDatabaseName(Database hiveDB) {
        /*String dbName      = hiveDB.getName().toLowerCase();
        String catalogName = hiveDB.getCatalogName() != null ? hiveDB.getCatalogName().toLowerCase() : null;

        if (StringUtils.isNotEmpty(catalogName) && !StringUtils.equals(catalogName, DEFAULT_METASTORE_CATALOG)) {
            dbName = catalogName + SEP + dbName;
        }

        return dbName;*/
        String dbName      = hiveDB.getName().toLowerCase();
        //String catalogName = hiveDB.getCatalogName() != null ? hiveDB.getCatalogName().toLowerCase() : null;
        String catalogName = null;
        try {
            if (hiveDB.getCatalogName() != null) {
                catalogName = hiveDB.getCatalogName().toLowerCase();
            }
        } catch (NoSuchMethodError e) {
            LOG.warn("Failed while getting catalog name of database");
        }

        if (StringUtils.isNotEmpty(catalogName) && !StringUtils.equals(catalogName, DEFAULT_METASTORE_CATALOG)) {
            dbName = catalogName + SEP + dbName;
        }

        return dbName;
    }

just try-catch it,package and instaead of hive-bridge-{project.version}.jar

RickyLoveFreedom avatar Mar 05 '21 02:03 RickyLoveFreedom

@JavaLover4Ricky - your suggestion sounds good. Do you want to file a JIRA and create a patch? Thanks!

mneethiraj avatar Mar 05 '21 17:03 mneethiraj