twalthr commented on code in PR #27531:
URL: https://github.com/apache/flink/pull/27531#discussion_r2788715554
##########
flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/factories/TableFactoryUtil.java:
##########
Review Comment:
nit: feel free to annotate this class with `@Deprecated` and point people to
Factory.java
##########
flink-table/flink-table-api-java-bridge/src/main/java/org/apache/flink/table/api/bridge/java/internal/StreamTableEnvironmentImpl.java:
##########
@@ -112,17 +113,21 @@ public static StreamTableEnvironment create(
new ResourceManager(settings.getConfiguration(),
userClassLoader);
final ModuleManager moduleManager = new ModuleManager();
- final CatalogStoreFactory catalogStoreFactory =
- TableFactoryUtil.findAndCreateCatalogStoreFactory(
- settings.getConfiguration(), userClassLoader);
- final CatalogStoreFactory.Context catalogStoreFactoryContext =
- TableFactoryUtil.buildCatalogStoreFactoryContext(
- settings.getConfiguration(), userClassLoader);
- catalogStoreFactory.open(catalogStoreFactoryContext);
- final CatalogStore catalogStore =
- settings.getCatalogStore() != null
- ? settings.getCatalogStore()
- : catalogStoreFactory.createCatalogStore();
+ final CatalogStore catalogStore;
+ final CatalogStoreFactory catalogStoreFactory;
+ if (settings.getCatalogStore().isPresent()) {
+ catalogStore = settings.getCatalogStore().get();
+ catalogStoreFactory = null;
+ } else {
+ catalogStoreFactory =
+ ApiFactoryUtil.findAndCreateCatalogStoreFactory(
+ settings.getConfiguration(), userClassLoader);
+ final CatalogStoreFactory.Context catalogStoreFactoryContext =
+ ApiFactoryUtil.buildCatalogStoreFactoryContext(
+ settings.getConfiguration(), userClassLoader);
+ catalogStoreFactory.open(catalogStoreFactoryContext);
+ catalogStore = catalogStoreFactory.createCatalogStore();
Review Comment:
Can we move this code also to `ApiFactoryUtil`? In the end the signature can
be `ApiFactoryUtil.getOrCreateCatalogStore(@Nullable CatalogStore
providedCatalogStore)`. This avoids duplicate code in
`TableEnvironmentImpl.java`
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]