openinx commented on a change in pull request #10270: [FLINK-14672][sql-client] Make Executor stateful in sql client URL: https://github.com/apache/flink/pull/10270#discussion_r349452821
########## File path: flink-table/flink-sql-client/src/main/java/org/apache/flink/table/client/gateway/local/LocalExecutor.java ########## @@ -200,69 +277,98 @@ public void start() { } @Override - public List<String> listCatalogs(SessionContext session) throws SqlExecutionException { - final ExecutionContext<?> context = getOrCreateExecutionContext(session); + public void resetSessionProperties(String sessionId) throws SqlExecutionException { + // Renew the ExecutionContext by using the default environment. + this.contextMap.put(sessionId, createExecutionContext(defaultEnvironment)); + } - final TableEnvironment tableEnv = context - .createEnvironmentInstance() - .getTableEnvironment(); + @Override + public void setSessionProperty(String sessionId, String key, String value) throws SqlExecutionException { + Environment env = getExecutionContext(sessionId).getEnvironment(); + Environment newEnv = Environment.enrich(env, ImmutableMap.of(key, value), ImmutableMap.of()); + // Renew the ExecutionContext by merging the default environment and new environment. + this.contextMap.put(sessionId, createExecutionContext(defaultEnvironment, newEnv)); Review comment: Sounds good, thanks for pointing it out. ---------------------------------------------------------------- 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: us...@infra.apache.org With regards, Apache Git Services