wuchong 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_r317535810
##########
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:
If it is an invalid multiline sql string, then it should fail in sql parser
instead of passing to executor?
----------------------------------------------------------------
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