This is an automated email from the ASF dual-hosted git repository.
hansva 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 1d3c4f2138 Standardize phone number transfo return invalid data type
#7080 (#7081)
1d3c4f2138 is described below
commit 1d3c4f2138b62d944fdb40d342201d3bf8173e7f
Author: Nicolas Adment <[email protected]>
AuthorDate: Mon May 4 09:48:27 2026 +0200
Standardize phone number transfo return invalid data type #7080 (#7081)
---
.../transforms/0099-standardize-phone-number.hpl | 259 +++++++++++++++++++++
.../main-0099-standardize-phone-number.hwf | 87 +++++++
.../StandardizePhoneField.java | 52 +----
.../StandardizePhoneNumber.java | 5 +-
.../StandardizePhoneNumberDialog.java | 17 +-
5 files changed, 364 insertions(+), 56 deletions(-)
diff --git a/integration-tests/transforms/0099-standardize-phone-number.hpl
b/integration-tests/transforms/0099-standardize-phone-number.hpl
new file mode 100644
index 0000000000..d8201d7d63
--- /dev/null
+++ b/integration-tests/transforms/0099-standardize-phone-number.hpl
@@ -0,0 +1,259 @@
+<?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>
+ <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>
+ <pipeline_type>Normal</pipeline_type>
+ <pipeline_status>0</pipeline_status>
+ <parameters/>
+ <name>test-standardize-phone-number</name>
+ <name_sync_with_filename>Y</name_sync_with_filename>
+ <created_user>-</created_user>
+ <modified_user>-</modified_user>
+ <created_date>2026/03/25 17:50:32.044</created_date>
+ <modified_date>2026/03/25 17:50:32.044</modified_date>
+ </info>
+ <transform>
+ <type>Dummy</type>
+ <name>Dummy (do nothing)</name>
+ <distribute>Y</distribute>
+ <copies>1</copies>
+ <GUI>
+ <xloc>384</xloc>
+ <yloc>272</yloc>
+ </GUI>
+ <partitioning>
+ <method>none</method>
+ <schema_name/>
+ </partitioning>
+ <attributes/>
+ </transform>
+ <transform>
+ <type>DataGrid</type>
+ <name>Keys</name>
+ <fields>
+ <field>
+ <name>KEY</name>
+ <type>Integer</type>
+ <length>-1</length>
+ <precision>-1</precision>
+ <set_empty_string>N</set_empty_string>
+ </field>
+ </fields>
+ <data>
+ <line>
+ <item>1</item>
+ </line>
+ <line>
+ <item>2</item>
+ </line>
+ <line>
+ <item>3</item>
+ </line>
+ <line>
+ <item>4</item>
+ </line>
+ <line>
+ <item>5</item>
+ </line>
+ <line>
+ <item>6</item>
+ </line>
+ <line>
+ <item>7</item>
+ </line>
+ </data>
+ <distribute>Y</distribute>
+ <copies>1</copies>
+ <GUI>
+ <xloc>80</xloc>
+ <yloc>272</yloc>
+ </GUI>
+ <partitioning>
+ <method>none</method>
+ <schema_name/>
+ </partitioning>
+ <attributes/>
+ </transform>
+ <transform>
+ <type>DataGrid</type>
+ <name>Phones</name>
+ <fields>
+ <field>
+ <name>KEY</name>
+ <type>Integer</type>
+ <length>-1</length>
+ <precision>-1</precision>
+ <set_empty_string>N</set_empty_string>
+ </field>
+ <field>
+ <name>PHONE</name>
+ <type>String</type>
+ <length>-1</length>
+ <precision>-1</precision>
+ <set_empty_string>N</set_empty_string>
+ </field>
+ <field>
+ <name>COUNTRY</name>
+ <type>String</type>
+ <length>-1</length>
+ <precision>-1</precision>
+ <set_empty_string>N</set_empty_string>
+ </field>
+ </fields>
+ <data>
+ <line>
+ <item>1</item>
+ <item>0032494 00 00 00</item>
+ <item>BE</item>
+ </line>
+ <line>
+ <item>2</item>
+ <item>0498/00 00 00</item>
+ <item>BE</item>
+ </line>
+ <line>
+ <item>3</item>
+ <item> 0494000000</item>
+ <item/>
+ </line>
+ <line>
+ <item>4</item>
+ <item>0033.3.88.25.66.06</item>
+ <item>FR</item>
+ </line>
+ <line>
+ <item>5</item>
+ <item>+41 44 668 18 00</item>
+ <item>CH</item>
+ </line>
+ <line>
+ <item>6</item>
+ <item>error</item>
+ <item/>
+ </line>
+ <line>
+ <item>7</item>
+ <item/>
+ <item/>
+ </line>
+ </data>
+ <distribute>Y</distribute>
+ <copies>1</copies>
+ <GUI>
+ <xloc>240</xloc>
+ <yloc>64</yloc>
+ </GUI>
+ <partitioning>
+ <method>none</method>
+ <schema_name/>
+ </partitioning>
+ <attributes/>
+ </transform>
+ <transform>
+ <type>StandardizePhoneNumber</type>
+ <name>Standardize phone number</name>
+ <fields>
+ <field>
+ <input>PHONE</input>
+ <output>PHONE_CLEANED</output>
+ <format>NATIONAL</format>
+ <country>COUNTRY</country>
+ <defaultCountry>BE</defaultCountry>
+ <numbertype>TYPE</numbertype>
+ <isvalidnumber>VALIDE</isvalidnumber>
+ </field>
+ </fields>
+ <distribute>Y</distribute>
+ <copies>1</copies>
+ <GUI>
+ <xloc>240</xloc>
+ <yloc>160</yloc>
+ </GUI>
+ <partitioning>
+ <method>none</method>
+ <schema_name/>
+ </partitioning>
+ <attributes/>
+ </transform>
+ <transform>
+ <type>StreamLookup</type>
+ <name>Stream lookup</name>
+ <from>Standardize phone number</from>
+ <input_sorted>N</input_sorted>
+ <preserve_memory>Y</preserve_memory>
+ <sorted_list>N</sorted_list>
+ <integer_pair>N</integer_pair>
+ <lookup>
+ <key>
+ <name>KEY</name>
+ <field>KEY</field>
+ </key>
+ <value>
+ <name>PHONE_CLEANED</name>
+ <rename>PHONE_CLEANED</rename>
+ <type>String</type>
+ </value>
+ <value>
+ <name>TYPE</name>
+ <rename>TYPE</rename>
+ <type>String</type>
+ </value>
+ </lookup>
+ <distribute>Y</distribute>
+ <copies>1</copies>
+ <GUI>
+ <xloc>240</xloc>
+ <yloc>272</yloc>
+ </GUI>
+ <partitioning>
+ <method>none</method>
+ <schema_name/>
+ </partitioning>
+ <attributes/>
+ </transform>
+ <order>
+ <hop>
+ <from>Stream lookup</from>
+ <to>Dummy (do nothing)</to>
+ <enabled>Y</enabled>
+ </hop>
+ <hop>
+ <from>Phones</from>
+ <to>Standardize phone number</to>
+ <enabled>Y</enabled>
+ </hop>
+ <hop>
+ <from>Keys</from>
+ <to>Stream lookup</to>
+ <enabled>Y</enabled>
+ </hop>
+ <hop>
+ <from>Standardize phone number</from>
+ <to>Stream lookup</to>
+ <enabled>Y</enabled>
+ </hop>
+ </order>
+ <notepads/>
+ <attributes/>
+ <transform_error_handling/>
+</pipeline>
diff --git
a/integration-tests/transforms/main-0099-standardize-phone-number.hwf
b/integration-tests/transforms/main-0099-standardize-phone-number.hwf
new file mode 100644
index 0000000000..55c901ca0f
--- /dev/null
+++ b/integration-tests/transforms/main-0099-standardize-phone-number.hwf
@@ -0,0 +1,87 @@
+<?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.
+
+-->
+<workflow>
+ <name>main-0090-sort-rows</name>
+ <name_sync_with_filename>Y</name_sync_with_filename>
+ <created_user>-</created_user>
+ <modified_user>-</modified_user>
+ <created_date>2026/03/25 13:53:08.752</created_date>
+ <modified_date>2026/03/25 13:53:08.752</modified_date>
+ <parameters/>
+ <actions>
+ <action>
+ <repeat>N</repeat>
+ <schedulerType>0</schedulerType>
+ <intervalSeconds>0</intervalSeconds>
+ <intervalMinutes>60</intervalMinutes>
+ <DayOfMonth>1</DayOfMonth>
+ <weekDay>1</weekDay>
+ <minutes>0</minutes>
+ <hour>12</hour>
+ <doNotWaitOnFirstExecution>N</doNotWaitOnFirstExecution>
+ <name>Start</name>
+ <description/>
+ <type>SPECIAL</type>
+ <attributes/>
+ <xloc>96</xloc>
+ <yloc>64</yloc>
+ <parallel>N</parallel>
+ <attributes_hac/>
+ </action>
+ <action>
+ <filename>${PROJECT_HOME}/0099-standardize-phone-number.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>
+ <logfile/>
+ <logext/>
+ <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>
+ <name>0099-standardize-phone-number.hpl</name>
+ <type>PIPELINE</type>
+ <attributes/>
+ <xloc>288</xloc>
+ <yloc>64</yloc>
+ <parallel>N</parallel>
+ <attributes_hac/>
+ </action>
+ </actions>
+ <hops>
+ <hop>
+ <from>Start</from>
+ <to>0099-standardize-phone-number.hpl</to>
+ <evaluation>Y</evaluation>
+ <unconditional>Y</unconditional>
+ <enabled>Y</enabled>
+ </hop>
+ </hops>
+ <notepads/>
+ <attributes/>
+</workflow>
diff --git
a/plugins/transforms/standardizephonenumber/src/main/java/org/apache/hop/pipeline/transforms/standardizephonenumber/StandardizePhoneField.java
b/plugins/transforms/standardizephonenumber/src/main/java/org/apache/hop/pipeline/transforms/standardizephonenumber/StandardizePhoneField.java
index 55fbdf4537..824e8abd61 100644
---
a/plugins/transforms/standardizephonenumber/src/main/java/org/apache/hop/pipeline/transforms/standardizephonenumber/StandardizePhoneField.java
+++
b/plugins/transforms/standardizephonenumber/src/main/java/org/apache/hop/pipeline/transforms/standardizephonenumber/StandardizePhoneField.java
@@ -18,10 +18,13 @@
package org.apache.hop.pipeline.transforms.standardizephonenumber;
import com.google.i18n.phonenumbers.PhoneNumberUtil.PhoneNumberFormat;
+import lombok.Getter;
+import lombok.Setter;
import org.apache.commons.lang3.StringUtils;
import org.apache.hop.metadata.api.HopMetadataProperty;
/** Contains the properties of the fields to standardize. */
+@Getter
public class StandardizePhoneField implements Cloneable {
/** The input field name */
@@ -37,6 +40,7 @@ public class StandardizePhoneField implements Cloneable {
private String outputField = null;
/** The format */
+ @Setter
@HopMetadataProperty(
key = "format",
injectionKeyDescription =
"StandardizePhoneNumber.Injection.NumberFormat")
@@ -48,6 +52,8 @@ public class StandardizePhoneField implements Cloneable {
injectionKeyDescription =
"StandardizePhoneNumber.Injection.CountryField")
private String countryField = null;
+ /** The country codes (ISO 2) */
+ @Setter
@HopMetadataProperty(
key = "defaultCountry",
injectionKeyDescription =
"StandardizePhoneNumber.Injection.DefaultCountry")
@@ -85,68 +91,22 @@ public class StandardizePhoneField implements Cloneable {
return new StandardizePhoneField(this);
}
- public String getInputField() {
- return inputField;
- }
-
public void setInputField(final String field) {
this.inputField = StringUtils.stripToNull(field);
}
- public String getOutputField() {
- return outputField;
- }
-
public void setOutputField(final String field) {
this.outputField = StringUtils.stripToNull(field);
}
- public String getCountryField() {
- return countryField;
- }
-
public void setCountryField(final String field) {
this.countryField = StringUtils.stripToNull(field);
}
- /**
- * Get the country codes (ISO 2)
- *
- * @return
- */
- public String getDefaultCountry() {
- return defaultCountry;
- }
-
- /**
- * Set the country codes (ISO 2)
- *
- * @param country
- */
- public void setDefaultCountry(String country) {
- this.defaultCountry = country;
- }
-
- public String getNumberFormat() {
- return numberFormat;
- }
-
- public void setNumberFormat(final String param) {
- this.numberFormat = param;
- }
-
- public String getNumberTypeField() {
- return numberTypeField;
- }
-
public void setNumberTypeField(final String phoneNumberTypeField) {
this.numberTypeField = StringUtils.stripToNull(phoneNumberTypeField);
}
- public String getIsValidNumberField() {
- return isValidNumberField;
- }
-
public void setIsValidNumberField(final String field) {
this.isValidNumberField = StringUtils.stripToNull(field);
}
diff --git
a/plugins/transforms/standardizephonenumber/src/main/java/org/apache/hop/pipeline/transforms/standardizephonenumber/StandardizePhoneNumber.java
b/plugins/transforms/standardizephonenumber/src/main/java/org/apache/hop/pipeline/transforms/standardizephonenumber/StandardizePhoneNumber.java
index 50772b2756..f9da3af078 100644
---
a/plugins/transforms/standardizephonenumber/src/main/java/org/apache/hop/pipeline/transforms/standardizephonenumber/StandardizePhoneNumber.java
+++
b/plugins/transforms/standardizephonenumber/src/main/java/org/apache/hop/pipeline/transforms/standardizephonenumber/StandardizePhoneNumber.java
@@ -160,8 +160,9 @@ public class StandardizePhoneNumber
if (!Utils.isEmpty(standardize.getNumberTypeField())) {
int i =
data.outputRowMeta.indexOfValue(standardize.getNumberTypeField());
- if (phoneNumber != null) outputRow[i] =
phoneNumberService.getNumberType(phoneNumber);
- else outputRow[i] = "ERROR";
+ if (phoneNumber != null) {
+ outputRow[i] =
phoneNumberService.getNumberType(phoneNumber).toString();
+ } else outputRow[i] = "ERROR";
}
if (!Utils.isEmpty(standardize.getIsValidNumberField())) {
diff --git
a/plugins/transforms/standardizephonenumber/src/main/java/org/apache/hop/pipeline/transforms/standardizephonenumber/StandardizePhoneNumberDialog.java
b/plugins/transforms/standardizephonenumber/src/main/java/org/apache/hop/pipeline/transforms/standardizephonenumber/StandardizePhoneNumberDialog.java
index 8011fbf1f3..a9918ccfe5 100644
---
a/plugins/transforms/standardizephonenumber/src/main/java/org/apache/hop/pipeline/transforms/standardizephonenumber/StandardizePhoneNumberDialog.java
+++
b/plugins/transforms/standardizephonenumber/src/main/java/org/apache/hop/pipeline/transforms/standardizephonenumber/StandardizePhoneNumberDialog.java
@@ -1,18 +1,19 @@
-/*******************************************************************************
+/*
+ * 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
*
- * Licensed 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
+ * 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.standardizephonenumber;