liyubin117 commented on code in PR #24735: URL: https://github.com/apache/flink/pull/24735#discussion_r1592191396
########## flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/catalog/CatalogManager.java: ########## @@ -321,6 +322,42 @@ public void createCatalog(String catalogName, CatalogDescriptor catalogDescripto catalogStoreHolder.catalogStore().storeCatalog(catalogName, catalogDescriptor); } + /** + * Alters a catalog under the given name. The catalog name must be unique. + * + * @param catalogName the given catalog name under which to alter the given catalog + * @param catalogDescriptor catalog descriptor for altering catalog + * @throws CatalogException If the catalog neither exists in the catalog store nor in the + * initialized catalogs, or if an error occurs while creating the catalog or storing the + * {@link CatalogDescriptor} + */ + public void alterCatalog(String catalogName, CatalogDescriptor catalogDescriptor) + throws CatalogException { + checkArgument( + !StringUtils.isNullOrWhitespaceOnly(catalogName), + "Catalog name cannot be null or empty."); + checkNotNull(catalogDescriptor, "Catalog descriptor cannot be null"); + CatalogStore catalogStore = catalogStoreHolder.catalogStore(); + Optional<CatalogDescriptor> oldCatalogDescriptor = getCatalogDescriptor(catalogName); + if (catalogStore.contains(catalogName) && oldCatalogDescriptor.isPresent()) { + Map<String, String> props = oldCatalogDescriptor.get().getConfiguration().toMap(); + props.putAll(catalogDescriptor.getConfiguration().toMap()); + CatalogDescriptor newCatalogDescriptor = + CatalogDescriptor.of(catalogName, Configuration.fromMap(props)); + Catalog catalog = initCatalog(catalogName, newCatalogDescriptor); Review Comment: Good idea :) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@flink.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org