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



##########
File path: 
flink-table/flink-table-planner/src/main/java/org/apache/flink/table/planner/parse/CalciteParser.java
##########
@@ -47,12 +49,36 @@ public CalciteParser(SqlParser.Config config) {
      * @param sql a sql string to parse
      * @return a parsed sql node
      * @throws SqlParserException if an exception is thrown when parsing the 
statement
+     * @throws SqlParserEOFException if the statement is incomplete
      */
     public SqlNode parse(String sql) {
         try {
             SqlParser parser = SqlParser.create(sql, config);
             return parser.parseStmt();
         } catch (SqlParseException e) {
+            if (e.getMessage().contains("Encountered \"<EOF>\"")) {
+                throw new SqlParserEOFException(e.getMessage(), e);
+            }
+            throw new SqlParserException("SQL parse failed. " + 
e.getMessage(), e);
+        }
+    }
+
+    /**
+     * Parses a SQL string into a {@link SqlNodeList}. The {@link SqlNodeList} 
is not yet validated.
+     *
+     * @param sql a sql string to parse
+     * @return a parsed sql node list
+     * @throws SqlParserException if an exception is thrown when parsing the 
statement
+     * @throws SqlParserEOFException if the statement is incomplete
+     */
+    public SqlNodeList parseSqlList(String sql) {
+        try {
+            SqlParser parser = SqlParser.create(sql, config);
+            return parser.parseStmtList();
+        } catch (SqlParseException e) {
+            if (e.getMessage().contains("Encountered \"<EOF>\"")) {
+                throw new SqlParserEOFException(e.getMessage(), e);

Review comment:
       so can we keep the class for now and do some necessary refactor in the 
future when necessary?




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