wuchong commented on a change in pull request #13679:
URL: https://github.com/apache/flink/pull/13679#discussion_r507875435



##########
File path: 
flink-table/flink-table-planner-blink/src/test/java/org/apache/flink/table/planner/factories/TestValuesTableFactory.java
##########
@@ -315,15 +320,28 @@ public DynamicTableSource 
createDynamicTableSource(Context context) {
        public DynamicTableSink createDynamicTableSink(Context context) {
                FactoryUtil.TableFactoryHelper helper = 
FactoryUtil.createTableFactoryHelper(this, context);
                helper.validate();
+               String sinkClass = helper.getOptions().get(TABLE_SINK_CLASS);
+
                boolean isInsertOnly = 
helper.getOptions().get(SINK_INSERT_ONLY);
                String runtimeSink = helper.getOptions().get(RUNTIME_SINK);
                int expectedNum = 
helper.getOptions().get(SINK_EXPECTED_MESSAGES_NUM);
                TableSchema schema = context.getCatalogTable().getSchema();
-               return new TestValuesTableSink(
-                       schema,
-                       context.getObjectIdentifier().getObjectName(),
-                       isInsertOnly,
-                       runtimeSink, expectedNum);
+               if (sinkClass.equals("DEFAULT")) {
+                       return new TestValuesTableSink(
+                               schema,
+                               context.getObjectIdentifier().getObjectName(),
+                               isInsertOnly,
+                               runtimeSink, expectedNum);
+               } else {
+                       try {
+                               return InstantiationUtil.instantiate(
+                                       sinkClass,
+                                       DynamicTableSink.class,
+                                       
Thread.currentThread().getContextClassLoader());
+                       } catch (FlinkException e) {

Review comment:
       I think wee can't use `TableException` here, because 
`InstantiationUtil.instantiate` throws `FlinkException` which is defined in 
`flink-core`. 




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


Reply via email to