public List<String> listTableNames(String catalogName, String dbName) {
        Optional<ConnectorMetadata> connectorMetadata = getOptionalMetadata(catalogName);
        ImmutableSet.Builder<String> tableNames = ImmutableSet.builder();
        if (connectorMetadata.isPresent()) {
            try {
                connectorMetadata.get().listTableNames(dbName).forEach(tableNames::add);
            } catch (Exception e) {
                LOG.error("Failed to listTableNames on [{}.{}]", catalogName, dbName, e);
                throw e;
            }
        }
        return ImmutableList.copyOf(tableNames.build());
    }
@Test
    public void testListTblNames(@Mocked HiveMetaStoreClient metaStoreThriftClient) throws TException, DdlException {
        new Expectations() {
            {
                metaStoreThriftClient.getAllTables("db2");
                result = Lists.newArrayList("tbl2");
                minTimes = 0;
            }
        };

        MetadataMgr metadataMgr = GlobalStateMgr.getCurrentState().getMetadataMgr();

        List<String> internalTables = metadataMgr.listTableNames("default_catalog", "db1");
        Assert.assertTrue(internalTables.contains("tbl1"));
        try {
            metadataMgr.listTableNames("default_catalog", "db_foo");
            Assert.fail();
        } catch (StarRocksConnectorException e) {
            Assert.assertTrue(e.getMessage().contains("Database db_foo doesn't exist"));
        }


        List<String> externalTables = metadataMgr.listTableNames("hive_catalog", "db2");
        Assert.assertTrue(externalTables.contains("tbl2"));
        externalTables = metadataMgr.listTableNames("hive_catalog", "db3");
        Assert.assertTrue(externalTables.isEmpty());
    }