danny0405 commented on a change in pull request #12355:
URL: https://github.com/apache/flink/pull/12355#discussion_r435085251



##########
File path: 
flink-table/flink-sql-client/src/main/java/org/apache/flink/table/client/cli/CliClient.java
##########
@@ -253,7 +253,13 @@ public boolean submitUpdate(String statement) {
        // 
--------------------------------------------------------------------------------------------
 
        private Optional<SqlCommandCall> parseCommand(String line) {
-               final Optional<SqlCommandCall> parsedLine = 
SqlCommandParser.parse(executor.getSqlParser(sessionId), line);
+               final Optional<SqlCommandCall> parsedLine;
+               try {
+                       parsedLine = 
SqlCommandParser.parse(executor.getSqlParser(sessionId), line);
+               } catch (SqlExecutionException e) {
+                       printExecutionException(e);
+                       return Optional.empty();
+               }
                if (!parsedLine.isPresent()) {
                        printError(CliStrings.MESSAGE_UNKNOWN_SQL);

Review comment:
       > I think we should keep this. because when TableEnvironment supports 
new operation but forgets to update SqlCommandParser
   I think we should never do this, either to refactor the code to keep SQL_CLI 
synced with table environment or keep the logic clean.

##########
File path: 
flink-table/flink-sql-client/src/main/java/org/apache/flink/table/client/cli/CliClient.java
##########
@@ -253,7 +253,13 @@ public boolean submitUpdate(String statement) {
        // 
--------------------------------------------------------------------------------------------
 
        private Optional<SqlCommandCall> parseCommand(String line) {
-               final Optional<SqlCommandCall> parsedLine = 
SqlCommandParser.parse(executor.getSqlParser(sessionId), line);
+               final Optional<SqlCommandCall> parsedLine;
+               try {
+                       parsedLine = 
SqlCommandParser.parse(executor.getSqlParser(sessionId), line);
+               } catch (SqlExecutionException e) {
+                       printExecutionException(e);
+                       return Optional.empty();
+               }
                if (!parsedLine.isPresent()) {
                        printError(CliStrings.MESSAGE_UNKNOWN_SQL);

Review comment:
       > I think we should keep this. because when TableEnvironment supports 
new operation but forgets to update SqlCommandParser
   
   I think we should never do this, either to refactor the code to keep SQL_CLI 
synced with table environment or keep the logic clean.




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