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



##########
File path: 
flink-table/flink-sql-client/src/main/java/org/apache/flink/table/client/config/entries/ModuleEntry.java
##########
@@ -61,6 +62,15 @@ private static ModuleEntry create(DescriptorProperties 
properties) {
         final DescriptorProperties cleanedProperties =
                 properties.withoutKeys(Collections.singletonList(MODULE_NAME));
 
+        // mapping modules purely by name
+        if (cleanedProperties.containsKey(MODULE_TYPE)) {
+            throw new ValidationException(

Review comment:
       I think we should need to keep backward-comaptibility. Using module name 
as module type is just a shortcut or syntax sugar. 
   
   We can simply fill MODULE_TYPE using module name if it is not defined here. 

##########
File path: 
flink-table/flink-sql-client/src/test/java/org/apache/flink/table/client/gateway/local/ExecutionContextTest.java
##########
@@ -169,15 +172,33 @@ public void testDefaultExecutionConfig() throws Exception 
{
                 
conf.get(RestartStrategyOptions.RESTART_STRATEGY_FAILURE_RATE_DELAY));
     }
 
+    @Test
+    public void testModulesWithDeprecatedType() throws Exception {
+        thrown.expect(SqlClientException.class);
+        thrown.expectMessage(
+                "Property 'type' is deprecated, please remove it and rename 
module name "
+                        + "'mymodule' to type name 'ModuleDependencyTest' and 
try again");
+        final Map<String, String> moduleConf = new HashMap<>();
+        moduleConf.put(
+                "$VAR_MODULE_LIST",
+                "\n  - name: mymodule\n    type: " + "ModuleDependencyTest\n   
 test: test");
+        createModuleExecutionContext(moduleConf);
+    }
+
     @Test
     public void testModules() throws Exception {
-        final ExecutionContext<?> context = createModuleExecutionContext();
+        final Map<String, String> moduleConf = new HashMap<>();
+        moduleConf.put(
+                "$VAR_MODULE_LIST",
+                "\n  - name: core\n  - name: ModuleDependencyTest\n    "
+                        + "test: test\n  - name: hive\n    hive-version: 
2.3.4");

Review comment:
       Can we directly update `test-sql-client-modules.yaml` if we don't have  
`testModulesWithDeprecatedType`? 




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