[Improvement-17986][task-plugin] Support parameter replacement in Flink and FlinkStream task#17987
Open
macdoor wants to merge 8 commits intoapache:devfrom
Open
[Improvement-17986][task-plugin] Support parameter replacement in Flink and FlinkStream task#17987macdoor wants to merge 8 commits intoapache:devfrom
macdoor wants to merge 8 commits intoapache:devfrom
Conversation
|
Thanks for opening this pull request! Please check out our contributing guidelines. (https://github.com/apache/dolphinscheduler/blob/dev/docs/docs/en/contribute/join/pull-request.md) |
|
ruanwenjun
reviewed
Feb 24, 2026
dolphinscheduler-task-plugin/dolphinscheduler-task-flink/pom.xml
Outdated
Show resolved
Hide resolved
dolphinscheduler-task-plugin/dolphinscheduler-task-flink-stream/pom.xml
Outdated
Show resolved
Hide resolved
...link-stream/src/main/java/org/apache/dolphinscheduler/plugin/task/flink/FlinkStreamTask.java
Outdated
Show resolved
Hide resolved
...eduler-task-flink/src/main/java/org/apache/dolphinscheduler/plugin/task/flink/FlinkTask.java
Outdated
Show resolved
Hide resolved
macdoor
pushed a commit
to macdoor/dolphinscheduler
that referenced
this pull request
Feb 24, 2026
…cript(), remove Mockito from FlinkTaskTest - Move FileUtils.generateScriptFile() from init() to getScript() - Apply ParameterUtils.convertParameterPlaceholders() in getScript() before script generation - Refactor FlinkTaskTest without Mockito, use @tempdir and assert on generated file content Ref: PR apache#17987 Co-authored-by: Cursor <cursoragent@cursor.com>
macdoor
pushed a commit
to macdoor/dolphinscheduler
that referenced
this pull request
Feb 24, 2026
…s without Mockito - Move FileUtils.generateScriptFile() from init() to getScript() - Apply ParameterUtils.convertParameterPlaceholders() in getScript() before script generation - Refactor FlinkTaskTest and FlinkStreamTaskTest without Mockito - Use @tempdir and assert on generated file content Ref: PR apache#17987 Co-authored-by: Cursor <cursoragent@cursor.com>
9a16038 to
4e40f8d
Compare
macdoor
pushed a commit
to macdoor/dolphinscheduler
that referenced
this pull request
Feb 24, 2026
…nk-stream junit-jupiter, mockito-junit-jupiter, mockito-inline are already in root pom Ref: PR apache#17987 review Co-authored-by: Cursor <cursoragent@cursor.com>
macdoor
pushed a commit
to macdoor/dolphinscheduler
that referenced
this pull request
Feb 24, 2026
…e site - Remove param replacement from init(), apply in resolveFlinkJdbcUrl/resolveInitScriptContent/resolveMainScriptContent - Consistent with PR apache#17987 review: move replacement to where values are used Co-authored-by: Cursor <cursoragent@cursor.com>
ruanwenjun
reviewed
Feb 25, 2026
...-stream/src/test/java/org/apache/dolphinscheduler/plugin/task/flink/FlinkStreamTaskTest.java
Outdated
Show resolved
Hide resolved
macdoor
pushed a commit
to macdoor/dolphinscheduler
that referenced
this pull request
Feb 25, 2026
…subclasses Same package allows direct access to protected getScript() Ref: PR apache#17987 review Co-authored-by: Cursor <cursoragent@cursor.com>
ruanwenjun
pushed a commit
to macdoor/dolphinscheduler
that referenced
this pull request
Feb 25, 2026
…s without Mockito - Move FileUtils.generateScriptFile() from init() to getScript() - Apply ParameterUtils.convertParameterPlaceholders() in getScript() before script generation - Refactor FlinkTaskTest and FlinkStreamTaskTest without Mockito - Use @tempdir and assert on generated file content Ref: PR apache#17987 Co-authored-by: Cursor <cursoragent@cursor.com>
ruanwenjun
pushed a commit
to macdoor/dolphinscheduler
that referenced
this pull request
Feb 25, 2026
…nk-stream junit-jupiter, mockito-junit-jupiter, mockito-inline are already in root pom Ref: PR apache#17987 review Co-authored-by: Cursor <cursoragent@cursor.com>
ruanwenjun
pushed a commit
to macdoor/dolphinscheduler
that referenced
this pull request
Feb 25, 2026
…subclasses Same package allows direct access to protected getScript() Ref: PR apache#17987 review Co-authored-by: Cursor <cursoragent@cursor.com>
6554359 to
bfd71ea
Compare
ruanwenjun
reviewed
Feb 25, 2026
...er-task-flink/src/test/java/org/apache/dolphinscheduler/plugin/task/flink/FlinkTaskTest.java
Outdated
Show resolved
Hide resolved
...er-task-flink/src/test/java/org/apache/dolphinscheduler/plugin/task/flink/FlinkTaskTest.java
Outdated
Show resolved
Hide resolved
...-stream/src/test/java/org/apache/dolphinscheduler/plugin/task/flink/FlinkStreamTaskTest.java
Outdated
Show resolved
Hide resolved
...-stream/src/test/java/org/apache/dolphinscheduler/plugin/task/flink/FlinkStreamTaskTest.java
Outdated
Show resolved
Hide resolved
...-stream/src/test/java/org/apache/dolphinscheduler/plugin/task/flink/FlinkStreamTaskTest.java
Outdated
Show resolved
Hide resolved
macdoor
pushed a commit
to macdoor/dolphinscheduler
that referenced
this pull request
Feb 25, 2026
…ue(contains) in Flink tests - Replace assertTrue(contains) with assertEquals in FlinkTaskTest and FlinkStreamTaskTest - Remove class-level Javadoc per review Ref: PR apache#17987 Co-authored-by: Cursor <cursoragent@cursor.com>
…nk and FlinkStream task
…d unit tests for parameter replacement - Always apply parameter replacement even when paramsMap is empty (to support time placeholders like $[yyyyMMdd]) - Replace Chinese comments with English - Add FlinkTaskTest and FlinkStreamTaskTest with test cases for parameter replacement Co-authored-by: Cursor <cursoragent@cursor.com>
…nk and FlinkStream task - Replace parameter placeholders in initScript and rawScript for FlinkTask and FlinkStreamTask - Add unit tests for parameter replacement and time placeholders with empty params - Add test dependencies to task-flink and task-flink-stream modules
…s without Mockito - Move FileUtils.generateScriptFile() from init() to getScript() - Apply ParameterUtils.convertParameterPlaceholders() in getScript() before script generation - Refactor FlinkTaskTest and FlinkStreamTaskTest without Mockito - Use @tempdir and assert on generated file content Ref: PR apache#17987 Co-authored-by: Cursor <cursoragent@cursor.com>
…nk-stream junit-jupiter, mockito-junit-jupiter, mockito-inline are already in root pom Ref: PR apache#17987 review Co-authored-by: Cursor <cursoragent@cursor.com>
…subclasses Same package allows direct access to protected getScript() Ref: PR apache#17987 review Co-authored-by: Cursor <cursoragent@cursor.com>
…ue(contains) in Flink tests - Replace assertTrue(contains) with assertEquals in FlinkTaskTest and FlinkStreamTaskTest - Remove class-level Javadoc per review Ref: PR apache#17987 Co-authored-by: Cursor <cursoragent@cursor.com>
2ebdd88 to
2660988
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Purpose of the pull request
Add parameter replacement support for Flink and Flink Stream task plugins.
initScriptandrawScriptcan use DolphinScheduler built-in and custom parameters (e.g.${system.biz.date},${localParams.xxx}), consistent with other task types.close #17986
Brief change log
FlinkTaskandFlinkStreamTask, applyParameterUtils.convertParameterPlaceholders()toinitScriptandrawScriptininit()usingtaskExecutionContext.getPrepareParamsMap()FlinkTaskTest,FlinkStreamTaskTest) to verify parameter replacement for${var}placeholders and$[yyyyMMdd]time expressionsParameterUtilsand task APIVerify this pull request
This change added tests and can be verified as follows:
FlinkTaskTestandFlinkStreamTaskTestwith test cases:testInitReplacesPlaceholdersInInitScriptAndRawScript(): Verifies${var}replacement with custom parameterstestInitReplacesTimePlaceholderWhenParamMapContainsScheduleTime(): Verifies$[yyyyMMdd]time placeholder replacementmvn test -pl dolphinscheduler-task-plugin/dolphinscheduler-task-flink,dolphinscheduler-task-plugin/dolphinscheduler-task-flink-stream -Dtest=FlinkTaskTest,FlinkStreamTaskTest${system.biz.date}), run the workflow and confirm the placeholders are replaced correctly at runtimePull Request Notice
Pull Request Notice
If your pull request contains incompatible change, you should also add it to
docs/docs/en/guide/upgrade/incompatible.mdcloses #17986