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 d6b0d91e69 Property input repeats its first-row setup on every row,
fixes #9338 (#9343)
d6b0d91e69 is described below
commit d6b0d91e6929050d1c591abbcd3866320b878bed
Author: Hans Van Akelyen <[email protected]>
AuthorDate: Fri Nov 6 20:41:22 2026 +0100
Property input repeats its first-row setup on every row, fixes #9338 (#9343)
---
.../transforms/propertyinput/PropertyInput.java | 3 ++
.../PropertyInputContentParsingTest.java | 48 ++++++++++++++++++++++
.../propertyinput/files/second.properties | 23 +++++++++++
3 files changed, 74 insertions(+)
diff --git
a/plugins/transforms/propertyinput/src/main/java/org/apache/hop/pipeline/transforms/propertyinput/PropertyInput.java
b/plugins/transforms/propertyinput/src/main/java/org/apache/hop/pipeline/transforms/propertyinput/PropertyInput.java
index 1467b91e71..6eb7b553ab 100644
---
a/plugins/transforms/propertyinput/src/main/java/org/apache/hop/pipeline/transforms/propertyinput/PropertyInput.java
+++
b/plugins/transforms/propertyinput/src/main/java/org/apache/hop/pipeline/transforms/propertyinput/PropertyInput.java
@@ -65,6 +65,9 @@ public class PropertyInput extends
BaseTransform<PropertyInputMeta, PropertyInpu
@Override
public boolean processRow() throws HopException {
if (first && !meta.isFileField()) {
+ // Once per transform copy: list the files and build the row metadata
only on the first row.
+ first = false;
+
data.files = meta.getFiles(this);
if (data.files == null || data.files.nrOfFiles() == 0) {
setOutputDone(); // signal end to receiver(s)
diff --git
a/plugins/transforms/propertyinput/src/test/java/org/apache/hop/pipeline/transforms/propertyinput/PropertyInputContentParsingTest.java
b/plugins/transforms/propertyinput/src/test/java/org/apache/hop/pipeline/transforms/propertyinput/PropertyInputContentParsingTest.java
index 040c569627..9124d63c42 100644
---
a/plugins/transforms/propertyinput/src/test/java/org/apache/hop/pipeline/transforms/propertyinput/PropertyInputContentParsingTest.java
+++
b/plugins/transforms/propertyinput/src/test/java/org/apache/hop/pipeline/transforms/propertyinput/PropertyInputContentParsingTest.java
@@ -16,6 +16,12 @@
*/
package org.apache.hop.pipeline.transforms.propertyinput;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.Mockito.spy;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+
+import org.apache.hop.core.variables.IVariables;
import org.apache.hop.junit.rules.RestoreHopEngineEnvironmentExtension;
import
org.apache.hop.pipeline.transforms.propertyinput.PropertyInputMeta.KeyValue;
import
org.apache.hop.pipeline.transforms.propertyinput.PropertyInputMeta.PIField;
@@ -26,6 +32,10 @@ class PropertyInputContentParsingTest extends
BasePropertyParsingTest {
@RegisterExtension
static RestoreHopEngineEnvironmentExtension env = new
RestoreHopEngineEnvironmentExtension();
+ private static final Object[][] BOTH_FILES = {
+ {"f1", "d1"}, {"f2", "d2"}, {"g1", "e1"}, {"g2", "e2"}, {"g3", "e3"}
+ };
+
@Test
void testDefaultOptions() throws Exception {
init("default.properties");
@@ -40,4 +50,42 @@ class PropertyInputContentParsingTest extends
BasePropertyParsingTest {
check(new Object[][] {{"f1", "d1"}, {"f2", "d2"}});
}
+
+ @Test
+ void testEveryFileIsReadOnce() throws Exception {
+ init("default.properties");
+ addFile("second.properties");
+ setKeyValueFields();
+
+ process();
+
+ check(BOTH_FILES);
+ }
+
+ @Test
+ void testFilesAreListedOnce() throws Exception {
+ meta = spy(meta);
+ init("default.properties");
+ addFile("second.properties");
+ setKeyValueFields();
+
+ process();
+
+ check(BOTH_FILES);
+ verify(meta, times(1)).getFiles(any(IVariables.class));
+ }
+
+ private void addFile(String file) throws Exception {
+ PropertyInputMeta.PIFile piFile = new PropertyInputMeta.PIFile();
+ piFile.setName(getFile(file).getURL().getFile());
+ meta.getFiles().add(piFile);
+ }
+
+ private void setKeyValueFields() throws Exception {
+ PIField f1 = new PIField("f1");
+ f1.setColumn(KeyValue.KEY);
+ PIField f2 = new PIField("f2");
+ f2.setColumn(KeyValue.VALUE);
+ setFields(f1, f2);
+ }
}
diff --git
a/plugins/transforms/propertyinput/src/test/resources/org/apache/hop/pipeline/transforms/propertyinput/files/second.properties
b/plugins/transforms/propertyinput/src/test/resources/org/apache/hop/pipeline/transforms/propertyinput/files/second.properties
new file mode 100644
index 0000000000..d866c1a08f
--- /dev/null
+++
b/plugins/transforms/propertyinput/src/test/resources/org/apache/hop/pipeline/transforms/propertyinput/files/second.properties
@@ -0,0 +1,23 @@
+#
+#
+# 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.
+#
+#
+#
+
+g1=e1
+g2=e2
+g3=e3