Skip to content

[Bug][Common] ClasspathSqlScriptParser skips SQL after indented license header #18302

@hiSandog

Description

@hiSandog

Search before asking

  • I had searched in the issues and found no similar issues.

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?

  • Yes I am willing to submit a PR!

Code of Conduct

Metadata

Metadata

Assignees

Labels

backendbugSomething isn't working

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions