[Fix-18074][Task-Plugin] Fix SQL task parameter passing and unsafe regex replacement#18231
[Fix-18074][Task-Plugin] Fix SQL task parameter passing and unsafe regex replacement#18231leocook wants to merge 2 commits into
Conversation
1676161 to
4dbaac0
Compare
Thanks for the review. Fixed — when injecting a varPool parameter that doesn't exist in local params, a new Property with Direct.IN is now created instead of directly putting the OUT-direction varPool. |
|
@ruanwenjun Hi, the changes you requested have been addressed. Could you please re-review when you get a chance? Thanks! |
|
@ruanwenjun @SbloodyS Hi, could you please set a milestone for this PR? The CI milestone-label check is failing because of the missing milestone. |
763fcf2 to
b3268c1
Compare
|
You should check failed UT. @leocook |
…ng from upstream to downstream - 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
…directly putting OUT-direction varPool into params map
Hi @SbloodyS, the failed CI is not caused by my code (this PR only changes 4 Java files) :
This flaky already exists on Also the change you requested is already done — could you re-review to remove |
f59ba03 to
909b2f8
Compare
Was this PR generated or assisted by AI?
YES, Opus 4.7
Purpose of the pull request
close #18074
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