flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [flink] wuchong commented on a change in pull request #15980: [FLINK-22655]When using -i <init.sql> option to initialize SQL Client session It should be possible to annotate the script with --
Date Wed, 26 May 2021 04:10:02 GMT

wuchong commented on a change in pull request #15980:
URL: https://github.com/apache/flink/pull/15980#discussion_r639386756



##########
File path: flink-table/flink-sql-client/src/main/java/org/apache/flink/table/client/cli/CliStatementSplitter.java
##########
@@ -49,18 +51,25 @@ public static boolean isStatementComplete(String statement) {
         for (String line : content.split("\n")) {
             if (isEndOfStatement(line)) {
                 buffer.add(line);
-                statements.add(String.join("\n", buffer));
+                statements.add(normalize(buffer));
                 buffer.clear();
             } else {
                 buffer.add(line);
             }
         }
         if (!buffer.isEmpty()) {
-            statements.add(String.join("\n", buffer));
+            statements.add(normalize(buffer));
         }
         return statements;
     }
 
+    private static String normalize(List<String> buffer) {
+        // remove comment lines
+        return buffer.stream()
+                .map(statementLine -> statementLine.replaceAll(BEGINNING_MASK, ""))

Review comment:
       I think we don't need to remove empty lines. Keeping the empty line can help us to
keep original line number in the near future. 




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



Mime
View raw message