[Fix-18074][Task-Plugin] Fix SQL task parameter passing and unsafe regex replacement#18219
Closed
leocook wants to merge 1 commit intoapache:devfrom
Closed
[Fix-18074][Task-Plugin] Fix SQL task parameter passing and unsafe regex replacement#18219leocook wants to merge 1 commit intoapache:devfrom
leocook wants to merge 1 commit intoapache:devfrom
Conversation
…stream and downstream parameter names differ - Inject VarPool parameters that don't exist in downstream task's local params into prepareParamsMap for placeholder resolution - Use Matcher.quoteReplacement() in replaceOriginalValue() to prevent $ being treated as regex group reference - Add null safety check for parameter value before replacement - Add unit tests for both fixes
ca92c9e to
f8f47a3
Compare
Contributor
Author
|
Replaced by new PR with branch fix-18074-sql-parameter-type-passing |
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.
Was this PR generated or assisted by AI?
YES, Opus 4.7
Purpose of the pull request
close #18216
Brief change log
When an upstream SQL task outputs parameter
p1and the downstream task references it via a different parameter namep2(with value${p1}), the workflow fails with:Two root causes:
VarPool not injected:
CuringParamsServiceImpl.paramParsingPreparation()step 6 only overrides parameters with the same name. Since the downstream task only hasp2and notp1, the upstream VarPool value (p1=111) gets dropped, causing${p1}to remain unresolved.Unsafe regex replacement:
SqlTask.replaceOriginalValue()usesMatcher.replaceFirst(paramValue)directly, which treats$as a regex group reference. When the unresolved placeholder${p1}contains$, it causes the regex engine to crash.Changes:
CuringParamsServiceImpl: Inject VarPool parameters that don't exist inprepareParamsMapfor downstream placeholder resolutionSqlTask: UseMatcher.quoteReplacement()to safely handle$in parameter values, and add null safety checkVerify this pull request
This pull request is covered by new unit tests:
CuringParamsServiceImplTest.testParamParsingPreparation_varPoolInjectionWhenParamNameNotInLocalParams— verifies upstream VarPool parameterp1is injected and downstreamp2=${p1}is resolved to111SqlTaskTest.testReplaceOriginalValue_withSpecialCharacters— verifies$,\characters in values are safely replacedSqlTaskTest.testReplaceOriginalValue_paramNotFound_keepsOriginalText— verifies original text is preserved when parameter is not foundSqlTaskTest.testReplaceOriginalValue_paramValueNull_keepsOriginalText— verifies original text is preserved when parameter value is nullScreenshots
Before fix:


After fix:


Pull Request Notice
Pull Request Notice
If your pull request contains incompatible change, you should also add it to
docs/docs/en/guide/upgrade/incompatible.md