public void alterResource(AlterResourceStmt stmt) throws DdlException {
        this.writeLock();
        try {
            // check if the target resource exists .
            String name = stmt.getResourceName();
            Resource resource = this.getResource(name);
            if (resource == null) {
                throw new DdlException("Resource(" + name + ") does not exist");
            }

            // 1. alter the resource properties
            // 2. clear the cache
            // 3. update the edit log
            if (resource instanceof HiveResource) {
                ((HiveResource) resource).alterProperties(stmt.getProperties());
            } else if (resource instanceof HudiResource) {
                ((HudiResource) resource).alterProperties(stmt.getProperties());
            } else if (resource instanceof IcebergResource) {
                ((IcebergResource) resource).alterProperties(stmt.getProperties());
            } else {
                throw new DdlException("Alter resource statement only support external hive/hudi/iceberg now");
            }

            if (resource.needMappingCatalog()) {
                String type = resource.getType().name().toLowerCase(Locale.ROOT);
                String catalogName = getResourceMappingCatalogName(resource.getName(), type);
                DropCatalogStmt dropCatalogStmt = new DropCatalogStmt(catalogName);
                GlobalStateMgr.getCurrentState().getCatalogMgr().dropCatalog(dropCatalogStmt);

                Map<String, String> properties = Maps.newHashMap(stmt.getProperties());
                properties.put("type", type);
                String uriInProperties = stmt.getProperties().get(HIVE_METASTORE_URIS);
                String uris = uriInProperties == null ? resource.getHiveMetastoreURIs() : uriInProperties;
                properties.put(HIVE_METASTORE_URIS, uris);
                GlobalStateMgr.getCurrentState().getCatalogMgr().createCatalog(type, catalogName, "mapping catalog", properties);
            }

            GlobalStateMgr.getCurrentState().getEditLog().logCreateResource(resource);
        } finally {
            this.writeUnLock();
        }
    }
@Test
    public void testAlterResource(@Injectable EditLog editLog, @Mocked GlobalStateMgr globalStateMgr) throws UserException {
        ResourceMgr mgr = new ResourceMgr();

        // add hive resource
        name = "hive0";
        type = "hive";
        addHiveResource(mgr, editLog, globalStateMgr);

        // alter hive resource
        String newThriftPath = "thrift://10.10.44.xxx:9083";
        Map<String, String> properties = new HashMap<>();
        properties.put("hive.metastore.uris", newThriftPath);
        AlterResourceStmt stmt = new AlterResourceStmt(name, properties);
        com.starrocks.sql.analyzer.Analyzer.analyze(stmt, connectContext);
        mgr.alterResource(stmt);

        // assert
        Resource resource = mgr.getResource(name);
        Assert.assertTrue(resource instanceof HiveResource);

        String metastoreURIs = ((HiveResource) resource).getHiveMetastoreURIs();
        Assert.assertEquals(newThriftPath, metastoreURIs);
    }