This is an automated email from the ASF dual-hosted git repository.
bamaer pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/hop.git
The following commit(s) were added to refs/heads/main by this push:
new 34c2109a26 Fixes #6570 : Make input and output optional in Simple
Mapping (#9245)
34c2109a26 is described below
commit 34c2109a269051a86ff8d477a516365c250092a7
Author: Matt Casters <[email protected]>
AuthorDate: Wed Nov 4 11:10:06 2026 +0100
Fixes #6570 : Make input and output optional in Simple Mapping (#9245)
* Fixes #6570 : Make input and output optional in Simple Mapping
* Issue #6570 : Fail init when optional input or output still has hops
* Issue #6570 : Cover a standalone mapping and keep the 0048 tests running
* Issue #6570 : Fail the 0048 workflow when a pipeline or test fails
* Issue #6570 : Leave incoming hops to the engine
---
.../pages/pipeline/transforms/simple-mapping.adoc | 6 +-
.../0048-simple-mapping-child-no-input.hpl | 179 ++++++++++++++++++
.../transforms/0048-simple-mapping-child-no-io.hpl | 184 ++++++++++++++++++
.../0048-simple-mapping-child-no-output.hpl | 164 +++++++++++++++++
.../0048-simple-mapping-parent-no-input.hpl | 133 +++++++++++++
.../0048-simple-mapping-parent-no-io.hpl | 91 +++++++++
.../0048-simple-mapping-parent-no-output.hpl | 155 ++++++++++++++++
.../0048-simple-mapping-verify-no-io.hpl | 89 +++++++++
.../0048-simple-mapping-verify-no-output.hpl | 89 +++++++++
.../transforms/main-0048-simple-mapping.hwf | 186 ++++++++++++++++++-
.../0048-simple-mapping-parent-no-input UNIT.json | 48 +++++
.../0048-simple-mapping-verify-no-io UNIT.json | 48 +++++
.../0048-simple-mapping-verify-no-output UNIT.json | 48 +++++
.../transforms/mapping/RowOutputDataMapper.java | 12 +-
.../pipeline/transforms/mapping/SimpleMapping.java | 110 +++++++----
.../transforms/mapping/SimpleMappingDialog.java | 61 +++++-
.../transforms/mapping/SimpleMappingMeta.java | 199 +++++++++++++-------
.../mapping/messages/messages_en_US.properties | 8 +
.../mapping/SimpleMappingMetaInjectionTest.java | 6 +
.../transforms/mapping/SimpleMappingMetaTest.java | 157 ++++++++++++++--
.../transforms/mapping/SimpleMappingTest.java | 160 ++++++++++++++++
.../mapping/SimpleMappingWorkflowResultTest.java | 205 +++++++++++++++++++++
.../test/resources/simple-mapping-transform.xml | 2 +
23 files changed, 2216 insertions(+), 124 deletions(-)
diff --git
a/docs/hop-user-manual/modules/ROOT/pages/pipeline/transforms/simple-mapping.adoc
b/docs/hop-user-manual/modules/ROOT/pages/pipeline/transforms/simple-mapping.adoc
index 9cbf24e8b5..8684187ed7 100644
---
a/docs/hop-user-manual/modules/ROOT/pages/pipeline/transforms/simple-mapping.adoc
+++
b/docs/hop-user-manual/modules/ROOT/pages/pipeline/transforms/simple-mapping.adoc
@@ -54,13 +54,17 @@ It is always executed with a standard local Hop pipeline
run configuration since
* Parameters tab: specify the parameters you want to pass to the mapping
pipeline
* Input tab: specify which fields to pass to the
xref:pipeline/transforms/mapping-input.adoc[Mapping input] transform in the
mapping.
You can map (hence the name) field names.
+Enable *There is no input for this mapping.* when the mapping sub-pipeline
acts as a data source and does not require a Mapping Input transform.
+Remove any incoming hop before enabling the option.
* Output tab: specify how to rename output fields retrieved from the
xref:pipeline/transforms/mapping-output.adoc[Mapping output] transform.
+Enable *There is no output for this mapping.* when the mapping sub-pipeline
acts as a data target and does not require a Mapping Output transform.
+Remove any outgoing hop before enabling the option.
== Metadata Injection
Input and output mappings reuse the same nested fields, so injection keys are
prefixed to keep them unique.
-* Top-level: `filename`, `runConfiguration`, `INPUT_SOURCE_TRANSFORM`,
`INPUT_TARGET_TRANSFORM`, `INPUT_DESCRIPTION`, `INPUT_MAIN_PATH`,
`INPUT_RENAME_ON_OUTPUT`, and the matching `OUTPUT_*` keys, plus
`PARAMETERS_INHERIT_ALL_VARIABLES`
+* Top-level: `filename`, `runConfiguration`, `NO_INPUT`, `NO_OUTPUT`,
`INPUT_SOURCE_TRANSFORM`, `INPUT_TARGET_TRANSFORM`, `INPUT_DESCRIPTION`,
`INPUT_MAIN_PATH`, `INPUT_RENAME_ON_OUTPUT`, and the matching `OUTPUT_*` keys,
plus `PARAMETERS_INHERIT_ALL_VARIABLES`
* Group `INPUT_FIELDS`: `INPUT_SOURCE_FIELD`, `INPUT_TARGET_FIELD`
* Group `OUTPUT_FIELDS`: `OUTPUT_SOURCE_FIELD`, `OUTPUT_TARGET_FIELD`
* Group `PARAMETERS_MAPPINGS`: `PARAMETERS_VARIABLE`, `PARAMETERS_VALUE`
diff --git
a/integration-tests/transforms/0048-simple-mapping-child-no-input.hpl
b/integration-tests/transforms/0048-simple-mapping-child-no-input.hpl
new file mode 100644
index 0000000000..04d443a11b
--- /dev/null
+++ b/integration-tests/transforms/0048-simple-mapping-child-no-input.hpl
@@ -0,0 +1,179 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements. See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+-->
+<pipeline>
+ <info>
+ <name>0048-simple-mapping-child-no-input</name>
+ <name_sync_with_filename>Y</name_sync_with_filename>
+ <description/>
+ <extended_description/>
+ <pipeline_version/>
+ <pipeline_type>Normal</pipeline_type>
+ <parameters>
+ </parameters>
+ <capture_transform_performance>N</capture_transform_performance>
+
<transform_performance_capturing_delay>1000</transform_performance_capturing_delay>
+
<transform_performance_capturing_size_limit>100</transform_performance_capturing_size_limit>
+ <created_user>-</created_user>
+ <created_date>2026/11/04 08:09:00.000</created_date>
+ <modified_user>-</modified_user>
+ <modified_date>2026/11/04 08:09:00.000</modified_date>
+ </info>
+ <notepads>
+ </notepads>
+ <order>
+ <hop>
+ <from>fieldSum = fieldA+fieldB</from>
+ <to>fieldSum</to>
+ <enabled>Y</enabled>
+ </hop>
+ <hop>
+ <from>sample data</from>
+ <to>fieldSum = fieldA+fieldB</to>
+ <enabled>Y</enabled>
+ </hop>
+ </order>
+ <transform>
+ <name>sample data</name>
+ <type>DataGrid</type>
+ <description/>
+ <distribute>Y</distribute>
+ <custom_distribution/>
+ <copies>1</copies>
+ <partitioning>
+ <method>none</method>
+ <schema_name/>
+ </partitioning>
+ <data>
+ <line>
+ <item>1</item>
+ <item>8</item>
+ </line>
+ <line>
+ <item>2</item>
+ <item>7</item>
+ </line>
+ <line>
+ <item>3</item>
+ <item>6</item>
+ </line>
+ <line>
+ <item>4</item>
+ <item>5</item>
+ </line>
+ </data>
+ <fields>
+ <field>
+ <length>-1</length>
+ <precision>-1</precision>
+ <set_empty_string>N</set_empty_string>
+ <name>fieldA</name>
+ <type>Integer</type>
+ </field>
+ <field>
+ <length>-1</length>
+ <precision>-1</precision>
+ <set_empty_string>N</set_empty_string>
+ <name>fieldB</name>
+ <type>Integer</type>
+ </field>
+ </fields>
+ <attributes/>
+ <GUI>
+ <xloc>96</xloc>
+ <yloc>80</yloc>
+ </GUI>
+ </transform>
+ <transform>
+ <name>fieldSum</name>
+ <type>MappingOutput</type>
+ <description/>
+ <distribute>Y</distribute>
+ <custom_distribution/>
+ <copies>1</copies>
+ <partitioning>
+ <method>none</method>
+ <schema_name/>
+ </partitioning>
+ <attributes/>
+ <GUI>
+ <xloc>512</xloc>
+ <yloc>80</yloc>
+ </GUI>
+ </transform>
+ <transform>
+ <name>fieldSum = fieldA+fieldB</name>
+ <type>ScriptValueMod</type>
+ <description/>
+ <distribute>Y</distribute>
+ <custom_distribution/>
+ <copies>1</copies>
+ <partitioning>
+ <method>none</method>
+ <schema_name/>
+ </partitioning>
+ <optimizationLevel>9</optimizationLevel>
+ <jsScripts>
+ <jsScript>
+ <jsScript_type>0</jsScript_type>
+ <jsScript_name>Script 1</jsScript_name>
+ <jsScript_script>
+var fieldSum = fieldA + fieldB;
+
+var par1 = getVariable("PAR1", "");
+var par2 = getVariable("PAR2", "");
+</jsScript_script>
+ </jsScript>
+ </jsScripts>
+ <fields>
+ <field>
+ <name>fieldSum</name>
+ <rename>fieldSum</rename>
+ <type>Integer</type>
+ <length>-1</length>
+ <precision>-1</precision>
+ <replace>N</replace>
+ </field>
+ <field>
+ <name>par1</name>
+ <rename>par1</rename>
+ <type>String</type>
+ <length>-1</length>
+ <precision>-1</precision>
+ <replace>N</replace>
+ </field>
+ <field>
+ <name>par2</name>
+ <rename>par2</rename>
+ <type>String</type>
+ <length>-1</length>
+ <precision>-1</precision>
+ <replace>N</replace>
+ </field>
+ </fields>
+ <attributes/>
+ <GUI>
+ <xloc>320</xloc>
+ <yloc>80</yloc>
+ </GUI>
+ </transform>
+ <transform_error_handling>
+ </transform_error_handling>
+ <attributes/>
+</pipeline>
diff --git a/integration-tests/transforms/0048-simple-mapping-child-no-io.hpl
b/integration-tests/transforms/0048-simple-mapping-child-no-io.hpl
new file mode 100644
index 0000000000..8687c57487
--- /dev/null
+++ b/integration-tests/transforms/0048-simple-mapping-child-no-io.hpl
@@ -0,0 +1,184 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements. See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+-->
+<pipeline>
+ <info>
+ <name>0048-simple-mapping-child-no-io</name>
+ <name_sync_with_filename>Y</name_sync_with_filename>
+ <description/>
+ <extended_description/>
+ <pipeline_version/>
+ <pipeline_type>Normal</pipeline_type>
+ <parameters>
+ </parameters>
+ <capture_transform_performance>N</capture_transform_performance>
+
<transform_performance_capturing_delay>1000</transform_performance_capturing_delay>
+
<transform_performance_capturing_size_limit>100</transform_performance_capturing_size_limit>
+ <created_user>-</created_user>
+ <created_date>2026/11/04 08:09:00.000</created_date>
+ <modified_user>-</modified_user>
+ <modified_date>2026/11/04 08:09:00.000</modified_date>
+ </info>
+ <notepads>
+ </notepads>
+ <order>
+ <hop>
+ <from>sample data</from>
+ <to>fieldSum = fieldA+fieldB</to>
+ <enabled>Y</enabled>
+ </hop>
+ <hop>
+ <from>fieldSum = fieldA+fieldB</from>
+ <to>write cube</to>
+ <enabled>Y</enabled>
+ </hop>
+ </order>
+ <transform>
+ <name>sample data</name>
+ <type>DataGrid</type>
+ <description/>
+ <distribute>Y</distribute>
+ <custom_distribution/>
+ <copies>1</copies>
+ <partitioning>
+ <method>none</method>
+ <schema_name/>
+ </partitioning>
+ <data>
+ <line>
+ <item>1</item>
+ <item>8</item>
+ </line>
+ <line>
+ <item>2</item>
+ <item>7</item>
+ </line>
+ <line>
+ <item>3</item>
+ <item>6</item>
+ </line>
+ <line>
+ <item>4</item>
+ <item>5</item>
+ </line>
+ </data>
+ <fields>
+ <field>
+ <length>-1</length>
+ <precision>-1</precision>
+ <set_empty_string>N</set_empty_string>
+ <name>fieldA</name>
+ <type>Integer</type>
+ </field>
+ <field>
+ <length>-1</length>
+ <precision>-1</precision>
+ <set_empty_string>N</set_empty_string>
+ <name>fieldB</name>
+ <type>Integer</type>
+ </field>
+ </fields>
+ <attributes/>
+ <GUI>
+ <xloc>96</xloc>
+ <yloc>80</yloc>
+ </GUI>
+ </transform>
+ <transform>
+ <name>fieldSum = fieldA+fieldB</name>
+ <type>ScriptValueMod</type>
+ <description/>
+ <distribute>Y</distribute>
+ <custom_distribution/>
+ <copies>1</copies>
+ <partitioning>
+ <method>none</method>
+ <schema_name/>
+ </partitioning>
+ <optimizationLevel>9</optimizationLevel>
+ <jsScripts>
+ <jsScript>
+ <jsScript_type>0</jsScript_type>
+ <jsScript_name>Script 1</jsScript_name>
+ <jsScript_script>
+var fieldSum = fieldA + fieldB;
+
+var par1 = getVariable("PAR1", "");
+var par2 = getVariable("PAR2", "");
+</jsScript_script>
+ </jsScript>
+ </jsScripts>
+ <fields>
+ <field>
+ <name>fieldSum</name>
+ <rename>fieldSum</rename>
+ <type>Integer</type>
+ <length>-1</length>
+ <precision>-1</precision>
+ <replace>N</replace>
+ </field>
+ <field>
+ <name>par1</name>
+ <rename>par1</rename>
+ <type>String</type>
+ <length>-1</length>
+ <precision>-1</precision>
+ <replace>N</replace>
+ </field>
+ <field>
+ <name>par2</name>
+ <rename>par2</rename>
+ <type>String</type>
+ <length>-1</length>
+ <precision>-1</precision>
+ <replace>N</replace>
+ </field>
+ </fields>
+ <attributes/>
+ <GUI>
+ <xloc>320</xloc>
+ <yloc>80</yloc>
+ </GUI>
+ </transform>
+ <transform>
+ <name>write cube</name>
+ <type>CubeOutput</type>
+ <description/>
+ <distribute>Y</distribute>
+ <custom_distribution/>
+ <copies>1</copies>
+ <partitioning>
+ <method>none</method>
+ <schema_name/>
+ </partitioning>
+ <file>
+ <name>${java.io.tmpdir}/0048-simple-mapping-no-io.cube</name>
+ <add_to_result_filenames>N</add_to_result_filenames>
+ <do_not_open_newfile_init>N</do_not_open_newfile_init>
+ </file>
+ <attributes/>
+ <GUI>
+ <xloc>544</xloc>
+ <yloc>80</yloc>
+ </GUI>
+ </transform>
+ <transform_error_handling>
+ </transform_error_handling>
+ <attributes/>
+</pipeline>
diff --git
a/integration-tests/transforms/0048-simple-mapping-child-no-output.hpl
b/integration-tests/transforms/0048-simple-mapping-child-no-output.hpl
new file mode 100644
index 0000000000..7f86a45e8e
--- /dev/null
+++ b/integration-tests/transforms/0048-simple-mapping-child-no-output.hpl
@@ -0,0 +1,164 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements. See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+-->
+<pipeline>
+ <info>
+ <name>0048-simple-mapping-child-no-output</name>
+ <name_sync_with_filename>Y</name_sync_with_filename>
+ <description/>
+ <extended_description/>
+ <pipeline_version/>
+ <pipeline_type>Normal</pipeline_type>
+ <parameters>
+ </parameters>
+ <capture_transform_performance>N</capture_transform_performance>
+
<transform_performance_capturing_delay>1000</transform_performance_capturing_delay>
+
<transform_performance_capturing_size_limit>100</transform_performance_capturing_size_limit>
+ <created_user>-</created_user>
+ <created_date>2026/11/04 08:09:00.000</created_date>
+ <modified_user>-</modified_user>
+ <modified_date>2026/11/04 08:09:00.000</modified_date>
+ </info>
+ <notepads>
+ </notepads>
+ <order>
+ <hop>
+ <from>fieldSum = fieldA+fieldB</from>
+ <to>write cube</to>
+ <enabled>Y</enabled>
+ </hop>
+ <hop>
+ <from>fieldA, fieldB</from>
+ <to>fieldSum = fieldA+fieldB</to>
+ <enabled>Y</enabled>
+ </hop>
+ </order>
+ <transform>
+ <name>fieldA, fieldB</name>
+ <type>MappingInput</type>
+ <description/>
+ <distribute>Y</distribute>
+ <custom_distribution/>
+ <copies>1</copies>
+ <partitioning>
+ <method>none</method>
+ <schema_name/>
+ </partitioning>
+ <fields>
+ <field>
+ <name>fieldA</name>
+ <type>Integer</type>
+ <length>-1</length>
+ <precision>-1</precision>
+ </field>
+ <field>
+ <name>fieldB</name>
+ <type>Integer</type>
+ <length>-1</length>
+ <precision>-1</precision>
+ </field>
+ </fields>
+ <attributes/>
+ <GUI>
+ <xloc>96</xloc>
+ <yloc>80</yloc>
+ </GUI>
+ </transform>
+ <transform>
+ <name>write cube</name>
+ <type>CubeOutput</type>
+ <description/>
+ <distribute>Y</distribute>
+ <custom_distribution/>
+ <copies>1</copies>
+ <partitioning>
+ <method>none</method>
+ <schema_name/>
+ </partitioning>
+ <file>
+ <name>${java.io.tmpdir}/0048-simple-mapping-no-output.cube</name>
+ <add_to_result_filenames>N</add_to_result_filenames>
+ <do_not_open_newfile_init>N</do_not_open_newfile_init>
+ </file>
+ <attributes/>
+ <GUI>
+ <xloc>512</xloc>
+ <yloc>80</yloc>
+ </GUI>
+ </transform>
+ <transform>
+ <name>fieldSum = fieldA+fieldB</name>
+ <type>ScriptValueMod</type>
+ <description/>
+ <distribute>Y</distribute>
+ <custom_distribution/>
+ <copies>1</copies>
+ <partitioning>
+ <method>none</method>
+ <schema_name/>
+ </partitioning>
+ <optimizationLevel>9</optimizationLevel>
+ <jsScripts>
+ <jsScript>
+ <jsScript_type>0</jsScript_type>
+ <jsScript_name>Script 1</jsScript_name>
+ <jsScript_script>
+var fieldSum = fieldA + fieldB;
+
+var par1 = getVariable("PAR1", "");
+var par2 = getVariable("PAR2", "");
+</jsScript_script>
+ </jsScript>
+ </jsScripts>
+ <fields>
+ <field>
+ <name>fieldSum</name>
+ <rename>fieldSum</rename>
+ <type>Integer</type>
+ <length>-1</length>
+ <precision>-1</precision>
+ <replace>N</replace>
+ </field>
+ <field>
+ <name>par1</name>
+ <rename>par1</rename>
+ <type>String</type>
+ <length>-1</length>
+ <precision>-1</precision>
+ <replace>N</replace>
+ </field>
+ <field>
+ <name>par2</name>
+ <rename>par2</rename>
+ <type>String</type>
+ <length>-1</length>
+ <precision>-1</precision>
+ <replace>N</replace>
+ </field>
+ </fields>
+ <attributes/>
+ <GUI>
+ <xloc>320</xloc>
+ <yloc>80</yloc>
+ </GUI>
+ </transform>
+ <transform_error_handling>
+ </transform_error_handling>
+ <attributes/>
+</pipeline>
diff --git
a/integration-tests/transforms/0048-simple-mapping-parent-no-input.hpl
b/integration-tests/transforms/0048-simple-mapping-parent-no-input.hpl
new file mode 100644
index 0000000000..24ffb78191
--- /dev/null
+++ b/integration-tests/transforms/0048-simple-mapping-parent-no-input.hpl
@@ -0,0 +1,133 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements. See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+-->
+<pipeline>
+ <info>
+ <name>0048-simple-mapping-parent-no-input</name>
+ <name_sync_with_filename>Y</name_sync_with_filename>
+ <description/>
+ <extended_description/>
+ <pipeline_version/>
+ <pipeline_type>Normal</pipeline_type>
+ <parameters>
+ </parameters>
+ <capture_transform_performance>N</capture_transform_performance>
+
<transform_performance_capturing_delay>1000</transform_performance_capturing_delay>
+
<transform_performance_capturing_size_limit>100</transform_performance_capturing_size_limit>
+ <created_user>-</created_user>
+ <created_date>2026/11/04 08:09:00.000</created_date>
+ <modified_user>-</modified_user>
+ <modified_date>2026/11/04 08:09:00.000</modified_date>
+ </info>
+ <notepads>
+ </notepads>
+ <order>
+ <hop>
+ <from>0048-simple-mapping-child-no-input.hpl</from>
+ <to>Output</to>
+ <enabled>Y</enabled>
+ </hop>
+ </order>
+ <transform>
+ <name>0048-simple-mapping-child-no-input.hpl</name>
+ <type>SimpleMapping</type>
+ <description/>
+ <distribute>Y</distribute>
+ <custom_distribution/>
+ <copies>1</copies>
+ <partitioning>
+ <method>none</method>
+ <schema_name/>
+ </partitioning>
+ <filename>${PROJECT_HOME}/0048-simple-mapping-child-no-input.hpl</filename>
+ <no_input>Y</no_input>
+ <no_output>N</no_output>
+ <mappings>
+ <input>
+ <mapping>
+ <main_path>Y</main_path>
+ <rename_on_output>Y</rename_on_output>
+ </mapping>
+ </input>
+ <output>
+ <mapping>
+ <connector>
+ <child>a</child>
+ <parent>fieldA</parent>
+ </connector>
+ <connector>
+ <child>b</child>
+ <parent>fieldB</parent>
+ </connector>
+ <connector>
+ <child>sum</child>
+ <parent>fieldSum</parent>
+ </connector>
+ <connector>
+ <child>parameter1</child>
+ <parent>par1</parent>
+ </connector>
+ <connector>
+ <child>parameter2</child>
+ <parent>par2</parent>
+ </connector>
+ <main_path>Y</main_path>
+ <rename_on_output>N</rename_on_output>
+ </mapping>
+ </output>
+ <parameters>
+ <inherit_all_vars>Y</inherit_all_vars>
+ <variablemapping>
+ <input>val1</input>
+ <variable>PAR1</variable>
+ </variablemapping>
+ <variablemapping>
+ <input>val2</input>
+ <variable>PAR2</variable>
+ </variablemapping>
+ </parameters>
+ </mappings>
+ <runConfiguration>local</runConfiguration>
+ <attributes/>
+ <GUI>
+ <xloc>200</xloc>
+ <yloc>80</yloc>
+ </GUI>
+ </transform>
+ <transform>
+ <name>Output</name>
+ <type>Dummy</type>
+ <description/>
+ <distribute>Y</distribute>
+ <custom_distribution/>
+ <copies>1</copies>
+ <partitioning>
+ <method>none</method>
+ <schema_name/>
+ </partitioning>
+ <attributes/>
+ <GUI>
+ <xloc>448</xloc>
+ <yloc>80</yloc>
+ </GUI>
+ </transform>
+ <transform_error_handling>
+ </transform_error_handling>
+ <attributes/>
+</pipeline>
diff --git a/integration-tests/transforms/0048-simple-mapping-parent-no-io.hpl
b/integration-tests/transforms/0048-simple-mapping-parent-no-io.hpl
new file mode 100644
index 0000000000..ae0101fd44
--- /dev/null
+++ b/integration-tests/transforms/0048-simple-mapping-parent-no-io.hpl
@@ -0,0 +1,91 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements. See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+-->
+<pipeline>
+ <info>
+ <name>0048-simple-mapping-parent-no-io</name>
+ <name_sync_with_filename>Y</name_sync_with_filename>
+ <description/>
+ <extended_description/>
+ <pipeline_version/>
+ <pipeline_type>Normal</pipeline_type>
+ <parameters>
+ </parameters>
+ <capture_transform_performance>N</capture_transform_performance>
+
<transform_performance_capturing_delay>1000</transform_performance_capturing_delay>
+
<transform_performance_capturing_size_limit>100</transform_performance_capturing_size_limit>
+ <created_user>-</created_user>
+ <created_date>2026/11/04 08:09:00.000</created_date>
+ <modified_user>-</modified_user>
+ <modified_date>2026/11/04 08:09:00.000</modified_date>
+ </info>
+ <notepads>
+ </notepads>
+ <order>
+ </order>
+ <transform>
+ <name>0048-simple-mapping-child-no-io.hpl</name>
+ <type>SimpleMapping</type>
+ <description/>
+ <distribute>Y</distribute>
+ <custom_distribution/>
+ <copies>1</copies>
+ <partitioning>
+ <method>none</method>
+ <schema_name/>
+ </partitioning>
+ <filename>${PROJECT_HOME}/0048-simple-mapping-child-no-io.hpl</filename>
+ <no_input>Y</no_input>
+ <no_output>Y</no_output>
+ <mappings>
+ <input>
+ <mapping>
+ <main_path>Y</main_path>
+ <rename_on_output>Y</rename_on_output>
+ </mapping>
+ </input>
+ <output>
+ <mapping>
+ <main_path>Y</main_path>
+ <rename_on_output>N</rename_on_output>
+ </mapping>
+ </output>
+ <parameters>
+ <inherit_all_vars>Y</inherit_all_vars>
+ <variablemapping>
+ <input>val1</input>
+ <variable>PAR1</variable>
+ </variablemapping>
+ <variablemapping>
+ <input>val2</input>
+ <variable>PAR2</variable>
+ </variablemapping>
+ </parameters>
+ </mappings>
+ <runConfiguration>local</runConfiguration>
+ <attributes/>
+ <GUI>
+ <xloc>208</xloc>
+ <yloc>80</yloc>
+ </GUI>
+ </transform>
+ <transform_error_handling>
+ </transform_error_handling>
+ <attributes/>
+</pipeline>
diff --git
a/integration-tests/transforms/0048-simple-mapping-parent-no-output.hpl
b/integration-tests/transforms/0048-simple-mapping-parent-no-output.hpl
new file mode 100644
index 0000000000..3889b5d84c
--- /dev/null
+++ b/integration-tests/transforms/0048-simple-mapping-parent-no-output.hpl
@@ -0,0 +1,155 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements. See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+-->
+<pipeline>
+ <info>
+ <name>0048-simple-mapping-parent-no-output</name>
+ <name_sync_with_filename>Y</name_sync_with_filename>
+ <description/>
+ <extended_description/>
+ <pipeline_version/>
+ <pipeline_type>Normal</pipeline_type>
+ <parameters>
+ </parameters>
+ <capture_transform_performance>N</capture_transform_performance>
+
<transform_performance_capturing_delay>1000</transform_performance_capturing_delay>
+
<transform_performance_capturing_size_limit>100</transform_performance_capturing_size_limit>
+ <created_user>-</created_user>
+ <created_date>2026/11/04 08:09:00.000</created_date>
+ <modified_user>-</modified_user>
+ <modified_date>2026/11/04 08:09:00.000</modified_date>
+ </info>
+ <notepads>
+ </notepads>
+ <order>
+ <hop>
+ <from>sample data</from>
+ <to>0048-simple-mapping-child-no-output.hpl</to>
+ <enabled>Y</enabled>
+ </hop>
+ </order>
+ <transform>
+ <name>0048-simple-mapping-child-no-output.hpl</name>
+ <type>SimpleMapping</type>
+ <description/>
+ <distribute>Y</distribute>
+ <custom_distribution/>
+ <copies>1</copies>
+ <partitioning>
+ <method>none</method>
+ <schema_name/>
+ </partitioning>
+
<filename>${PROJECT_HOME}/0048-simple-mapping-child-no-output.hpl</filename>
+ <no_input>N</no_input>
+ <no_output>Y</no_output>
+ <mappings>
+ <input>
+ <mapping>
+ <connector>
+ <child>fieldA</child>
+ <parent>a</parent>
+ </connector>
+ <connector>
+ <child>fieldB</child>
+ <parent>b</parent>
+ </connector>
+ <main_path>Y</main_path>
+ <rename_on_output>Y</rename_on_output>
+ </mapping>
+ </input>
+ <output>
+ <mapping>
+ <main_path>Y</main_path>
+ <rename_on_output>N</rename_on_output>
+ </mapping>
+ </output>
+ <parameters>
+ <inherit_all_vars>Y</inherit_all_vars>
+ <variablemapping>
+ <input>val1</input>
+ <variable>PAR1</variable>
+ </variablemapping>
+ <variablemapping>
+ <input>val2</input>
+ <variable>PAR2</variable>
+ </variablemapping>
+ </parameters>
+ </mappings>
+ <runConfiguration>local</runConfiguration>
+ <attributes/>
+ <GUI>
+ <xloc>304</xloc>
+ <yloc>80</yloc>
+ </GUI>
+ </transform>
+ <transform>
+ <name>sample data</name>
+ <type>DataGrid</type>
+ <description/>
+ <distribute>Y</distribute>
+ <custom_distribution/>
+ <copies>1</copies>
+ <partitioning>
+ <method>none</method>
+ <schema_name/>
+ </partitioning>
+ <data>
+ <line>
+ <item>1</item>
+ <item>8</item>
+ </line>
+ <line>
+ <item>2</item>
+ <item>7</item>
+ </line>
+ <line>
+ <item>3</item>
+ <item>6</item>
+ </line>
+ <line>
+ <item>4</item>
+ <item>5</item>
+ </line>
+ </data>
+ <fields>
+ <field>
+ <length>-1</length>
+ <precision>-1</precision>
+ <set_empty_string>N</set_empty_string>
+ <name>a</name>
+ <type>Integer</type>
+ </field>
+ <field>
+ <length>-1</length>
+ <precision>-1</precision>
+ <set_empty_string>N</set_empty_string>
+ <name>b</name>
+ <type>Integer</type>
+ </field>
+ </fields>
+ <attributes/>
+ <GUI>
+ <xloc>96</xloc>
+ <yloc>80</yloc>
+ </GUI>
+ </transform>
+ <transform_error_handling>
+ </transform_error_handling>
+ <attributes/>
+</pipeline>
diff --git a/integration-tests/transforms/0048-simple-mapping-verify-no-io.hpl
b/integration-tests/transforms/0048-simple-mapping-verify-no-io.hpl
new file mode 100644
index 0000000000..f063ef031f
--- /dev/null
+++ b/integration-tests/transforms/0048-simple-mapping-verify-no-io.hpl
@@ -0,0 +1,89 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements. See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+-->
+<pipeline>
+ <info>
+ <name>0048-simple-mapping-verify-no-io</name>
+ <name_sync_with_filename>Y</name_sync_with_filename>
+ <description/>
+ <extended_description/>
+ <pipeline_version/>
+ <pipeline_type>Normal</pipeline_type>
+ <parameters>
+ </parameters>
+ <capture_transform_performance>N</capture_transform_performance>
+
<transform_performance_capturing_delay>1000</transform_performance_capturing_delay>
+
<transform_performance_capturing_size_limit>100</transform_performance_capturing_size_limit>
+ <created_user>-</created_user>
+ <created_date>2026/11/04 08:09:00.000</created_date>
+ <modified_user>-</modified_user>
+ <modified_date>2026/11/04 08:09:00.000</modified_date>
+ </info>
+ <notepads>
+ </notepads>
+ <order>
+ <hop>
+ <from>read cube</from>
+ <to>Output</to>
+ <enabled>Y</enabled>
+ </hop>
+ </order>
+ <transform>
+ <name>read cube</name>
+ <type>CubeInput</type>
+ <description/>
+ <distribute>Y</distribute>
+ <custom_distribution/>
+ <copies>1</copies>
+ <partitioning>
+ <method>none</method>
+ <schema_name/>
+ </partitioning>
+ <file>
+ <name>${java.io.tmpdir}/0048-simple-mapping-no-io.cube</name>
+ </file>
+ <limit>0</limit>
+ <addfilenameresult>N</addfilenameresult>
+ <attributes/>
+ <GUI>
+ <xloc>160</xloc>
+ <yloc>80</yloc>
+ </GUI>
+ </transform>
+ <transform>
+ <name>Output</name>
+ <type>Dummy</type>
+ <description/>
+ <distribute>Y</distribute>
+ <custom_distribution/>
+ <copies>1</copies>
+ <partitioning>
+ <method>none</method>
+ <schema_name/>
+ </partitioning>
+ <attributes/>
+ <GUI>
+ <xloc>368</xloc>
+ <yloc>80</yloc>
+ </GUI>
+ </transform>
+ <transform_error_handling>
+ </transform_error_handling>
+ <attributes/>
+</pipeline>
diff --git
a/integration-tests/transforms/0048-simple-mapping-verify-no-output.hpl
b/integration-tests/transforms/0048-simple-mapping-verify-no-output.hpl
new file mode 100644
index 0000000000..ec7e5e1bf8
--- /dev/null
+++ b/integration-tests/transforms/0048-simple-mapping-verify-no-output.hpl
@@ -0,0 +1,89 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements. See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+-->
+<pipeline>
+ <info>
+ <name>0048-simple-mapping-verify-no-output</name>
+ <name_sync_with_filename>Y</name_sync_with_filename>
+ <description/>
+ <extended_description/>
+ <pipeline_version/>
+ <pipeline_type>Normal</pipeline_type>
+ <parameters>
+ </parameters>
+ <capture_transform_performance>N</capture_transform_performance>
+
<transform_performance_capturing_delay>1000</transform_performance_capturing_delay>
+
<transform_performance_capturing_size_limit>100</transform_performance_capturing_size_limit>
+ <created_user>-</created_user>
+ <created_date>2026/11/04 08:09:00.000</created_date>
+ <modified_user>-</modified_user>
+ <modified_date>2026/11/04 08:09:00.000</modified_date>
+ </info>
+ <notepads>
+ </notepads>
+ <order>
+ <hop>
+ <from>read cube</from>
+ <to>Output</to>
+ <enabled>Y</enabled>
+ </hop>
+ </order>
+ <transform>
+ <name>read cube</name>
+ <type>CubeInput</type>
+ <description/>
+ <distribute>Y</distribute>
+ <custom_distribution/>
+ <copies>1</copies>
+ <partitioning>
+ <method>none</method>
+ <schema_name/>
+ </partitioning>
+ <file>
+ <name>${java.io.tmpdir}/0048-simple-mapping-no-output.cube</name>
+ </file>
+ <limit>0</limit>
+ <addfilenameresult>N</addfilenameresult>
+ <attributes/>
+ <GUI>
+ <xloc>160</xloc>
+ <yloc>80</yloc>
+ </GUI>
+ </transform>
+ <transform>
+ <name>Output</name>
+ <type>Dummy</type>
+ <description/>
+ <distribute>Y</distribute>
+ <custom_distribution/>
+ <copies>1</copies>
+ <partitioning>
+ <method>none</method>
+ <schema_name/>
+ </partitioning>
+ <attributes/>
+ <GUI>
+ <xloc>368</xloc>
+ <yloc>80</yloc>
+ </GUI>
+ </transform>
+ <transform_error_handling>
+ </transform_error_handling>
+ <attributes/>
+</pipeline>
diff --git a/integration-tests/transforms/main-0048-simple-mapping.hwf
b/integration-tests/transforms/main-0048-simple-mapping.hwf
index 14993b99d2..c9cb4f4b0f 100644
--- a/integration-tests/transforms/main-0048-simple-mapping.hwf
+++ b/integration-tests/transforms/main-0048-simple-mapping.hwf
@@ -48,6 +48,58 @@ limitations under the License.
<yloc>64</yloc>
<attributes_hac/>
</action>
+ <action>
+ <name>0048-simple-mapping-parent-no-output.hpl</name>
+ <description/>
+ <type>PIPELINE</type>
+ <attributes/>
+
<filename>${PROJECT_HOME}/0048-simple-mapping-parent-no-output.hpl</filename>
+ <params_from_previous>N</params_from_previous>
+ <exec_per_row>N</exec_per_row>
+ <clear_rows>N</clear_rows>
+ <clear_files>N</clear_files>
+ <create_parent_folder>N</create_parent_folder>
+ <set_logfile>N</set_logfile>
+ <set_append_logfile>N</set_append_logfile>
+ <add_date>N</add_date>
+ <add_time>N</add_time>
+ <loglevel>Basic</loglevel>
+ <wait_until_finished>Y</wait_until_finished>
+ <parameters>
+ <pass_all_parameters>Y</pass_all_parameters>
+ </parameters>
+ <run_configuration>local</run_configuration>
+ <parallel>N</parallel>
+ <xloc>304</xloc>
+ <yloc>64</yloc>
+ <attributes_hac/>
+ </action>
+ <action>
+ <name>0048-simple-mapping-parent-no-io.hpl</name>
+ <description/>
+ <type>PIPELINE</type>
+ <attributes/>
+ <filename>${PROJECT_HOME}/0048-simple-mapping-parent-no-io.hpl</filename>
+ <params_from_previous>N</params_from_previous>
+ <exec_per_row>N</exec_per_row>
+ <clear_rows>N</clear_rows>
+ <clear_files>N</clear_files>
+ <create_parent_folder>N</create_parent_folder>
+ <set_logfile>N</set_logfile>
+ <set_append_logfile>N</set_append_logfile>
+ <add_date>N</add_date>
+ <add_time>N</add_time>
+ <loglevel>Basic</loglevel>
+ <wait_until_finished>Y</wait_until_finished>
+ <parameters>
+ <pass_all_parameters>Y</pass_all_parameters>
+ </parameters>
+ <run_configuration>local</run_configuration>
+ <parallel>N</parallel>
+ <xloc>512</xloc>
+ <yloc>64</yloc>
+ <attributes_hac/>
+ </action>
<action>
<name>Run simple-mapping tests</name>
<description/>
@@ -57,19 +109,151 @@ limitations under the License.
<test_name>
<name>0048-simple-mapping-parent-01 UNIT</name>
</test_name>
+ <test_name>
+ <name>0048-simple-mapping-parent-no-input UNIT</name>
+ </test_name>
+ <test_name>
+ <name>0048-simple-mapping-verify-no-output UNIT</name>
+ </test_name>
+ <test_name>
+ <name>0048-simple-mapping-verify-no-io UNIT</name>
+ </test_name>
</test_names>
<parallel>N</parallel>
- <xloc>304</xloc>
+ <xloc>720</xloc>
<yloc>64</yloc>
<attributes_hac/>
</action>
+ <action>
+ <name>Delete no-output cube</name>
+ <description/>
+ <type>DELETE_FILE</type>
+ <attributes/>
+ <filename>${java.io.tmpdir}/0048-simple-mapping-no-output.cube</filename>
+ <fail_if_file_not_exists>N</fail_if_file_not_exists>
+ <parallel>N</parallel>
+ <xloc>928</xloc>
+ <yloc>64</yloc>
+ <attributes_hac/>
+ </action>
+ <action>
+ <name>Delete no-io cube</name>
+ <description/>
+ <type>DELETE_FILE</type>
+ <attributes/>
+ <filename>${java.io.tmpdir}/0048-simple-mapping-no-io.cube</filename>
+ <fail_if_file_not_exists>N</fail_if_file_not_exists>
+ <parallel>N</parallel>
+ <xloc>1136</xloc>
+ <yloc>64</yloc>
+ <attributes_hac/>
+ </action>
+ <action>
+ <name>Delete no-output cube after failure</name>
+ <description/>
+ <type>DELETE_FILE</type>
+ <attributes/>
+ <filename>${java.io.tmpdir}/0048-simple-mapping-no-output.cube</filename>
+ <fail_if_file_not_exists>N</fail_if_file_not_exists>
+ <parallel>N</parallel>
+ <xloc>512</xloc>
+ <yloc>208</yloc>
+ <attributes_hac/>
+ </action>
+ <action>
+ <name>Delete no-io cube after failure</name>
+ <description/>
+ <type>DELETE_FILE</type>
+ <attributes/>
+ <filename>${java.io.tmpdir}/0048-simple-mapping-no-io.cube</filename>
+ <fail_if_file_not_exists>N</fail_if_file_not_exists>
+ <parallel>N</parallel>
+ <xloc>720</xloc>
+ <yloc>208</yloc>
+ <attributes_hac/>
+ </action>
+ <action>
+ <name>Abort workflow</name>
+ <description/>
+ <type>ABORT</type>
+ <attributes/>
+ <message>Simple mapping integration test failed</message>
+ <loglevel>Error</loglevel>
+ <parallel>N</parallel>
+ <xloc>928</xloc>
+ <yloc>208</yloc>
+ <attributes_hac/>
+ </action>
</actions>
<hops>
<hop>
<from>Start</from>
+ <to>0048-simple-mapping-parent-no-output.hpl</to>
+ <enabled>Y</enabled>
+ <evaluation>Y</evaluation>
+ <unconditional>Y</unconditional>
+ </hop>
+ <hop>
+ <from>0048-simple-mapping-parent-no-output.hpl</from>
+ <to>0048-simple-mapping-parent-no-io.hpl</to>
+ <enabled>Y</enabled>
+ <evaluation>Y</evaluation>
+ <unconditional>N</unconditional>
+ </hop>
+ <hop>
+ <from>0048-simple-mapping-parent-no-output.hpl</from>
+ <to>Delete no-output cube after failure</to>
+ <enabled>Y</enabled>
+ <evaluation>N</evaluation>
+ <unconditional>N</unconditional>
+ </hop>
+ <hop>
+ <from>0048-simple-mapping-parent-no-io.hpl</from>
<to>Run simple-mapping tests</to>
<enabled>Y</enabled>
<evaluation>Y</evaluation>
+ <unconditional>N</unconditional>
+ </hop>
+ <hop>
+ <from>0048-simple-mapping-parent-no-io.hpl</from>
+ <to>Delete no-output cube after failure</to>
+ <enabled>Y</enabled>
+ <evaluation>N</evaluation>
+ <unconditional>N</unconditional>
+ </hop>
+ <hop>
+ <from>Run simple-mapping tests</from>
+ <to>Delete no-output cube</to>
+ <enabled>Y</enabled>
+ <evaluation>Y</evaluation>
+ <unconditional>N</unconditional>
+ </hop>
+ <hop>
+ <from>Run simple-mapping tests</from>
+ <to>Delete no-output cube after failure</to>
+ <enabled>Y</enabled>
+ <evaluation>N</evaluation>
+ <unconditional>N</unconditional>
+ </hop>
+ <hop>
+ <from>Delete no-output cube</from>
+ <to>Delete no-io cube</to>
+ <enabled>Y</enabled>
+ <evaluation>Y</evaluation>
+ <unconditional>N</unconditional>
+ </hop>
+ <hop>
+ <from>Delete no-output cube after failure</from>
+ <to>Delete no-io cube after failure</to>
+ <enabled>Y</enabled>
+ <evaluation>Y</evaluation>
+ <unconditional>Y</unconditional>
+ </hop>
+ <hop>
+ <from>Delete no-io cube after failure</from>
+ <to>Abort workflow</to>
+ <enabled>Y</enabled>
+ <evaluation>Y</evaluation>
<unconditional>Y</unconditional>
</hop>
</hops>
diff --git
a/integration-tests/transforms/metadata/unit-test/0048-simple-mapping-parent-no-input
UNIT.json
b/integration-tests/transforms/metadata/unit-test/0048-simple-mapping-parent-no-input
UNIT.json
new file mode 100644
index 0000000000..5d9dc6bf52
--- /dev/null
+++
b/integration-tests/transforms/metadata/unit-test/0048-simple-mapping-parent-no-input
UNIT.json
@@ -0,0 +1,48 @@
+{
+ "variableValues": [],
+ "database_replacements": [],
+ "autoOpening": true,
+ "basePath": "",
+ "golden_data_sets": [
+ {
+ "field_mappings": [
+ {
+ "transform_field": "a",
+ "data_set_field": "a"
+ },
+ {
+ "transform_field": "b",
+ "data_set_field": "b"
+ },
+ {
+ "transform_field": "sum",
+ "data_set_field": "sum"
+ },
+ {
+ "transform_field": "parameter1",
+ "data_set_field": "parameter1"
+ },
+ {
+ "transform_field": "parameter2",
+ "data_set_field": "parameter2"
+ }
+ ],
+ "field_order": [
+ "a",
+ "b",
+ "sum",
+ "parameter1",
+ "parameter2"
+ ],
+ "data_set_name": "golden-simple-mapping-01",
+ "transform_name": "Output"
+ }
+ ],
+ "input_data_sets": [],
+ "name": "0048-simple-mapping-parent-no-input UNIT",
+ "description": "",
+ "persist_filename": "",
+ "trans_test_tweaks": [],
+ "pipeline_filename": "./0048-simple-mapping-parent-no-input.hpl",
+ "test_type": "UNIT_TEST"
+}
diff --git
a/integration-tests/transforms/metadata/unit-test/0048-simple-mapping-verify-no-io
UNIT.json
b/integration-tests/transforms/metadata/unit-test/0048-simple-mapping-verify-no-io
UNIT.json
new file mode 100644
index 0000000000..ae15cc1a5b
--- /dev/null
+++
b/integration-tests/transforms/metadata/unit-test/0048-simple-mapping-verify-no-io
UNIT.json
@@ -0,0 +1,48 @@
+{
+ "variableValues": [],
+ "database_replacements": [],
+ "autoOpening": true,
+ "basePath": "",
+ "golden_data_sets": [
+ {
+ "field_mappings": [
+ {
+ "transform_field": "fieldA",
+ "data_set_field": "a"
+ },
+ {
+ "transform_field": "fieldB",
+ "data_set_field": "b"
+ },
+ {
+ "transform_field": "fieldSum",
+ "data_set_field": "sum"
+ },
+ {
+ "transform_field": "par1",
+ "data_set_field": "parameter1"
+ },
+ {
+ "transform_field": "par2",
+ "data_set_field": "parameter2"
+ }
+ ],
+ "field_order": [
+ "a",
+ "b",
+ "sum",
+ "parameter1",
+ "parameter2"
+ ],
+ "data_set_name": "golden-simple-mapping-01",
+ "transform_name": "Output"
+ }
+ ],
+ "input_data_sets": [],
+ "name": "0048-simple-mapping-verify-no-io UNIT",
+ "description": "",
+ "persist_filename": "",
+ "trans_test_tweaks": [],
+ "pipeline_filename": "./0048-simple-mapping-verify-no-io.hpl",
+ "test_type": "UNIT_TEST"
+}
diff --git
a/integration-tests/transforms/metadata/unit-test/0048-simple-mapping-verify-no-output
UNIT.json
b/integration-tests/transforms/metadata/unit-test/0048-simple-mapping-verify-no-output
UNIT.json
new file mode 100644
index 0000000000..e68c2696b1
--- /dev/null
+++
b/integration-tests/transforms/metadata/unit-test/0048-simple-mapping-verify-no-output
UNIT.json
@@ -0,0 +1,48 @@
+{
+ "variableValues": [],
+ "database_replacements": [],
+ "autoOpening": true,
+ "basePath": "",
+ "golden_data_sets": [
+ {
+ "field_mappings": [
+ {
+ "transform_field": "fieldA",
+ "data_set_field": "a"
+ },
+ {
+ "transform_field": "fieldB",
+ "data_set_field": "b"
+ },
+ {
+ "transform_field": "fieldSum",
+ "data_set_field": "sum"
+ },
+ {
+ "transform_field": "par1",
+ "data_set_field": "parameter1"
+ },
+ {
+ "transform_field": "par2",
+ "data_set_field": "parameter2"
+ }
+ ],
+ "field_order": [
+ "a",
+ "b",
+ "sum",
+ "parameter1",
+ "parameter2"
+ ],
+ "data_set_name": "golden-simple-mapping-01",
+ "transform_name": "Output"
+ }
+ ],
+ "input_data_sets": [],
+ "name": "0048-simple-mapping-verify-no-output UNIT",
+ "description": "",
+ "persist_filename": "",
+ "trans_test_tweaks": [],
+ "pipeline_filename": "./0048-simple-mapping-verify-no-output.hpl",
+ "test_type": "UNIT_TEST"
+}
diff --git
a/plugins/transforms/mapping/src/main/java/org/apache/hop/pipeline/transforms/mapping/RowOutputDataMapper.java
b/plugins/transforms/mapping/src/main/java/org/apache/hop/pipeline/transforms/mapping/RowOutputDataMapper.java
index 56a916c6e4..8da8852f47 100644
---
a/plugins/transforms/mapping/src/main/java/org/apache/hop/pipeline/transforms/mapping/RowOutputDataMapper.java
+++
b/plugins/transforms/mapping/src/main/java/org/apache/hop/pipeline/transforms/mapping/RowOutputDataMapper.java
@@ -48,7 +48,7 @@ public class RowOutputDataMapper extends RowAdapter {
first = false;
renamedRowMeta = rowMeta.clone();
- if (inputDefinition.isRenamingOnOutput()) {
+ if (inputDefinition != null && inputDefinition.isRenamingOnOutput()) {
for (MappingValueRename valueRename :
inputDefinition.getValueRenames()) {
IValueMeta valueMeta =
renamedRowMeta.searchValueMeta(valueRename.getTargetValueName());
if (valueMeta != null) {
@@ -56,10 +56,12 @@ public class RowOutputDataMapper extends RowAdapter {
}
}
}
- for (MappingValueRename valueRename :
outputDefinition.getValueRenames()) {
- IValueMeta valueMeta =
renamedRowMeta.searchValueMeta(valueRename.getSourceValueName());
- if (valueMeta != null) {
- valueMeta.setName(valueRename.getTargetValueName());
+ if (outputDefinition != null) {
+ for (MappingValueRename valueRename :
outputDefinition.getValueRenames()) {
+ IValueMeta valueMeta =
renamedRowMeta.searchValueMeta(valueRename.getSourceValueName());
+ if (valueMeta != null) {
+ valueMeta.setName(valueRename.getTargetValueName());
+ }
}
}
}
diff --git
a/plugins/transforms/mapping/src/main/java/org/apache/hop/pipeline/transforms/mapping/SimpleMapping.java
b/plugins/transforms/mapping/src/main/java/org/apache/hop/pipeline/transforms/mapping/SimpleMapping.java
index a4f94b9321..62c103bc63 100644
---
a/plugins/transforms/mapping/src/main/java/org/apache/hop/pipeline/transforms/mapping/SimpleMapping.java
+++
b/plugins/transforms/mapping/src/main/java/org/apache/hop/pipeline/transforms/mapping/SimpleMapping.java
@@ -66,27 +66,53 @@ public class SimpleMapping extends
BaseTransform<SimpleMappingMeta, SimpleMappin
first = false;
data.wasStarted = true;
- // Rows read are injected into the one available Mapping Input
transform.
- // This adds an input RowSet to the Mapping Input transform.
- //
- String mappingInputTransformName =
data.mappingInput.getTransformName();
- RowProducer rowProducer =
data.mappingPipeline.addRowProducer(mappingInputTransformName, 0);
- data.rowDataInputMapper = new
RowDataInputMapper(meta.getInputMapping(), rowProducer);
+ if (!meta.isNoInput()) {
+ // Rows read are injected into the one available Mapping Input
transform.
+ // This adds an input RowSet to the Mapping Input transform.
+ //
+ String mappingInputTransformName =
data.mappingInput.getTransformName();
+ RowProducer rowProducer =
+ data.mappingPipeline.addRowProducer(mappingInputTransformName,
0);
+ data.rowDataInputMapper = new
RowDataInputMapper(meta.getInputMapping(), rowProducer);
+ } else {
+ // If the sub-pipeline still has MappingInput transform(s) when
noInput is selected,
+ // mark their producers finished immediately so they don't block.
+ for (MappingInput mappingInput :
findMappingInputs(data.mappingPipeline)) {
+ RowProducer rowProducer =
+
data.mappingPipeline.addRowProducer(mappingInput.getTransformName(), 0);
+ rowProducer.finished();
+ }
+ }
- // Rows produced by the mapping are read and passed on.
- //
- String mappingOutputTransformName =
data.mappingOutput.getTransformName();
- ITransform iOutputTransform =
- data.mappingPipeline.getTransform(mappingOutputTransformName, 0);
- RowOutputDataMapper outputDataMapper =
- new RowOutputDataMapper(meta.getInputMapping(),
meta.getOutputMapping(), this::putRow);
- iOutputTransform.addRowListener(outputDataMapper);
+ if (!meta.isNoOutput()) {
+ // Rows produced by the mapping are read and passed on.
+ //
+ String mappingOutputTransformName =
data.mappingOutput.getTransformName();
+ ITransform iOutputTransform =
+ data.mappingPipeline.getTransform(mappingOutputTransformName, 0);
+ MappingIODefinition inputDefinition = meta.isNoInput() ? null :
meta.getInputMapping();
+ RowOutputDataMapper outputDataMapper =
+ new RowOutputDataMapper(inputDefinition,
meta.getOutputMapping(), this::putRow);
+ iOutputTransform.addRowListener(outputDataMapper);
+ }
// Start the mapping/sub-pipeline threads
//
data.mappingPipeline.startThreads();
}
+ if (meta.isNoInput()) {
+ if (data.executor != null) {
+ while (data.executor.oneIteration() && !isStopped()) {
+ // Keep driving iterations until all transforms in the
sub-pipeline are done
+ }
+ } else {
+ data.mappingPipeline.waitUntilFinished();
+ }
+ setOutputDone();
+ return false;
+ }
+
// The data we read we pass to the mapping
//
Object[] row = getRow();
@@ -98,7 +124,9 @@ public class SimpleMapping extends
BaseTransform<SimpleMappingMeta, SimpleMappin
}
if (!rowWasPut) {
- data.rowDataInputMapper.finished();
+ if (data.rowDataInputMapper != null) {
+ data.rowDataInputMapper.finished();
+ }
data.mappingPipeline.waitUntilFinished();
setOutputDone();
return false;
@@ -219,27 +247,35 @@ public class SimpleMapping extends
BaseTransform<SimpleMappingMeta, SimpleMappin
// If there is no read/write logging transform set, we can insert the data
from
// the first mapping input/output transform...
//
- List<MappingInput> mappingInputs =
findMappingInputs(simpleMappingData.mappingPipeline);
- if (mappingInputs.isEmpty()) {
- throw new HopException(
- "The simple mapping transform needs one Mapping Input transform to
write to in the sub-pipeline");
- }
- if (mappingInputs.size() > 1) {
- throw new HopException(
- "The simple mapping transform does not support multiple Mapping
Input transforms to write to in the sub-pipeline");
+ if (!meta.isNoInput()) {
+ List<MappingInput> mappingInputs =
findMappingInputs(simpleMappingData.mappingPipeline);
+ if (mappingInputs.isEmpty()) {
+ throw new HopException(
+ "The simple mapping transform needs one Mapping Input transform to
write to in the sub-pipeline");
+ }
+ if (mappingInputs.size() > 1) {
+ throw new HopException(
+ "The simple mapping transform does not support multiple Mapping
Input transforms to write to in the sub-pipeline");
+ }
+ simpleMappingData.mappingInput = mappingInputs.get(0);
+ } else {
+ simpleMappingData.mappingInput = null;
}
- simpleMappingData.mappingInput = mappingInputs.get(0);
- List<MappingOutput> mappingOutputs =
findMappingOutputs(simpleMappingData.mappingPipeline);
- if (mappingOutputs.isEmpty()) {
- throw new HopException(
- "The simple mapping transform needs one Mapping Output transform to
read from in the sub-pipeline");
- }
- if (mappingOutputs.size() > 1) {
- throw new HopException(
- "The simple mapping transform does not support multiple Mapping
Output transforms to read from in the sub-pipeline");
+ if (!meta.isNoOutput()) {
+ List<MappingOutput> mappingOutputs =
findMappingOutputs(simpleMappingData.mappingPipeline);
+ if (mappingOutputs.isEmpty()) {
+ throw new HopException(
+ "The simple mapping transform needs one Mapping Output transform
to read from in the sub-pipeline");
+ }
+ if (mappingOutputs.size() > 1) {
+ throw new HopException(
+ "The simple mapping transform does not support multiple Mapping
Output transforms to read from in the sub-pipeline");
+ }
+ simpleMappingData.mappingOutput = mappingOutputs.get(0);
+ } else {
+ simpleMappingData.mappingOutput = null;
}
- simpleMappingData.mappingOutput = mappingOutputs.get(0);
// Finally, add the mapping pipeline to the active sub-pipelines
// map in the parent pipeline
@@ -286,6 +322,14 @@ public class SimpleMapping extends
BaseTransform<SimpleMappingMeta, SimpleMappin
@Override
public boolean init() {
+ // Incoming hops are refused by BaseTransform.init() when
consumesMainInput() is false.
+ // Outgoing hops have no engine equivalent.
+ if (meta.isNoOutput() && !getOutputRowSets().isEmpty()) {
+ logError(BaseMessages.getString(PKG,
"SimpleMapping.Log.NoOutputButOutgoingHops"));
+ setErrors(1);
+ return false;
+ }
+
if (super.init()) {
// First we need to load the mapping (pipeline)
try {
diff --git
a/plugins/transforms/mapping/src/main/java/org/apache/hop/pipeline/transforms/mapping/SimpleMappingDialog.java
b/plugins/transforms/mapping/src/main/java/org/apache/hop/pipeline/transforms/mapping/SimpleMappingDialog.java
index 4e5b7944bf..55dc6cda3e 100644
---
a/plugins/transforms/mapping/src/main/java/org/apache/hop/pipeline/transforms/mapping/SimpleMappingDialog.java
+++
b/plugins/transforms/mapping/src/main/java/org/apache/hop/pipeline/transforms/mapping/SimpleMappingDialog.java
@@ -123,10 +123,17 @@ public class SimpleMappingDialog extends
BaseTransformDialog {
private final TableView wFieldMappings;
- public MappingDefinitionTab(MappingIODefinition definition, TableView
fieldMappings) {
+ private final Button wNoIo;
+
+ private final boolean input;
+
+ public MappingDefinitionTab(
+ MappingIODefinition definition, TableView fieldMappings, Button wNoIo,
boolean input) {
super();
this.definition = definition;
- wFieldMappings = fieldMappings;
+ this.wFieldMappings = fieldMappings;
+ this.wNoIo = wNoIo;
+ this.input = input;
}
@Override
@@ -139,6 +146,11 @@ public class SimpleMappingDialog extends
BaseTransformDialog {
TableItem item = wFieldMappings.getNonEmpty(i);
definition.getValueRenames().add(new
MappingValueRename(item.getText(1), item.getText(2)));
}
+ if (input) {
+ mappingMeta.setNoInput(wNoIo.getSelection());
+ } else {
+ mappingMeta.setNoOutput(wNoIo.getSelection());
+ }
}
}
@@ -524,6 +536,20 @@ public class SimpleMappingDialog extends
BaseTransformDialog {
tabLayout.marginHeight = 15;
wInputComposite.setLayout(tabLayout);
+ final Button wNoIo = new Button(wInputComposite, SWT.CHECK);
+ PropsUi.setLook(wNoIo);
+ if (input) {
+ wNoIo.setText(BaseMessages.getString(PKG,
"SimpleMappingDialog.input.NoInput"));
+ wNoIo.setSelection(mappingMeta.isNoInput());
+ } else {
+ wNoIo.setText(BaseMessages.getString(PKG,
"SimpleMappingDialog.output.NoOutput"));
+ wNoIo.setSelection(mappingMeta.isNoOutput());
+ }
+ FormData fdNoIo = new FormData();
+ fdNoIo.top = new FormAttachment(0, 0);
+ fdNoIo.left = new FormAttachment(0, 0);
+ wNoIo.setLayoutData(fdNoIo);
+
// Now add a table view with the 2 columns to specify: input and output
// fields for the source and target transforms.
//
@@ -560,7 +586,7 @@ public class SimpleMappingDialog extends
BaseTransformDialog {
FormData fdMappings = new FormData();
fdMappings.left = new FormAttachment(0);
fdMappings.right = new FormAttachment(100);
- fdMappings.top = new FormAttachment(0);
+ fdMappings.top = new FormAttachment(wNoIo, 10);
fdMappings.bottom = new FormAttachment(wbEnterMapping, -10);
wFieldMappings.setLayoutData(fdMappings);
wFieldMappings.getTable().addListener(SWT.Resize, new ColumnsResizer(0,
50, 50));
@@ -647,8 +673,9 @@ public class SimpleMappingDialog extends
BaseTransformDialog {
}
});
+ final Button wRenameOutput;
if (input) {
- Button wRenameOutput = new Button(wInputComposite, SWT.CHECK);
+ wRenameOutput = new Button(wInputComposite, SWT.CHECK);
PropsUi.setLook(wRenameOutput);
wRenameOutput.setText(
BaseMessages.getString(PKG,
"SimpleMappingDialog.input.RenamingOnOutput"));
@@ -664,10 +691,33 @@ public class SimpleMappingDialog extends
BaseTransformDialog {
public void widgetSelected(SelectionEvent event) {
// flip the switch
definition.setRenamingOnOutput(!definition.isRenamingOnOutput());
+ mappingMeta.setChanged();
}
});
+ } else {
+ wRenameOutput = null;
}
+ Runnable updateControls =
+ () -> {
+ boolean enabled = !wNoIo.getSelection();
+ wFieldMappings.setEnabled(enabled);
+ wbEnterMapping.setEnabled(enabled);
+ if (wRenameOutput != null) {
+ wRenameOutput.setEnabled(enabled);
+ }
+ };
+ updateControls.run();
+
+ wNoIo.addSelectionListener(
+ new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent event) {
+ updateControls.run();
+ mappingMeta.setChanged();
+ }
+ });
+
FormData fdParametersComposite = new FormData();
fdParametersComposite.left = new FormAttachment(0, 0);
fdParametersComposite.top = new FormAttachment(0, 0);
@@ -678,7 +728,8 @@ public class SimpleMappingDialog extends
BaseTransformDialog {
wInputComposite.layout();
wTab.setControl(wInputComposite);
- final ApplyChanges applyChanges = new MappingDefinitionTab(definition,
wFieldMappings);
+ final ApplyChanges applyChanges =
+ new MappingDefinitionTab(definition, wFieldMappings, wNoIo, input);
changeList.add(applyChanges);
wTabFolder.setSelection(wTab);
diff --git
a/plugins/transforms/mapping/src/main/java/org/apache/hop/pipeline/transforms/mapping/SimpleMappingMeta.java
b/plugins/transforms/mapping/src/main/java/org/apache/hop/pipeline/transforms/mapping/SimpleMappingMeta.java
index 29af728bc0..d9a9356e42 100644
---
a/plugins/transforms/mapping/src/main/java/org/apache/hop/pipeline/transforms/mapping/SimpleMappingMeta.java
+++
b/plugins/transforms/mapping/src/main/java/org/apache/hop/pipeline/transforms/mapping/SimpleMappingMeta.java
@@ -19,6 +19,7 @@ package org.apache.hop.pipeline.transforms.mapping;
import java.util.ArrayList;
import java.util.List;
+import lombok.Getter;
import org.apache.commons.lang3.StringUtils;
import org.apache.hop.core.CheckResult;
import org.apache.hop.core.ICheckResult;
@@ -71,6 +72,20 @@ public class SimpleMappingMeta extends
TransformWithMappingMeta<SimpleMapping, S
@HopMetadataProperty(key = "mappings")
private IOMappings ioMappings;
+ @Getter
+ @HopMetadataProperty(
+ key = "no_input",
+ injectionKey = "NO_INPUT",
+ injectionKeyDescription = "SimpleMapping.Injection.NO_INPUT")
+ private boolean noInput;
+
+ @Getter
+ @HopMetadataProperty(
+ key = "no_output",
+ injectionKey = "NO_OUTPUT",
+ injectionKeyDescription = "SimpleMapping.Injection.NO_OUTPUT")
+ private boolean noOutput;
+
public SimpleMappingMeta() {
super();
ioMappings = new IOMappings();
@@ -86,6 +101,29 @@ public class SimpleMappingMeta extends
TransformWithMappingMeta<SimpleMapping, S
MappingIODefinition outputDefinition = new MappingIODefinition(null, null);
outputDefinition.setMainDataPath(true);
ioMappings.setOutputMapping(outputDefinition);
+
+ noInput = false;
+ noOutput = false;
+ }
+
+ public void setNoInput(boolean noInput) {
+ this.noInput = noInput;
+ resetTransformIoMeta();
+ }
+
+ public void setNoOutput(boolean noOutput) {
+ this.noOutput = noOutput;
+ resetTransformIoMeta();
+ }
+
+ @Override
+ public boolean consumesMainInput() {
+ return !noInput;
+ }
+
+ @Override
+ public boolean canStartWithoutInput() {
+ return noInput;
}
@Override
@@ -97,6 +135,11 @@ public class SimpleMappingMeta extends
TransformWithMappingMeta<SimpleMapping, S
IVariables variables,
IHopMetadataProvider metadataProvider)
throws HopTransformException {
+ if (noOutput) {
+ row.clear();
+ return;
+ }
+
// First load some interesting data...
// Then see which fields get added to the row.
@@ -110,44 +153,41 @@ public class SimpleMappingMeta extends
TransformWithMappingMeta<SimpleMapping, S
e);
}
- // Before we ask the mapping outputs anything, we should teach the mapping
- // input transforms in the sub- pipeline about the data coming in...
- //
- IRowMeta inputRowMeta;
-
- // The row metadata, what we pass to the mapping input transform
- // definition.getOutputTransform(), is "row"
- // However, we do need to re-map some fields...
- //
- inputRowMeta = row.clone();
- if (!inputRowMeta.isEmpty()) {
- for (MappingValueRename valueRename :
ioMappings.getInputMapping().getValueRenames()) {
- IValueMeta valueMeta =
inputRowMeta.searchValueMeta(valueRename.getSourceValueName());
- if (valueMeta == null) {
- throw new HopTransformException(
- BaseMessages.getString(
- PKG,
- "SimpleMappingMeta.Exception.UnableToFindField",
- valueRename.getSourceValueName()));
+ if (!noInput) {
+ // Before we ask the mapping outputs anything, we should teach the
mapping
+ // input transforms in the sub-pipeline about the data coming in...
+ //
+ IRowMeta inputRowMeta = row.clone();
+ if (!inputRowMeta.isEmpty()) {
+ for (MappingValueRename valueRename :
ioMappings.getInputMapping().getValueRenames()) {
+ IValueMeta valueMeta =
inputRowMeta.searchValueMeta(valueRename.getSourceValueName());
+ if (valueMeta == null) {
+ throw new HopTransformException(
+ BaseMessages.getString(
+ PKG,
+ "SimpleMappingMeta.Exception.UnableToFindField",
+ valueRename.getSourceValueName()));
+ }
+ valueMeta.setName(valueRename.getTargetValueName());
}
- valueMeta.setName(valueRename.getTargetValueName());
}
- }
- // What is this mapping input transform?
- //
- TransformMeta mappingInputTransform =
findMappingInputTransform(mappingPipelineMeta, null);
- TransformMeta mappingOutputTransform =
findMappingOutputTransform(mappingPipelineMeta, null);
+ // What is this mapping input transform?
+ //
+ TransformMeta mappingInputTransform =
findMappingInputTransform(mappingPipelineMeta, null);
- // We're certain of these classes at least
- //
- MappingInputMeta mappingInputMeta = (MappingInputMeta)
mappingInputTransform.getTransform();
+ // We're certain of these classes at least
+ //
+ MappingInputMeta mappingInputMeta = (MappingInputMeta)
mappingInputTransform.getTransform();
- // Inform the mapping input transform about what it's going to receive...
- //
- mappingInputMeta.setInputRowMeta(inputRowMeta);
+ // Inform the mapping input transform about what it's going to receive...
+ //
+ mappingInputMeta.setInputRowMeta(inputRowMeta);
+ }
+
+ TransformMeta mappingOutputTransform =
findMappingOutputTransform(mappingPipelineMeta, null);
- // Now we know wat's going to come out of the mapping pipeline...
+ // Now we know what's going to come out of the mapping pipeline...
// This is going to be the full row that's being written.
//
IRowMeta mappingOutputRowMeta =
@@ -155,7 +195,7 @@ public class SimpleMappingMeta extends
TransformWithMappingMeta<SimpleMapping, S
// We're renaming some stuff back:
//
- if (ioMappings.getInputMapping().isRenamingOnOutput()) {
+ if (!noInput && ioMappings.getInputMapping().isRenamingOnOutput()) {
for (MappingValueRename rename :
ioMappings.getInputMapping().getValueRenames()) {
IValueMeta valueMeta =
mappingOutputRowMeta.searchValueMeta(rename.getTargetValueName());
if (valueMeta != null) {
@@ -197,38 +237,71 @@ public class SimpleMappingMeta extends
TransformWithMappingMeta<SimpleMapping, S
IVariables variables,
IHopMetadataProvider metadataProvider) {
CheckResult cr;
- if (prev == null || prev.isEmpty()) {
- cr =
- new CheckResult(
- ICheckResult.TYPE_RESULT_WARNING,
- BaseMessages.getString(PKG,
"SimpleMappingMeta.CheckResult.NotReceivingAnyFields"),
- transformMeta);
- remarks.add(cr);
+ if (noInput) {
+ // An incoming hop is reported by PipelineMeta because
consumesMainInput() is false.
+ if (input.length == 0) {
+ cr =
+ new CheckResult(
+ ICheckResult.TYPE_RESULT_OK,
+ BaseMessages.getString(PKG,
"SimpleMappingMeta.CheckResult.NoInputConfigured"),
+ transformMeta);
+ remarks.add(cr);
+ }
} else {
- cr =
- new CheckResult(
- ICheckResult.TYPE_RESULT_OK,
- BaseMessages.getString(
- PKG,
"SimpleMappingMeta.CheckResult.TransformReceivingFields", prev.size() + ""),
- transformMeta);
- remarks.add(cr);
+ if (prev == null || prev.isEmpty()) {
+ cr =
+ new CheckResult(
+ ICheckResult.TYPE_RESULT_WARNING,
+ BaseMessages.getString(PKG,
"SimpleMappingMeta.CheckResult.NotReceivingAnyFields"),
+ transformMeta);
+ remarks.add(cr);
+ } else {
+ cr =
+ new CheckResult(
+ ICheckResult.TYPE_RESULT_OK,
+ BaseMessages.getString(
+ PKG,
+ "SimpleMappingMeta.CheckResult.TransformReceivingFields",
+ prev.size() + ""),
+ transformMeta);
+ remarks.add(cr);
+ }
+
+ // See if we have input streams leading to this transform!
+ if (input.length > 0) {
+ cr =
+ new CheckResult(
+ ICheckResult.TYPE_RESULT_OK,
+ BaseMessages.getString(
+ PKG,
+
"SimpleMappingMeta.CheckResult.TransformReceivingFieldsFromOtherTransforms"),
+ transformMeta);
+ remarks.add(cr);
+ } else {
+ cr =
+ new CheckResult(
+ ICheckResult.TYPE_RESULT_ERROR,
+ BaseMessages.getString(PKG,
"SimpleMappingMeta.CheckResult.NoInputReceived"),
+ transformMeta);
+ remarks.add(cr);
+ }
}
- // See if we have input streams leading to this transform!
- if (input.length > 0) {
- cr =
- new CheckResult(
- ICheckResult.TYPE_RESULT_OK,
- BaseMessages.getString(
- PKG,
"SimpleMappingMeta.CheckResult.TransformReceivingFieldsFromOtherTransforms"),
- transformMeta);
- remarks.add(cr);
- } else {
- cr =
- new CheckResult(
- ICheckResult.TYPE_RESULT_ERROR,
- BaseMessages.getString(PKG,
"SimpleMappingMeta.CheckResult.NoInputReceived"),
- transformMeta);
+ if (noOutput) {
+ if (output.length > 0) {
+ cr =
+ new CheckResult(
+ ICheckResult.TYPE_RESULT_ERROR,
+ BaseMessages.getString(
+ PKG,
"SimpleMappingMeta.CheckResult.NoOutputButOutgoingHops"),
+ transformMeta);
+ } else {
+ cr =
+ new CheckResult(
+ ICheckResult.TYPE_RESULT_OK,
+ BaseMessages.getString(PKG,
"SimpleMappingMeta.CheckResult.NoOutputConfigured"),
+ transformMeta);
+ }
remarks.add(cr);
}
}
@@ -268,7 +341,7 @@ public class SimpleMappingMeta extends
TransformWithMappingMeta<SimpleMapping, S
public ITransformIOMeta getTransformIOMeta() {
ITransformIOMeta ioMeta = super.getTransformIOMeta(false);
if (ioMeta == null) {
- ioMeta = new TransformIOMeta(true, true, false, false, false, false);
+ ioMeta = new TransformIOMeta(!noInput, !noOutput, false, false, false,
false);
setTransformIOMeta(ioMeta);
}
return ioMeta;
diff --git
a/plugins/transforms/mapping/src/main/resources/org/apache/hop/pipeline/transforms/mapping/messages/messages_en_US.properties
b/plugins/transforms/mapping/src/main/resources/org/apache/hop/pipeline/transforms/mapping/messages/messages_en_US.properties
index 57fcf654c3..316d2bffe9 100644
---
a/plugins/transforms/mapping/src/main/resources/org/apache/hop/pipeline/transforms/mapping/messages/messages_en_US.properties
+++
b/plugins/transforms/mapping/src/main/resources/org/apache/hop/pipeline/transforms/mapping/messages/messages_en_US.properties
@@ -27,6 +27,7 @@ SimpleMapping.Exception.UnableToReadRowFromTransform=Unable
to read a single row
SimpleMapping.Log.CouldNotFindMappingInputTransform=Couldn''t find
MappingInput transform in the mapping.
SimpleMapping.Log.CouldNotFindMappingInputTransform2=Couldn''t find
MappingOutput transform in the mapping.
SimpleMapping.Log.ErrorOccurredInSubPipeline=An error occurred in the
sub-pipeline, halting processing
+SimpleMapping.Log.NoOutputButOutgoingHops=Simple Mapping is set to run without
output, but outgoing hops are still connected. Remove those hops before running.
SimpleMapping.Log.InputFieldNotSpecified=Input field #{0} is not specified!
SimpleMapping.Log.LineNumber=Linenr
SimpleMapping.Log.RenameFieldInfo=#{0} : index={1}, new name={2}
@@ -73,7 +74,9 @@
SimpleMappingDialog.Exception.UnableToReferenceObjectId.Message=Unable to get in
SimpleMappingDialog.Exception.UnableToReferenceObjectId.Title=Error
SimpleMappingDialog.GetFromMapping.Button=Get from mapping
SimpleMappingDialog.input.MainDataPath=Is this the main data path?
+SimpleMappingDialog.input.NoInput=There is no input for this mapping.
SimpleMappingDialog.input.RenamingOnOutput=Update mapped fieldnames downstream
+SimpleMappingDialog.output.NoOutput=There is no output for this mapping.
SimpleMappingDialog.InputMapping.ToolTip=Enter a regular expression here and a
directory in the first column.
SimpleMappingDialog.InputTab.column.SourceField=Fieldname from source transform
SimpleMappingDialog.InputTab.column.TargetField=Fieldname to mapping input
transform
@@ -127,7 +130,10 @@
SimpleMappingMeta.CheckResult.MappingOutFieldSpecifiedCouldNotFound=Mapping outp
SimpleMappingMeta.CheckResult.MappingPipelineSpecified=A mapping (pipeline) is
specified.
SimpleMappingMeta.CheckResult.MappingTargetFieldNotPresent=Mapping target
field [{0}] is not present in the input rows!
SimpleMappingMeta.CheckResult.MappingTargetFieldNotSepecified=Mapping target
field #{0} is not specified for input [{1}]!
+SimpleMappingMeta.CheckResult.NoInputConfigured=Transform is configured with
no input for this mapping.
SimpleMappingMeta.CheckResult.NoInputReceived=No input received from other
transforms!
+SimpleMappingMeta.CheckResult.NoOutputButOutgoingHops=This transform is set to
run without output, but outgoing hops are still connected. Remove those hops
before running.
+SimpleMappingMeta.CheckResult.NoOutputConfigured=Transform is configured with
no output for this mapping.
SimpleMappingMeta.CheckResult.NoMappingOutputTransformSpecified=No mapping
output transform was specified in the mapping!
SimpleMappingMeta.CheckResult.NoMappingSpecified=There is no mapping specified!
SimpleMappingMeta.CheckResult.NotReceivingAnyFields=Not receiving any fields
from previous transforms!
@@ -161,6 +167,8 @@ SimpleMapping.Injection.TARGET_TRANSFORM=Target transform
name
SimpleMapping.Injection.DESCRIPTION=Mapping description
SimpleMapping.Injection.MAIN_PATH=Main data path
SimpleMapping.Injection.RENAME_ON_OUTPUT=Update mapped field names downstream
+SimpleMapping.Injection.NO_INPUT=There is no input for this mapping
+SimpleMapping.Injection.NO_OUTPUT=There is no output for this mapping
SimpleMapping.Injection.SOURCE_FIELD=Source field name
SimpleMapping.Injection.TARGET_FIELD=Target field name
SimpleMapping.Injection.INHERIT_ALL_VARIABLES=Inherit all variables from the
parent pipeline
diff --git
a/plugins/transforms/mapping/src/test/java/org/apache/hop/pipeline/transforms/mapping/SimpleMappingMetaInjectionTest.java
b/plugins/transforms/mapping/src/test/java/org/apache/hop/pipeline/transforms/mapping/SimpleMappingMetaInjectionTest.java
index bdc6617223..698812c111 100644
---
a/plugins/transforms/mapping/src/test/java/org/apache/hop/pipeline/transforms/mapping/SimpleMappingMetaInjectionTest.java
+++
b/plugins/transforms/mapping/src/test/java/org/apache/hop/pipeline/transforms/mapping/SimpleMappingMetaInjectionTest.java
@@ -48,6 +48,8 @@ class SimpleMappingMetaInjectionTest {
assertTrue(keys.contains("filename"));
assertTrue(keys.contains("runConfiguration"));
+ assertTrue(keys.contains("NO_INPUT"));
+ assertTrue(keys.contains("NO_OUTPUT"));
assertTrue(keys.contains("INPUT_SOURCE_TRANSFORM"));
assertTrue(keys.contains("INPUT_TARGET_TRANSFORM"));
assertTrue(keys.contains("OUTPUT_SOURCE_TRANSFORM"));
@@ -73,6 +75,8 @@ class SimpleMappingMetaInjectionTest {
Map<String, Object> injectionKeyMap = new HashMap<>();
injectionKeyMap.put("filename", "child.hpl");
+ injectionKeyMap.put("NO_INPUT", "Y");
+ injectionKeyMap.put("NO_OUTPUT", "Y");
injectionKeyMap.put("INPUT_SOURCE_TRANSFORM", "Reader");
injectionKeyMap.put("INPUT_TARGET_TRANSFORM", "Mapping input");
injectionKeyMap.put("OUTPUT_SOURCE_TRANSFORM", "Mapping output");
@@ -115,6 +119,8 @@ class SimpleMappingMetaInjectionTest {
new MemoryMetadataProvider(), meta, injectionKeyMap,
injectionGroupMap);
assertEquals("child.hpl", meta.getFilename());
+ assertTrue(meta.isNoInput());
+ assertTrue(meta.isNoOutput());
assertEquals("Reader", meta.getInputMapping().getInputTransformName());
assertEquals("Mapping input",
meta.getInputMapping().getOutputTransformName());
assertEquals("Mapping output",
meta.getOutputMapping().getInputTransformName());
diff --git
a/plugins/transforms/mapping/src/test/java/org/apache/hop/pipeline/transforms/mapping/SimpleMappingMetaTest.java
b/plugins/transforms/mapping/src/test/java/org/apache/hop/pipeline/transforms/mapping/SimpleMappingMetaTest.java
index ed538dd9e6..c202b60a36 100644
---
a/plugins/transforms/mapping/src/test/java/org/apache/hop/pipeline/transforms/mapping/SimpleMappingMetaTest.java
+++
b/plugins/transforms/mapping/src/test/java/org/apache/hop/pipeline/transforms/mapping/SimpleMappingMetaTest.java
@@ -16,9 +16,25 @@
*/
package org.apache.hop.pipeline.transforms.mapping;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+import java.util.ArrayList;
+import java.util.List;
import org.apache.hop.core.HopEnvironment;
+import org.apache.hop.core.ICheckResult;
import org.apache.hop.core.plugins.PluginRegistry;
+import org.apache.hop.core.row.IRowMeta;
+import org.apache.hop.core.row.RowMeta;
+import org.apache.hop.core.row.value.ValueMetaInteger;
+import org.apache.hop.core.variables.Variables;
+import org.apache.hop.metadata.serializer.memory.MemoryMetadataProvider;
+import org.apache.hop.pipeline.PipelineHopMeta;
+import org.apache.hop.pipeline.PipelineMeta;
+import org.apache.hop.pipeline.transform.TransformMeta;
import org.apache.hop.pipeline.transform.TransformSerializationTestUtil;
+import org.apache.hop.pipeline.transforms.dummy.DummyMeta;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
@@ -33,22 +49,131 @@ class SimpleMappingMetaTest {
void testSerialization() throws Exception {
TransformSerializationTestUtil.testSerialization(
"/simple-mapping-transform.xml", SimpleMappingMeta.class);
- /*Document document =
-
XmlHandler.loadXmlFile(this.getClass().getResourceAsStream("/simple-mapping-transform.xml"));
- Node transformNode = XmlHandler.getSubNode(document,
TransformMeta.XML_TAG);
+ }
+
+ @Test
+ void testNoInputAndNoOutputFlags() throws Exception {
+ SimpleMappingMeta meta = new SimpleMappingMeta();
+ meta.setDefault();
+ assertFalse(meta.isNoInput());
+ assertFalse(meta.isNoOutput());
+ assertTrue(meta.getTransformIOMeta().isInputAcceptor());
+ assertTrue(meta.getTransformIOMeta().isOutputProducer());
+
+ meta.setNoInput(true);
+ assertTrue(meta.isNoInput());
+ assertFalse(meta.consumesMainInput());
+ assertTrue(meta.canStartWithoutInput());
+ assertFalse(meta.getTransformIOMeta().isInputAcceptor());
+ assertTrue(meta.getTransformIOMeta().isOutputProducer());
+
+ meta.setNoOutput(true);
+ assertTrue(meta.isNoOutput());
+ assertFalse(meta.getTransformIOMeta().isInputAcceptor());
+ assertFalse(meta.getTransformIOMeta().isOutputProducer());
+
+ IRowMeta row = new RowMeta();
+ row.addValueMeta(new ValueMetaInteger("a"));
+ meta.getFields(row, "origin", null, null, new Variables(), new
MemoryMetadataProvider());
+ assertEquals(0, row.size(), "getFields should clear the row when noOutput
is true");
+ }
+
+ @Test
+ void checkDoesNotReportIncomingHopsWhenNoInput() {
+ SimpleMappingMeta meta = new SimpleMappingMeta();
+ meta.setDefault();
+ meta.setNoInput(true);
+
+ List<ICheckResult> remarks = check(meta, new String[] {"upstream"}, new
String[0]);
+
+ assertTrue(
+ remarks.stream().noneMatch(remark -> remark.getType() ==
ICheckResult.TYPE_RESULT_ERROR));
+ }
+
+ @Test
+ void verifyReportsIncomingHopWhenNoInput() throws Exception {
+ SimpleMappingMeta mapping = new SimpleMappingMeta();
+ mapping.setDefault();
+ mapping.setNoInput(true);
+ PipelineMeta pipelineMeta = new PipelineMeta();
+ pipelineMeta.setName("no-input-hop");
+ TransformMeta from = new TransformMeta("upstream", new DummyMeta());
+ TransformMeta to = new TransformMeta("mapping", mapping);
+ pipelineMeta.addTransform(from);
+ pipelineMeta.addTransform(to);
+ pipelineMeta.addPipelineHop(new PipelineHopMeta(from, to));
+
+ List<ICheckResult> remarks = new ArrayList<>();
+ pipelineMeta.checkTransforms(
+ remarks, false, null, new Variables(), new MemoryMetadataProvider());
+
+ assertTrue(
+ remarks.stream()
+ .anyMatch(
+ remark ->
+ remark.getType() == ICheckResult.TYPE_RESULT_ERROR
+ && remark.getText() != null
+ && remark.getText().contains("not reading rows")));
+ }
+
+ @Test
+ void checkReportsErrorWhenNoOutputStillHasOutgoingHops() {
+ SimpleMappingMeta meta = new SimpleMappingMeta();
+ meta.setDefault();
+ meta.setNoOutput(true);
+
+ List<ICheckResult> remarks =
+ check(meta, new String[] {"upstream"}, new String[] {"downstream"});
+
+ assertTrue(
+ remarks.stream()
+ .anyMatch(
+ remark ->
+ remark.getType() == ICheckResult.TYPE_RESULT_ERROR
+ && remark.getText().contains("without output")));
+ }
+
+ @Test
+ void checkAcceptsStandaloneMappingWhenBothFlagsAreSet() {
SimpleMappingMeta meta = new SimpleMappingMeta();
- XmlMetadataUtil.deSerializeFromXml(
- null, transformNode, SimpleMappingMeta.class, meta, new
MemoryMetadataProvider());
- String xml =
- XmlHandler.openTag(TransformMeta.XML_TAG)
- + meta.getXml()
- + XmlHandler.closeTag(TransformMeta.XML_TAG);
-
- Document copyDocument = XmlHandler.loadXmlString(xml);
- Node copyNode = XmlHandler.getSubNode(copyDocument, TransformMeta.XML_TAG);
- SimpleMappingMeta copy = new SimpleMappingMeta();
- XmlMetadataUtil.deSerializeFromXml(
- null, copyNode, SimpleMappingMeta.class, copy, new
MemoryMetadataProvider());
- Assert.assertEquals(meta.getXml(), copy.getXml());*/
+ meta.setDefault();
+ meta.setNoInput(true);
+ meta.setNoOutput(true);
+
+ List<ICheckResult> remarks = check(meta, new String[0], new String[0]);
+
+ assertEquals(2, remarks.size());
+ assertTrue(
+ remarks.stream().allMatch(remark -> remark.getType() ==
ICheckResult.TYPE_RESULT_OK));
+ }
+
+ @Test
+ void checkReportsOnlyTheOutgoingHopWhenBothFlagsAreSet() {
+ SimpleMappingMeta meta = new SimpleMappingMeta();
+ meta.setDefault();
+ meta.setNoInput(true);
+ meta.setNoOutput(true);
+
+ List<ICheckResult> remarks =
+ check(meta, new String[] {"upstream"}, new String[] {"downstream"});
+
+ assertEquals(1, remarks.size());
+ assertEquals(ICheckResult.TYPE_RESULT_ERROR, remarks.get(0).getType());
+ assertTrue(remarks.get(0).getText().contains("without output"));
+ }
+
+ private static List<ICheckResult> check(SimpleMappingMeta meta, String[]
input, String[] output) {
+ List<ICheckResult> remarks = new ArrayList<>();
+ meta.check(
+ remarks,
+ null,
+ null,
+ new RowMeta(),
+ input,
+ output,
+ null,
+ new Variables(),
+ new MemoryMetadataProvider());
+ return remarks;
}
}
diff --git
a/plugins/transforms/mapping/src/test/java/org/apache/hop/pipeline/transforms/mapping/SimpleMappingTest.java
b/plugins/transforms/mapping/src/test/java/org/apache/hop/pipeline/transforms/mapping/SimpleMappingTest.java
index 4bd2e0da4c..939cb55986 100644
---
a/plugins/transforms/mapping/src/test/java/org/apache/hop/pipeline/transforms/mapping/SimpleMappingTest.java
+++
b/plugins/transforms/mapping/src/test/java/org/apache/hop/pipeline/transforms/mapping/SimpleMappingTest.java
@@ -23,6 +23,7 @@ import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyBoolean;
import static org.mockito.ArgumentMatchers.anyInt;
import static org.mockito.ArgumentMatchers.anyString;
+import static org.mockito.ArgumentMatchers.contains;
import static org.mockito.Mockito.doNothing;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.mock;
@@ -31,14 +32,23 @@ import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
+import org.apache.hop.core.Const;
+import org.apache.hop.core.QueueRowSet;
import org.apache.hop.core.exception.HopException;
import org.apache.hop.core.logging.ILoggingObject;
import org.apache.hop.core.row.IRowMeta;
import org.apache.hop.core.row.RowMeta;
import org.apache.hop.pipeline.Pipeline;
+import org.apache.hop.pipeline.PipelineHopMeta;
+import org.apache.hop.pipeline.PipelineMeta;
import org.apache.hop.pipeline.RowProducer;
+import org.apache.hop.pipeline.SingleThreadedPipelineExecutor;
+import org.apache.hop.pipeline.config.IPipelineEngineRunConfiguration;
+import org.apache.hop.pipeline.config.PipelineRunConfiguration;
import org.apache.hop.pipeline.engines.local.LocalPipelineEngine;
import org.apache.hop.pipeline.transform.ITransform;
+import org.apache.hop.pipeline.transform.TransformMeta;
+import org.apache.hop.pipeline.transforms.dummy.DummyMeta;
import org.apache.hop.pipeline.transforms.input.MappingInput;
import org.apache.hop.pipeline.transforms.mock.TransformMockHelper;
import org.apache.hop.pipeline.transforms.output.MappingOutput;
@@ -245,4 +255,154 @@ class SimpleMappingTest {
transformMockHelper.pipeline);
smp.dispose();
}
+
+ @Test
+ void testProcessRowWhenNoInputIsTrue() throws HopException {
+ when(transformMockHelper.iTransformMeta.isNoInput()).thenReturn(true);
+ when(transformMockHelper.iTransformMeta.isNoOutput()).thenReturn(false);
+ simpleMpData.mappingInput = null;
+
+ smp =
+ new SimpleMapping(
+ transformMockHelper.transformMeta,
+ transformMockHelper.iTransformMeta,
+ simpleMpData,
+ 0,
+ transformMockHelper.pipelineMeta,
+ transformMockHelper.pipeline);
+
+ assertFalse(smp.processRow(), "processRow should finish in one call when
noInput is true");
+ assertTrue(smp.getData().wasStarted, "The transform was started");
+ verify(transformMockHelper.pipeline, never()).addRowProducer(anyString(),
anyInt());
+ verify(transformMockHelper.pipeline, times(1)).startThreads();
+ verify(transformMockHelper.pipeline, times(1)).waitUntilFinished();
+ }
+
+ @Test
+ void testProcessRowWhenNoOutputIsTrue() throws HopException {
+ when(transformMockHelper.iTransformMeta.isNoInput()).thenReturn(false);
+ when(transformMockHelper.iTransformMeta.isNoOutput()).thenReturn(true);
+ simpleMpData.mappingOutput = null;
+
+ smp =
+ new SimpleMapping(
+ transformMockHelper.transformMeta,
+ transformMockHelper.iTransformMeta,
+ simpleMpData,
+ 0,
+ transformMockHelper.pipelineMeta,
+ transformMockHelper.pipeline);
+ smp.addRowSetToInputRowSets(transformMockHelper.getMockInputRowSet(new
Object[] {}));
+
+ assertTrue(smp.processRow(), "First processRow should return true for
input row");
+ assertFalse(smp.processRow(), "Second processRow should finish after input
is exhausted");
+ verify(transformMockHelper.pipeline,
times(1)).addRowProducer(MAPPING_INPUT_TRANSFORM_NAME, 0);
+ verify(transformMockHelper.pipeline,
never()).getTransform(MAPPING_OUTPUT_TRANSFORM_NAME, 0);
+ verify(transformMockHelper.pipeline, times(1)).startThreads();
+ verify(transformMockHelper.pipeline, times(1)).waitUntilFinished();
+ }
+
+ @Test
+ void testProcessRowWhenNoInputAndNoOutput() throws HopException {
+ when(transformMockHelper.iTransformMeta.isNoInput()).thenReturn(true);
+ when(transformMockHelper.iTransformMeta.isNoOutput()).thenReturn(true);
+ simpleMpData.mappingInput = null;
+ simpleMpData.mappingOutput = null;
+
+ smp = newSimpleMapping();
+
+ assertFalse(smp.processRow(), "A standalone mapping finishes in one call");
+ assertTrue(smp.getData().wasStarted);
+ verify(transformMockHelper.pipeline, never()).addRowProducer(anyString(),
anyInt());
+ verify(transformMockHelper.pipeline, never()).getTransform(anyString(),
anyInt());
+ verify(transformMockHelper.pipeline, times(1)).startThreads();
+ verify(transformMockHelper.pipeline, times(1)).waitUntilFinished();
+ }
+
+ @Test
+ void testProcessRowNoInputDrivesSingleThreadedLoop() throws HopException {
+ when(transformMockHelper.iTransformMeta.isNoInput()).thenReturn(true);
+ when(transformMockHelper.iTransformMeta.isNoOutput()).thenReturn(true);
+ simpleMpData.mappingInput = null;
+ simpleMpData.mappingOutput = null;
+ SingleThreadedPipelineExecutor executor =
mock(SingleThreadedPipelineExecutor.class);
+ when(executor.oneIteration()).thenReturn(true, false);
+ simpleMpData.executor = executor;
+
+ smp = newSimpleMapping();
+
+ assertFalse(smp.processRow());
+ verify(executor, times(2)).oneIteration();
+ verify(transformMockHelper.pipeline, never()).waitUntilFinished();
+ verify(transformMockHelper.pipeline, times(1)).startThreads();
+ }
+
+ @Test
+ void initRefusesIncomingHopWhenNoInputThroughTheEngine() {
+ SimpleMapping mapping = mappingWithIncomingHop();
+
+ assertFalse(mapping.init());
+ assertEquals(1, mapping.getErrors());
+ verify(transformMockHelper.iLogChannel).logError(contains("not reading
incoming rows"));
+ }
+
+ @Test
+ void initAllowsIncomingHopWhenUnconsumedMainInputIsAllowed() {
+ SimpleMapping mapping = mappingWithIncomingHop();
+ mapping.setVariable(Const.HOP_ALLOW_UNCONSUMED_MAIN_INPUT, "Y");
+
+ mapping.init();
+
+ verify(transformMockHelper.iLogChannel, never())
+ .logError(contains("not reading incoming rows"));
+ }
+
+ @Test
+ void initFailsWhenNoOutputStillHasAnOutgoingHop() {
+ when(transformMockHelper.iTransformMeta.isNoInput()).thenReturn(false);
+ when(transformMockHelper.iTransformMeta.isNoOutput()).thenReturn(true);
+ smp = newSimpleMapping();
+ smp.addRowSetToOutputRowSets(transformMockHelper.getMockInputRowSet(new
Object[] {}));
+
+ assertFalse(smp.init());
+ assertEquals(1, smp.getErrors());
+ verify(transformMockHelper.iLogChannel).logError(contains("without
output"));
+ }
+
+ private SimpleMapping mappingWithIncomingHop() {
+ SimpleMappingMeta realMeta = new SimpleMappingMeta();
+ realMeta.setDefault();
+ realMeta.setNoInput(true);
+
+ PipelineMeta pipelineMeta = new PipelineMeta();
+ pipelineMeta.setName("no-input-hop");
+ TransformMeta from = new TransformMeta("from", new DummyMeta());
+ TransformMeta to = new TransformMeta("mapping", realMeta);
+ pipelineMeta.addTransform(from);
+ pipelineMeta.addTransform(to);
+ pipelineMeta.addPipelineHop(new PipelineHopMeta(from, to));
+
+ QueueRowSet rowSet = new QueueRowSet();
+ rowSet.setThreadNameFromToCopy("from", 0, "mapping", 0);
+ doReturn(rowSet)
+ .when(transformMockHelper.pipeline)
+ .findRowSet(any(), anyInt(), any(), anyInt());
+ PipelineRunConfiguration runConfig = mock(PipelineRunConfiguration.class);
+ when(runConfig.getEngineRunConfiguration())
+ .thenReturn(mock(IPipelineEngineRunConfiguration.class));
+
doReturn(runConfig).when(transformMockHelper.pipeline).getPipelineRunConfiguration();
+
+ return new SimpleMapping(
+ to, realMeta, new SimpleMappingData(), 0, pipelineMeta,
transformMockHelper.pipeline);
+ }
+
+ private SimpleMapping newSimpleMapping() {
+ return new SimpleMapping(
+ transformMockHelper.transformMeta,
+ transformMockHelper.iTransformMeta,
+ simpleMpData,
+ 0,
+ transformMockHelper.pipelineMeta,
+ transformMockHelper.pipeline);
+ }
}
diff --git
a/plugins/transforms/mapping/src/test/java/org/apache/hop/pipeline/transforms/mapping/SimpleMappingWorkflowResultTest.java
b/plugins/transforms/mapping/src/test/java/org/apache/hop/pipeline/transforms/mapping/SimpleMappingWorkflowResultTest.java
new file mode 100644
index 0000000000..4a8db5d0f2
--- /dev/null
+++
b/plugins/transforms/mapping/src/test/java/org/apache/hop/pipeline/transforms/mapping/SimpleMappingWorkflowResultTest.java
@@ -0,0 +1,205 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.hop.pipeline.transforms.mapping;
+
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+import java.util.concurrent.atomic.AtomicBoolean;
+import org.apache.hop.core.HopEnvironment;
+import org.apache.hop.core.Result;
+import org.apache.hop.metadata.serializer.memory.MemoryMetadataProvider;
+import org.apache.hop.workflow.WorkflowHopMeta;
+import org.apache.hop.workflow.WorkflowMeta;
+import org.apache.hop.workflow.action.ActionBase;
+import org.apache.hop.workflow.action.ActionMeta;
+import org.apache.hop.workflow.actions.start.ActionStart;
+import org.apache.hop.workflow.engines.local.LocalWorkflowEngine;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
+
+/**
+ * The 0048 workflow ends its success path on Delete file, which reports
success, and its failure
+ * path on Abort. This runs that hop shape with stub actions and checks the
result hop-run reads.
+ */
+class SimpleMappingWorkflowResultTest {
+
+ @BeforeAll
+ static void initHop() throws Exception {
+ HopEnvironment.init();
+ }
+
+ @Test
+ void failingPipelineFailsTheWorkflowAfterCleanup() {
+ Harness harness = new Harness(false, true);
+
+ assertFalse(harness.run().isResult());
+ assertTrue(harness.failureCleanup.get());
+ assertTrue(harness.aborted.get());
+ assertFalse(harness.successCleanup.get());
+ }
+
+ @Test
+ void failingUnitTestFailsTheWorkflowAfterCleanup() {
+ Harness harness = new Harness(true, false);
+
+ assertFalse(harness.run().isResult());
+ assertTrue(harness.failureCleanup.get());
+ assertTrue(harness.aborted.get());
+ assertFalse(harness.successCleanup.get());
+ }
+
+ @Test
+ void successfulRunEndsTrueAfterCleanup() {
+ Harness harness = new Harness(true, true);
+
+ assertTrue(harness.run().isResult());
+ assertTrue(harness.successCleanup.get());
+ assertFalse(harness.failureCleanup.get());
+ assertFalse(harness.aborted.get());
+ }
+
+ /**
+ * Start, then a pipeline and the unit-test action on success hops. Both
failure hops share a
+ * cleanup action that is followed by Abort. The success hop ends on a
cleanup action that returns
+ * true, the same way ActionDeleteFile does.
+ */
+ private static final class Harness {
+ private final AtomicBoolean successCleanup = new AtomicBoolean();
+ private final AtomicBoolean failureCleanup = new AtomicBoolean();
+ private final AtomicBoolean aborted = new AtomicBoolean();
+ private final boolean pipelineOk;
+ private final boolean testsOk;
+
+ private Harness(boolean pipelineOk, boolean testsOk) {
+ this.pipelineOk = pipelineOk;
+ this.testsOk = testsOk;
+ }
+
+ private Result run() {
+ ActionMeta start = action("Start", new ActionStart("Start"));
+ ActionMeta pipeline = action("pipeline", new FlagAction(pipelineOk,
null));
+ ActionMeta tests = action("Run simple-mapping tests", new
FlagAction(testsOk, null));
+ ActionMeta deleteOk = action("Delete success", new FlagAction(true,
successCleanup));
+ ActionMeta deleteFail = action("Delete failure", new FlagAction(true,
failureCleanup));
+ ActionMeta abort = action("Abort workflow", new AbortAction(aborted));
+
+ WorkflowMeta meta = new WorkflowMeta();
+ meta.setName("mapping-workflow-result");
+ meta.addAction(start);
+ meta.addAction(pipeline);
+ meta.addAction(tests);
+ meta.addAction(deleteOk);
+ meta.addAction(deleteFail);
+ meta.addAction(abort);
+
+ meta.addWorkflowHop(new WorkflowHopMeta(start, pipeline));
+ meta.addWorkflowHop(successHop(pipeline, tests));
+ meta.addWorkflowHop(failureHop(pipeline, deleteFail));
+ meta.addWorkflowHop(successHop(tests, deleteOk));
+ meta.addWorkflowHop(failureHop(tests, deleteFail));
+ meta.addWorkflowHop(unconditionalHop(deleteFail, abort));
+
+ LocalWorkflowEngine workflow = new LocalWorkflowEngine(meta);
+ workflow.setMetadataProvider(new MemoryMetadataProvider());
+ return workflow.startExecution();
+ }
+
+ private static ActionMeta action(String name, ActionBase action) {
+ action.setName(name);
+ return new ActionMeta(action);
+ }
+
+ private static WorkflowHopMeta successHop(ActionMeta from, ActionMeta to) {
+ WorkflowHopMeta hop = new WorkflowHopMeta(from, to);
+ hop.setEvaluation(true);
+ hop.setUnconditional(false);
+ return hop;
+ }
+
+ private static WorkflowHopMeta failureHop(ActionMeta from, ActionMeta to) {
+ WorkflowHopMeta hop = new WorkflowHopMeta(from, to);
+ hop.setEvaluation(false);
+ hop.setUnconditional(false);
+ return hop;
+ }
+
+ private static WorkflowHopMeta unconditionalHop(ActionMeta from,
ActionMeta to) {
+ WorkflowHopMeta hop = new WorkflowHopMeta(from, to);
+ hop.setUnconditional(true);
+ return hop;
+ }
+ }
+
+ /** Sets the result the way a pipeline, a unit-test action, or Delete file
does. */
+ private static final class FlagAction extends ActionBase {
+ private final boolean success;
+ private final AtomicBoolean ran;
+
+ private FlagAction(boolean success, AtomicBoolean ran) {
+ super("", "");
+ this.success = success;
+ this.ran = ran;
+ }
+
+ @Override
+ public Result execute(Result result, int nr) {
+ if (ran != null) {
+ ran.set(true);
+ }
+ result.setResult(success);
+ if (!success) {
+ result.setNrErrors(1);
+ }
+ return result;
+ }
+
+ @Override
+ public boolean isEvaluation() {
+ return true;
+ }
+ }
+
+ /** Same outcome as ActionAbort: the workflow result is false and execution
stops. */
+ private static final class AbortAction extends ActionBase {
+ private final AtomicBoolean ran;
+
+ private AbortAction(AtomicBoolean ran) {
+ super("", "");
+ this.ran = ran;
+ }
+
+ @Override
+ public Result execute(Result result, int nr) {
+ ran.set(true);
+ result.setNrErrors(1);
+ result.setResult(false);
+ getParentWorkflow().stopExecution();
+ return result;
+ }
+
+ @Override
+ public boolean resetErrorsBeforeExecution() {
+ return false;
+ }
+
+ @Override
+ public boolean isEvaluation() {
+ return true;
+ }
+ }
+}
diff --git
a/plugins/transforms/mapping/src/test/resources/simple-mapping-transform.xml
b/plugins/transforms/mapping/src/test/resources/simple-mapping-transform.xml
index 4b38b5b08a..8d84c7d37a 100644
--- a/plugins/transforms/mapping/src/test/resources/simple-mapping-transform.xml
+++ b/plugins/transforms/mapping/src/test/resources/simple-mapping-transform.xml
@@ -28,6 +28,8 @@
<schema_name/>
</partitioning>
<filename>${PROJECT_HOME}/mapping-sum.hpl</filename>
+ <no_input>N</no_input>
+ <no_output>N</no_output>
<mappings>
<input>
<mapping>