csurong opened a new issue, #18682: URL: https://github.com/apache/dolphinscheduler/issues/18682
### Search before asking - [x] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened `ClasspathSqlScriptParser.getAllSql()` does not recognize a statement terminator when spaces or tabs follow the semicolon. It appends subsequent lines until it finds a line ending with a semicolon and returns separate statements as one list entry. `SqlScriptRunner` passes each entry to `Statement.execute()`, so this changes the statements submitted to JDBC. ### What you expected to happen Spaces or tabs after a statement terminator should not change statement boundaries. The parser should return each statement separately while preserving its text. ### How to reproduce 1. Put a UTF-8 resource named `trailing_whitespace.sql` on the classpath with the following contents, expressed as a Java string so that the trailing space is visible: ```java "SELECT 1; \nSELECT 2;\n" ``` 2. Call `new ClasspathSqlScriptParser("trailing_whitespace.sql").getAllSql()`. 3. The result contains one entry, `"SELECT 1; \nSELECT 2;"`, instead of two entries, `"SELECT 1; "` and `"SELECT 2;"`. The same issue occurs with a trailing tab and with multiline statements. ### Anything else Reproduced on `dev` at `043060b058`. The PostgreSQL 3.4.0 upgrade script also contains trailing spaces after the index statement for `idx_t_ds_task_group_queue_workflow_instance_id`. The parser combines it with the following `CREATE TABLE` statement, returning 14 entries instead of 15. This report establishes incorrect statement splitting. It does not establish a PostgreSQL upgrade failure; database execution was not tested. ### Version dev ### Are you willing to submit PR? - [x] Yes I am willing to submit a PR! ### Code of Conduct - [x] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct) -- 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]
