Skip to content

Commit 4dbaac0

Browse files
committed
[Fix-18074][Task-Plugin] Announce varPool as IN parameter instead of directly putting OUT-direction varPool into params map
1 parent 61ce27c commit 4dbaac0

2 files changed

Lines changed: 10 additions & 3 deletions

File tree

dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/expand/CuringParamsServiceImpl.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,8 +212,13 @@ public Map<String, Property> paramParsingPreparation(@NonNull TaskInstance taskI
212212
// Existing IN parameter: override its value
213213
targetParam.setValue(varPool.getValue());
214214
} else if (targetParam == null) {
215-
// Parameter not in map: inject it for placeholder resolution
216-
prepareParamsMap.put(varPool.getProp(), varPool);
215+
// Parameter not in map: announce as IN parameter from varPool for placeholder resolution
216+
Property newParam = new Property();
217+
newParam.setProp(varPool.getProp());
218+
newParam.setValue(varPool.getValue());
219+
newParam.setType(varPool.getType());
220+
newParam.setDirect(Direct.IN);
221+
prepareParamsMap.put(varPool.getProp(), newParam);
217222
}
218223
}
219224
}

dolphinscheduler-service/src/test/java/org/apache/dolphinscheduler/service/expand/CuringParamsServiceImplTest.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -606,9 +606,11 @@ public void testParamParsingPreparation_varPoolInjectionWhenParamNameNotInLocalP
606606

607607
Assertions.assertNotNull(propertyMap);
608608

609-
// Assert: p1 should be injected from varPool
609+
// Assert: p1 should be injected from varPool and announced as IN direction
610610
Assertions.assertTrue(propertyMap.containsKey("p1"), "p1 should be injected from varPool");
611611
Assertions.assertEquals("111", propertyMap.get("p1").getValue());
612+
Assertions.assertEquals(Direct.IN, propertyMap.get("p1").getDirect(),
613+
"injected varPool param should be announced as IN direction");
612614

613615
// Assert: p2 should exist and its value should be resolved from ${p1} to 111
614616
Assertions.assertTrue(propertyMap.containsKey("p2"));

0 commit comments

Comments
 (0)