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: us...@infra.apache.org