@Override
    public Catalog createCatalog(Context context) {
        final FactoryUtil.CatalogFactoryHelper helper =
                FactoryUtil.createCatalogFactoryHelper(this, context);
        helper.validate();

        return new HiveCatalog(
                context.getName(),
                helper.getOptions().get(DEFAULT_DATABASE),
                helper.getOptions().get(HIVE_CONF_DIR),
                helper.getOptions().get(HADOOP_CONF_DIR),
                helper.getOptions().get(HIVE_VERSION));
    }
@Test
    public void testCreateHiveCatalogWithHadoopConfDir() throws IOException {
        final String catalogName = "mycatalog";

        final String hadoopConfDir = tempFolder.newFolder().getAbsolutePath();
        final File mapredSiteFile = new File(hadoopConfDir, "mapred-site.xml");
        final String mapredKey = "mapred.site.config.key";
        final String mapredVal = "mapred.site.config.val";
        writeProperty(mapredSiteFile, mapredKey, mapredVal);

        final HiveCatalog expectedCatalog =
                HiveTestUtils.createHiveCatalog(
                        catalogName, CONF_DIR.getPath(), hadoopConfDir, null);

        final Map<String, String> options = new HashMap<>();
        options.put(CommonCatalogOptions.CATALOG_TYPE.key(), HiveCatalogFactoryOptions.IDENTIFIER);
        options.put(HiveCatalogFactoryOptions.HIVE_CONF_DIR.key(), CONF_DIR.getPath());
        options.put(HiveCatalogFactoryOptions.HADOOP_CONF_DIR.key(), hadoopConfDir);

        final Catalog actualCatalog =
                FactoryUtil.createCatalog(
                        catalogName, options, null, Thread.currentThread().getContextClassLoader());

        checkEquals(expectedCatalog, (HiveCatalog) actualCatalog);
        assertThat(((HiveCatalog) actualCatalog).getHiveConf().get(mapredKey)).isEqualTo(mapredVal);
    }