[Bug]: Concat Fields trims the fields
Apache Hop version?
2.17
Java version?
17.0.17
Operating system
Windows
What happened?
The concatted fields with trimtype = None, are also trimmed.
The reason is within the ConcatFields.java the concatField method:
if (trimType != null) {
targetField.append(
Const.trimToType(
**valueMeta.getString(valueData)**, ValueMetaBase.getTrimTypeByCode(trimType)));
}
The ValueMetaBase.getString() performs a trim():
if (string != null) {
string = trim(string);
}
Issue Priority
Priority: 3
Issue Component
Component: Pipelines
The latest given trim type should indeed be taken. A copy of the IValueMeta object needs to be take (cloned) and then the trim type needs to be changed. Do we need an extra option, "use field trim type" in the Concat Fields dialog?
I wouldn't go as far as to add an option for the "use field trim type" the get fields button should also "import" the correct trim types from the existing fields and then it's up to the developer.
I agree @hansva. The last options given are the ones we should follow.
@mattcasters @hansva is not clear to me if something must be fixed and what :-(
It's subtle in the sense that if you have trim type set on the field metadata of an incoming field, you want to ignore that setting, even if the dialog says "None" as the trim type.