fsk119 commented on code in PR #21901:
URL: https://github.com/apache/flink/pull/21901#discussion_r1111428607


##########
docs/content.zh/docs/dev/table/sqlClient.md:
##########
@@ -223,6 +223,8 @@ Mode "embedded" (default) submits Flink jobs from the local 
machine.
 
   Syntax: [embedded] [OPTIONS]
   "embedded" mode options:
+     -c,--conf <session config item[key=val]>   The config item[key=val] for a

Review Comment:
   Flink CLI/SQL Gateway both use -D option to specify arbitrary options. I 
think we can align the behaviour.



##########
flink-table/flink-sql-client/src/main/java/org/apache/flink/table/client/gateway/ExecutorImpl.java:
##########
@@ -136,12 +147,14 @@ public ExecutorImpl(
                     "Open session to {} with connection version: {}.",
                     gatewayAddress,
                     connectionVersion);
+            Map<String, String> sessionConfig =
+                    new HashMap<>(defaultContext.getFlinkConfig().toMap());
+            sessionConfig.putAll(dynamicConfig);

Review Comment:
   I think we can merge the session config into the DefaultContext. Because the 
session config has the same priority as DefaultContext. `DefaultContext` 
already exposes the API `DefaultContext#load ` to create a context with session 
config.



##########
flink-table/flink-sql-client/src/main/java/org/apache/flink/table/client/cli/CliOptionsParser.java:
##########
@@ -357,4 +373,20 @@ private static Configuration 
getPythonConfiguration(CommandLine line) {
             throw new SqlClientException("Failed to parse the Python command 
line options.", e);
         }
     }
+
+    private static Map<String, String> getSessionConfig(CommandLine line) {
+        if (!line.hasOption(OPTION_SESSION_CONFIG.getOpt())) {
+            return Collections.emptyMap();
+        }
+
+        Map<String, String> sessionConf = new HashMap<>();
+        for (String confString : 
line.getOptionValues(OPTION_SESSION_CONFIG.getOpt())) {
+            String[] items = StringUtils.splitByWholeSeparator(confString, 
"=");
+            if (items.length != 2) {
+                throw new IllegalArgumentException("The config item must be 
key=val");
+            }
+            sessionConf.put(StringUtils.trim(items[0]), 
StringUtils.trim(items[1]));
+        }
+        return sessionConf;

Review Comment:
   replace with ` line.getOptionProperties(DYNAMIC_PROPERTY_OPTION.getOpt())`. 
You can take a look at `SqlGatewayOptionsParser#parseSqlGatewayOptions`.



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

Reply via email to