leo65535 commented on a change in pull request #930:
URL: 
https://github.com/apache/incubator-seatunnel/pull/930#discussion_r780090186



##########
File path: 
seatunnel-core/seatunnel-core-sql/src/main/java/org/apache/seatunnel/core/sql/splitter/SqlStatementSplitter.java
##########
@@ -50,31 +54,32 @@
         List<String> statements = new ArrayList<>();
         List<String> buffer = new ArrayList<>();
 
-        for (String line : content.split("\n")) {
+        for (String line : content.split(LINE_SEPARATOR)) {
             if (isEndOfStatement(line)) {
                 buffer.add(line);
-                statements.add(normalizeLine(buffer));
+                statements.addAll(normalizeLine(buffer));
                 buffer.clear();
             } else {
                 buffer.add(line);
             }
         }
         if (!buffer.isEmpty()) {
-            statements.add(normalizeLine(buffer));
+            statements.addAll(normalizeLine(buffer));
         }
         return statements;
     }
 
     /**
      * Remove comment lines.
      */
-    private static String normalizeLine(List<String> buffer) {
-        return buffer.stream()
-                .map(statementLine -> 
statementLine.replaceAll(BEGINNING_COMMENT_MASK, ""))
-                .collect(Collectors.joining("\n"));
+    private static List<String> normalizeLine(List<String> buffer) {

Review comment:
       hi, the sql statements like following, it will return wrong statements 
after apply this patch.
   ```
   String sqlContent = "--test is a comment \n select * from dual; select 
now(); select * from logs where log_content like ';'";
   ```
   
   And, if `--` is the prefix of the statement, we should not handle it.
   
![image](https://user-images.githubusercontent.com/95013770/148513364-345c9cc5-cb69-4096-b583-25471bd0ab88.png)
   




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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to