twalthr commented on a change in pull request #18088:
URL: https://github.com/apache/flink/pull/18088#discussion_r769837396



##########
File path: 
flink-table/flink-table-common/src/main/java/org/apache/flink/table/factories/FactoryUtil.java
##########
@@ -620,10 +624,16 @@ public static String getFormatPrefix(
             Class<T> factoryClass, DynamicTableFactory.Context context) {
         final String connectorOption = 
context.getCatalogTable().getOptions().get(CONNECTOR.key());
         if (connectorOption == null) {
-            throw new ValidationException(
-                    String.format(
-                            "Table options do not contain an option key '%s' 
for discovering a connector.",
-                            CONNECTOR.key()));
+            ManagedTableFactory factory =
+                    
ManagedTableFactory.discoverManagedTableFactory(context.getClassLoader());
+            if (!factoryClass.isAssignableFrom(factory.getClass())) {
+                throw new ValidationException(
+                        String.format(
+                                "The managed table factory '%s' dose not 
implement '%s'.",

Review comment:
       the exception contains a typo and is not very nice. in the end we should 
have a helpful exception that includes the old exception:
   
   ```
   Table options do not contain an option key '%s' for discovering a connector. 
Therefore, Flink assumes a managed table. However, a managed table factory is 
not in the classpath. 
   ```
   
   Either we wrap the original exception or call some internal discoverFactory 
with an optional return type.




-- 
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


Reply via email to