danny0405 commented on a change in pull request #8738:
[FLINK-12845][sql-client] Execute multiple statements in command line…
URL: https://github.com/apache/flink/pull/8738#discussion_r317530274
##########
File path:
flink-table/flink-sql-client/src/main/java/org/apache/flink/table/client/cli/CliClient.java
##########
@@ -624,4 +637,56 @@ private static Terminal createDefaultTerminal() {
throw new SqlClientException("Error opening command
line interface.", e);
}
}
+
+ /**
+ * Split a SemiColon-separated String, but ignore SemiColons in quotes.
+ */
+ static List<String> splitSemiColon(String line) {
+ boolean inSingleQuotes = false;
+ boolean inDoubleQuotes = false;
+ boolean escape = false;
+
+ // normalize
+ line = line.replaceAll("--[^\r\n]*", ""); // remove single-line
comments
+ line = line.replaceAll("/\\*[\\w\\W]*?(?=\\*/)\\*/", ""); //
remove double-line comments
Review comment:
Support multiline sql parse work for sql-parser seems the right way to go,
just one question: after parsing, we got a `SqlNodeList` with each node comes
from a sql statement.
So we may need to unparse the node to sql text again when passing them to
executor. The unparsed text may be different from the original one, so the
error message may not be exact accurate sometimes.
----------------------------------------------------------------
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]
With regards,
Apache Git Services