You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2019/08/22 05:18:18 UTC
[GitHub] [flink] wuchong commented on a change in pull request #8738: [FLINK-12845][sql-client] Execute multiple statements in command line…
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_r316499652
##########
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:
This is the another concern from my side. We will lose the original text and character positions after replacing.
This will make users confused if the SQL has parser error because the position is not correct.
Another option is support all parsers in `flink-sql-parser`. The sql parser supports multi statement naturally and have proper exceptions. In this way, we will not need this "hack" replacing. But we may need more works.
cc @danny0405
Besides of that, we have met some issues in internal blink when removing comments and
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services