dawidwys commented on a change in pull request #8852:  
[FLINK-12798][table-api][table-planner] Add a proper discover mechanism that 
will  enable switching between Flink & Blink Planner/Executor
URL: https://github.com/apache/flink/pull/8852#discussion_r310503698
 
 

 ##########
 File path: 
flink-table/flink-table-common/src/main/java/org/apache/flink/table/factories/TableFactoryService.java
 ##########
 @@ -103,9 +106,52 @@
         * @param <T> factory class type
         * @return the matching factory
         */
-       public static <T> T find(Class<T> factoryClass, Map<String, String> 
propertyMap, ClassLoader classLoader) {
+       public static <T extends TableFactory> T find(
+                       Class<T> factoryClass,
+                       Map<String, String> propertyMap,
+                       ClassLoader classLoader) {
                Preconditions.checkNotNull(classLoader);
-               return findInternal(factoryClass, propertyMap, 
Optional.of(classLoader));
+               return findSingleInternal(factoryClass, propertyMap, 
Optional.of(classLoader));
+       }
+
+       /**
+        * Finds all table factories of the given class and property map.
+        *
+        * @param factoryClass desired factory class
+        * @param propertyMap properties that describe the factory configuration
+        * @param <T> factory class type
+        * @return all the matching factories
+        */
+       public static <T extends TableFactory> List<T> findAll(Class<T> 
factoryClass, Map<String, String> propertyMap) {
+               return findAllInternal(factoryClass, propertyMap, 
Optional.empty());
 
 Review comment:
   Hi @ssquan What is the exception you are getting? The `defaultLoader` 
actually already uses the user classloader. Could you make sure you have proper 
entries in the 
`META-INF/services/org.apache.flink.table.factories.TableFactory`. You might 
need a 
`https://maven.apache.org/plugins/maven-shade-plugin/examples/resource-transformers.html#ServicesResourceTransformer`
 if you have services coming from multiple dependencies.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to