Search before asking
What happened
ClasspathSqlScriptParser skips the initial block license header before parsing SQL resources. The closing marker check currently uses the raw line, so a standard indented closing marker such as */ is not recognized.
When a SQL resource starts with an indented block license header closing marker, the parser can remain in license-header skipping mode and skip the SQL statements that follow the header.
What you expected to happen
ClasspathSqlScriptParser should recognize an indented block comment closing marker while skipping the leading license header, then continue parsing the SQL statements after the header.
How to reproduce
Add a SQL resource with a leading block license header whose closing marker is indented, followed by a SQL statement:
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements.
*/
select 1;
Parse it with ClasspathSqlScriptParser. The SQL statement after the license header should be returned, but the current implementation can skip it because the indented */ line is not treated as the end of the header.
Anything else
The relevant code path is dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/sql/ClasspathSqlScriptParser.java.
Version
dev
Are you willing to submit PR?
Code of Conduct
Search before asking
What happened
ClasspathSqlScriptParserskips the initial block license header before parsing SQL resources. The closing marker check currently uses the raw line, so a standard indented closing marker such as*/is not recognized.When a SQL resource starts with an indented block license header closing marker, the parser can remain in license-header skipping mode and skip the SQL statements that follow the header.
What you expected to happen
ClasspathSqlScriptParsershould recognize an indented block comment closing marker while skipping the leading license header, then continue parsing the SQL statements after the header.How to reproduce
Add a SQL resource with a leading block license header whose closing marker is indented, followed by a SQL statement:
Parse it with
ClasspathSqlScriptParser. The SQL statement after the license header should be returned, but the current implementation can skip it because the indented*/line is not treated as the end of the header.Anything else
The relevant code path is
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/sql/ClasspathSqlScriptParser.java.Version
dev
Are you willing to submit PR?
Code of Conduct