@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 testCreateMultipleHiveCatalog() throws Exception {
        final Map<String, String> props1 = new HashMap<>();
        props1.put(CommonCatalogOptions.CATALOG_TYPE.key(), HiveCatalogFactoryOptions.IDENTIFIER);
        props1.put(
                HiveCatalogFactoryOptions.HIVE_CONF_DIR.key(),
                Thread.currentThread()
                        .getContextClassLoader()
                        .getResource("test-multi-hive-conf1")
                        .getPath());

        final Map<String, String> props2 = new HashMap<>();
        props2.put(CommonCatalogOptions.CATALOG_TYPE.key(), HiveCatalogFactoryOptions.IDENTIFIER);
        props2.put(
                HiveCatalogFactoryOptions.HIVE_CONF_DIR.key(),
                Thread.currentThread()
                        .getContextClassLoader()
                        .getResource("test-multi-hive-conf2")
                        .getPath());

        Callable<Catalog> callable1 =
                () ->
                        FactoryUtil.createCatalog(
                                "cat1",
                                props1,
                                null,
                                Thread.currentThread().getContextClassLoader());

        Callable<Catalog> callable2 =
                () ->
                        FactoryUtil.createCatalog(
                                "cat2",
                                props2,
                                null,
                                Thread.currentThread().getContextClassLoader());

        ExecutorService executorService = EXECUTOR_RESOURCE.getExecutor();
        Future<Catalog> future1 = executorService.submit(callable1);
        Future<Catalog> future2 = executorService.submit(callable2);

        HiveCatalog catalog1 = (HiveCatalog) future1.get();
        HiveCatalog catalog2 = (HiveCatalog) future2.get();

        // verify we read our own props
        assertThat(catalog1.getHiveConf().get("key")).isEqualTo("val1");
        assertThat(catalog1.getHiveConf().get("conf1", null)).isNotNull();
        // verify we don't read props from other conf
        assertThat(catalog1.getHiveConf().get("conf2", null)).isNull();

        // verify we read our own props
        assertThat(catalog2.getHiveConf().get("key")).isEqualTo("val2");
        assertThat(catalog2.getHiveConf().get("conf2", null)).isNotNull();
        // verify we don't read props from other conf
        assertThat(catalog2.getHiveConf().get("conf1", null)).isNull();
    }