mattcasters commented on code in PR #9460:
URL: https://github.com/apache/hop/pull/9460#discussion_r4560707059
##########
plugins/transforms/setvariable/src/main/java/org/apache/hop/pipeline/transforms/setvariable/SetVariable.java:
##########
@@ -147,18 +147,19 @@ private void setValue(Object[] rowData, int i, boolean
usedefault) throws HopExc
// Make a link between the pipeline and the parent pipeline (in a
sub-pipeline)
//
- while (pipeline.getParentPipeline() != null) {
- pipeline = pipeline.getParentPipeline();
- pipeline.setVariable(varname, value);
+ IVariables currentVariables = getPipeline();
+ while (currentVariables != null) {
+ currentVariables.setVariable(varname, value);
+ currentVariables = currentVariables.getParentVariables();
}
// Now construct the list of parent engines starting from this top-level
pipeline
//
java.util.List<IVariables> parents = new java.util.ArrayList<>();
- IVariables parent = getParentEngine(pipeline);
+ IVariables parent = pipeline.getParentVariables();
Review Comment:
`getParentVariables()` isn't the parent engine. For a pipeline started by a
Pipeline executor, the variable source is the executor transform
(`createInternalPipeline()` passes `this`), so `parents.get(0)` becomes that
transform and "parent workflow" no longer reaches the workflow. Also,
`pipeline` is now the current pipeline instead of the top-level one, so for
nested pipelines the first entries are parent pipelines rather than workflows.
Please keep `getParentEngine()` here.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]