slinkydeveloper commented on a change in pull request #18363:
URL: https://github.com/apache/flink/pull/18363#discussion_r806551237



##########
File path: 
flink-table/flink-table-planner/src/main/java/org/apache/flink/table/planner/delegation/ParserImpl.java
##########
@@ -76,16 +81,42 @@ public ParserImpl(
         this.sqlExprToRexConverterFactory = sqlExprToRexConverterFactory;
     }
 
+    /**
+     * Parses a given statement to {@link Operation}. the statement should be 
complete and valid, or
+     * an {@link SqlParserException} would be thrown.
+     *
+     * @param statement input statement.
+     * @return parsed operations.
+     */
+    @Override
+    public List<Operation> parse(String statement) {
+        return parseInternal(statement, false);
+    }
+
+    /**
+     * Parses a given statement interactively to {@link Operation}, used in 
sql client. Different
+     * from {@link #parse(String)}, it returns a {@link StagingOperation} when 
given an incomplete

Review comment:
       Please don't use `StagingOperation`, as it's confusing the fact that 
this is an implementation of an `Operation`. Create an appropriate new union 
type that either has the `List<Operation>` in case the parsing is complete, or 
has only `SqlParseException` in case of failure, or some flag to say `expected 
<EOF>`. e.g. a type like:
   
   
   `InteractiveParseResult`:
   * `isParsingCompleted()` and `getParseResult()` in case parsing is complete
   * `isParsingFailured()` and `getParseError()` in case parsing is complete 
but there was an error
   * `isParsingIncomplete()` if the input string was an incomplete statement
   
   Of course choose the names you think fit most, those are just a suggestion 
of how this type should look like




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